Main MRPT website > C++ reference for MRPT 1.5.5
List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes
mrpt::poses::CPose2DInterpolator Class Reference

Detailed Description

This class stores a time-stamped trajectory in SE(2) (mrpt::math::TPose2D poses).

It can also interpolate SE(2) poses over time using linear, splines or SLERP interpolation, as set in CPose2DInterpolator::setInterpolationMethod() Usage:

Time is represented with mrpt::system::TTimeStamp. See mrpt::system for methods and utilities to manage these time references.

See TInterpolatorMethod for the list of interpolation methods. The default method at constructor is "imLinearSlerp".

See Also
CPoseOrPoint

Definition at line 45 of file CPose2DInterpolator.h.

#include <mrpt/poses/CPose2DInterpolator.h>

Inheritance diagram for mrpt::poses::CPose2DInterpolator:
Inheritance graph

Public Member Functions

voidoperator new (size_t size)
 
voidoperator new[] (size_t size)
 
void operator delete (void *ptr) throw ()
 
void operator delete[] (void *ptr) throw ()
 
void operator delete (void *memory, void *ptr) throw ()
 
voidoperator new (size_t size, const std::nothrow_t &) throw ()
 
void operator delete (void *ptr, const std::nothrow_t &) throw ()
 
virtual mxArraywriteToMatlab () const
 Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class. More...
 
mrpt::utils::CObjectPtr duplicateGetSmartPtr () const
 Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer). More...
 
CObjectclone () const
 Cloning interface for smart pointers. More...
 
void insert (mrpt::system::TTimeStamp t, const pose_t &p)
 Inserts a new pose in the sequence. More...
 
void insert (mrpt::system::TTimeStamp t, const cpose_t &p)
 Overload (slower) More...
 
pose_tinterpolate (mrpt::system::TTimeStamp t, pose_t &out_interp, bool &out_valid_interp) const
 Returns the pose at a given time, or interpolates using splines if there is not an exact match. More...
 
cpose_tinterpolate (mrpt::system::TTimeStamp t, cpose_t &out_interp, bool &out_valid_interp) const
 
void clear ()
 Clears the current sequence of poses. More...
 
void setMaxTimeInterpolation (double time)
 Set value of the maximum time to consider interpolation. More...
 
double getMaxTimeInterpolation ()
 Set value of the maximum time to consider interpolation. More...
 
bool getPreviousPoseWithMinDistance (const mrpt::system::TTimeStamp &t, double distance, pose_t &out_pose)
 Get the previous CPose3D in the map with a minimum defined distance. More...
 
bool getPreviousPoseWithMinDistance (const mrpt::system::TTimeStamp &t, double distance, cpose_t &out_pose)
 
bool saveToTextFile (const std::string &s) const
 Saves the points in the interpolator to a text file, with this format: Each row contains these elements separated by spaces: More...
 
bool saveInterpolatedToTextFile (const std::string &s, double period) const
 Saves the points in the interpolator to a text file, with the same format that saveToTextFile, but interpolating the path with the given period in seconds. More...
 
bool loadFromTextFile (const std::string &s)
 Loads from a text file, in the format described by saveToTextFile. More...
 
void getBoundingBox (point_t &minCorner, point_t &maxCorner) const
 Computes the bounding box in all Euclidean coordinates of the whole path. More...
 
void setInterpolationMethod (TInterpolatorMethod method)
 Change the method used to interpolate the robot path. The default method at construction is "imSpline". More...
 
TInterpolatorMethod getInterpolationMethod () const
 Returns the currently set interpolation method. More...
 
void filter (unsigned int component, unsigned int samples)
 Filters by averaging one of the components of the pose data within the interpolator. More...
 

Static Public Member Functions

static voidoperator new (size_t size, void *ptr)
 

Static Public Attributes

static const
mrpt::utils::TRuntimeClassId 
classCObject
 
RTTI stuff
static const
mrpt::utils::TRuntimeClassId 
classCSerializable
 

Protected Member Functions

void impl_interpolation (const mrpt::math::CArrayDouble< 4 > &ts, const TTimePosePair p1, const TTimePosePair p2, const TTimePosePair p3, const TTimePosePair p4, const TInterpolatorMethod method, double td, pose_t &out_interp) const
 
CSerializable virtual methods
void writeToStream (mrpt::utils::CStream &out, int *getVersion) const
 Introduces a pure virtual method responsible for writing to a CStream. More...
 
void readFromStream (mrpt::utils::CStream &in, int version)
 Introduces a pure virtual method responsible for loading from a CStream This can not be used directly be users, instead use "stream >> object;" for reading it from a stream or "stream >> object_ptr;" if the class is unknown apriori. More...
 

Protected Attributes

TPath m_path
 The sequence of poses. More...
 
double maxTimeInterpolation
 Maximum time considered to interpolate. If the difference between the desired timestamp where to interpolate and the next timestamp stored in the map is bigger than this value, the interpolation will not be done. More...
 
TInterpolatorMethod m_method
 

RTTI stuff

typedef CPose2DInterpolatorPtr Ptr
 
typedef CPose2DInterpolatorPtr ConstPtr
 
static mrpt::utils::CLASSINIT _init_CPose2DInterpolator
 
static mrpt::utils::TRuntimeClassId classCPose2DInterpolator
 
static const
mrpt::utils::TRuntimeClassId
classinfo
 
static const
mrpt::utils::TRuntimeClassId
_GetBaseClass ()
 
virtual const
mrpt::utils::TRuntimeClassId
GetRuntimeClass () const
 Returns information about the class of an object in runtime. More...
 
virtual mrpt::utils::CObjectduplicate () const
 Returns a copy of the object, indepently of its class. More...
 
static mrpt::utils::CObjectCreateObject ()
 
static CPose2DInterpolatorPtr Create ()
 

Type definitions and STL-like container interface

typedef mrpt::poses::SE_traits
< DIM >::lightweight_pose_t 
pose_t
 TPose2D or TPose3D. More...
 
typedef mrpt::poses::SE_traits
< DIM >::pose_t 
cpose_t
 CPose2D or CPose3D. More...
 
typedef mrpt::poses::SE_traits
< DIM >::point_t 
point_t
 TPoint2D or TPoint3D. More...
 
typedef std::pair
< mrpt::system::TTimeStamp,
pose_t
TTimePosePair
 
typedef std::map
< mrpt::system::TTimeStamp,
pose_t
TPath
 
typedef TPath::iterator iterator
 
typedef TPath::const_iterator const_iterator
 
typedef TPath::reverse_iterator reverse_iterator
 
typedef
TPath::const_reverse_iterator 
const_reverse_iterator
 
iterator begin ()
 
const_iterator begin () const
 
const_iterator cbegin () const
 
iterator end ()
 
const_iterator end () const
 
const_iterator cend () const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
iterator lower_bound (const mrpt::system::TTimeStamp &t)
 
const_iterator lower_bound (const mrpt::system::TTimeStamp &t) const
 
iterator upper_bound (const mrpt::system::TTimeStamp &t)
 
const_iterator upper_bound (const mrpt::system::TTimeStamp &t) const
 
iterator erase (iterator element_to_erase)
 
size_t size () const
 
bool empty () const
 
iterator find (const mrpt::system::TTimeStamp &t)
 
const_iterator find (const mrpt::system::TTimeStamp &t) const
 

Member Typedef Documentation

typedef TPath::const_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::const_iterator
inherited

Definition at line 62 of file CPoseInterpolatorBase.h.

typedef TPath::const_reverse_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::const_reverse_iterator
inherited

Definition at line 64 of file CPoseInterpolatorBase.h.

typedef CPose2DInterpolatorPtr mrpt::poses::CPose2DInterpolator::ConstPtr

Definition at line 50 of file CPose2DInterpolator.h.

CPose2D or CPose3D.

Definition at line 56 of file CPoseInterpolatorBase.h.

typedef TPath::iterator mrpt::poses::CPoseInterpolatorBase< DIM >::iterator
inherited

Definition at line 61 of file CPoseInterpolatorBase.h.

TPoint2D or TPoint3D.

Definition at line 57 of file CPoseInterpolatorBase.h.

typedef mrpt::poses::SE_traits<DIM>::lightweight_pose_t mrpt::poses::CPoseInterpolatorBase< DIM >::pose_t
inherited

TPose2D or TPose3D.

Definition at line 55 of file CPoseInterpolatorBase.h.

typedef CPose2DInterpolatorPtr mrpt::poses::CPose2DInterpolator::Ptr

A typedef for the associated smart pointer

Definition at line 50 of file CPose2DInterpolator.h.

typedef TPath::reverse_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::reverse_iterator
inherited

Definition at line 63 of file CPoseInterpolatorBase.h.

Definition at line 60 of file CPoseInterpolatorBase.h.

Definition at line 59 of file CPoseInterpolatorBase.h.

Member Function Documentation

static const mrpt::utils::TRuntimeClassId* mrpt::poses::CPose2DInterpolator::_GetBaseClass ( )
staticprotected
iterator mrpt::poses::CPoseInterpolatorBase< DIM >::begin ( )
inlineinherited

Definition at line 66 of file CPoseInterpolatorBase.h.

const_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::begin ( ) const
inlineinherited

Definition at line 67 of file CPoseInterpolatorBase.h.

const_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::cbegin ( ) const
inlineinherited

Definition at line 68 of file CPoseInterpolatorBase.h.

const_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::cend ( ) const
inlineinherited

Definition at line 78 of file CPoseInterpolatorBase.h.

void mrpt::poses::CPoseInterpolatorBase< DIM >::clear ( void  )
inherited

Clears the current sequence of poses.

CObject* mrpt::utils::CObject::clone ( ) const
inlineinherited

Cloning interface for smart pointers.

Definition at line 143 of file CObject.h.

static CPose2DInterpolatorPtr mrpt::poses::CPose2DInterpolator::Create ( )
static
static mrpt::utils::CObject* mrpt::poses::CPose2DInterpolator::CreateObject ( )
static
virtual mrpt::utils::CObject* mrpt::poses::CPose2DInterpolator::duplicate ( ) const
virtual

Returns a copy of the object, indepently of its class.

Implements mrpt::utils::CObject.

mrpt::utils::CObjectPtr mrpt::utils::CObject::duplicateGetSmartPtr ( ) const
inlineinherited

Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer).

Definition at line 140 of file CObject.h.

Referenced by mrpt::obs::CRawlog::addActions(), mrpt::slam::CIncrementalMapPartitioner::addMapFrame(), and mrpt::obs::CRawlog::addObservations().

bool mrpt::poses::CPoseInterpolatorBase< DIM >::empty ( ) const
inlineinherited

Definition at line 101 of file CPoseInterpolatorBase.h.

iterator mrpt::poses::CPoseInterpolatorBase< DIM >::end ( )
inlineinherited

Definition at line 76 of file CPoseInterpolatorBase.h.

const_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::end ( ) const
inlineinherited

Definition at line 77 of file CPoseInterpolatorBase.h.

iterator mrpt::poses::CPoseInterpolatorBase< DIM >::erase ( iterator  element_to_erase)
inlineinherited

Definition at line 98 of file CPoseInterpolatorBase.h.

void mrpt::poses::CPoseInterpolatorBase< DIM >::filter ( unsigned int  component,
unsigned int  samples 
)
inherited

Filters by averaging one of the components of the pose data within the interpolator.

The width of the filter is set by the number of samples.

Parameters
component[IN] The index of the component to filter: 0 (x), 1 (y), 2 (z), 3 (yaw), 4 (pitch) or 5 (roll)
samples[IN] The width of the average filter.
iterator mrpt::poses::CPoseInterpolatorBase< DIM >::find ( const mrpt::system::TTimeStamp t)
inlineinherited

Definition at line 103 of file CPoseInterpolatorBase.h.

const_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::find ( const mrpt::system::TTimeStamp t) const
inlineinherited

Definition at line 104 of file CPoseInterpolatorBase.h.

void mrpt::poses::CPoseInterpolatorBase< DIM >::getBoundingBox ( point_t minCorner,
point_t maxCorner 
) const
inherited

Computes the bounding box in all Euclidean coordinates of the whole path.

Exceptions
std::exceptionOn empty path
TInterpolatorMethod mrpt::poses::CPoseInterpolatorBase< DIM >::getInterpolationMethod ( ) const
inherited

Returns the currently set interpolation method.

See Also
setInterpolationMethod()
double mrpt::poses::CPoseInterpolatorBase< DIM >::getMaxTimeInterpolation ( )
inherited

Set value of the maximum time to consider interpolation.

bool mrpt::poses::CPoseInterpolatorBase< DIM >::getPreviousPoseWithMinDistance ( const mrpt::system::TTimeStamp t,
double  distance,
pose_t out_pose 
)
inherited

Get the previous CPose3D in the map with a minimum defined distance.

Returns
true if pose was found, false otherwise
bool mrpt::poses::CPoseInterpolatorBase< DIM >::getPreviousPoseWithMinDistance ( const mrpt::system::TTimeStamp t,
double  distance,
cpose_t out_pose 
)
inherited

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

virtual const mrpt::utils::TRuntimeClassId* mrpt::poses::CPose2DInterpolator::GetRuntimeClass ( ) const
virtual

Returns information about the class of an object in runtime.

Reimplemented from mrpt::utils::CSerializable.

void mrpt::poses::CPoseInterpolatorBase< DIM >::impl_interpolation ( const mrpt::math::CArrayDouble< 4 > &  ts,
const TTimePosePair  p1,
const TTimePosePair  p2,
const TTimePosePair  p3,
const TTimePosePair  p4,
const TInterpolatorMethod  method,
double  td,
pose_t out_interp 
) const
protectedinherited
void mrpt::poses::CPoseInterpolatorBase< DIM >::insert ( mrpt::system::TTimeStamp  t,
const pose_t p 
)
inherited

Inserts a new pose in the sequence.

It overwrites any previously existing pose at exactly the same time.

void mrpt::poses::CPoseInterpolatorBase< DIM >::insert ( mrpt::system::TTimeStamp  t,
const cpose_t p 
)
inherited

Overload (slower)

pose_t& mrpt::poses::CPoseInterpolatorBase< DIM >::interpolate ( mrpt::system::TTimeStamp  t,
pose_t out_interp,
bool &  out_valid_interp 
) const
inherited

Returns the pose at a given time, or interpolates using splines if there is not an exact match.

Parameters
tThe time of the point to interpolate.
out_interpThe output interpolated pose.
out_valid_interpWhether there was information enough to compute the interpolation.
Returns
A reference to out_interp
cpose_t& mrpt::poses::CPoseInterpolatorBase< DIM >::interpolate ( mrpt::system::TTimeStamp  t,
cpose_t out_interp,
bool &  out_valid_interp 
) const
inherited

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

bool mrpt::poses::CPoseInterpolatorBase< DIM >::loadFromTextFile ( const std::string s)
inherited

Loads from a text file, in the format described by saveToTextFile.

Returns
true on success, false on any error.
Exceptions
std::exceptionOn invalid file format
iterator mrpt::poses::CPoseInterpolatorBase< DIM >::lower_bound ( const mrpt::system::TTimeStamp t)
inlineinherited

Definition at line 92 of file CPoseInterpolatorBase.h.

const_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::lower_bound ( const mrpt::system::TTimeStamp t) const
inlineinherited

Definition at line 93 of file CPoseInterpolatorBase.h.

void mrpt::poses::CPose2DInterpolator::operator delete ( void ptr)
throw (
)
inline

Definition at line 50 of file CPose2DInterpolator.h.

void mrpt::poses::CPose2DInterpolator::operator delete ( void memory,
void ptr 
)
throw (
)
inline

Definition at line 50 of file CPose2DInterpolator.h.

void mrpt::poses::CPose2DInterpolator::operator delete ( void ptr,
const std::nothrow_t &   
)
throw (
)
inline

Definition at line 50 of file CPose2DInterpolator.h.

void mrpt::poses::CPose2DInterpolator::operator delete[] ( void ptr)
throw (
)
inline

Definition at line 50 of file CPose2DInterpolator.h.

static void* mrpt::poses::CPose2DInterpolator::operator new ( size_t  size,
void ptr 
)
inlinestatic

Definition at line 50 of file CPose2DInterpolator.h.

void* mrpt::poses::CPose2DInterpolator::operator new ( size_t  size)
inline

Definition at line 50 of file CPose2DInterpolator.h.

void* mrpt::poses::CPose2DInterpolator::operator new ( size_t  size,
const std::nothrow_t &   
)
throw (
)
inline

Definition at line 50 of file CPose2DInterpolator.h.

void* mrpt::poses::CPose2DInterpolator::operator new[] ( size_t  size)
inline

Definition at line 50 of file CPose2DInterpolator.h.

reverse_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::rbegin ( )
inlineinherited

Definition at line 86 of file CPoseInterpolatorBase.h.

const_reverse_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::rbegin ( ) const
inlineinherited

Definition at line 87 of file CPoseInterpolatorBase.h.

void CPose2DInterpolator::readFromStream ( mrpt::utils::CStream in,
int  version 
)
protectedvirtual

Introduces a pure virtual method responsible for loading from a CStream This can not be used directly be users, instead use "stream >> object;" for reading it from a stream or "stream >> object_ptr;" if the class is unknown apriori.

Parameters
inThe input binary stream where the object data must read from.
versionThe version of the object stored in the stream: use this version number in your code to know how to read the incoming data.
Exceptions
std::exceptionOn any error, see CStream::ReadBuffer
See Also
CStream

Implements mrpt::utils::CSerializable.

Definition at line 31 of file CPose2DInterpolator.cpp.

References MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION.

reverse_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::rend ( )
inlineinherited

Definition at line 89 of file CPoseInterpolatorBase.h.

const_reverse_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::rend ( ) const
inlineinherited

Definition at line 90 of file CPoseInterpolatorBase.h.

bool mrpt::poses::CPoseInterpolatorBase< DIM >::saveInterpolatedToTextFile ( const std::string s,
double  period 
) const
inherited

Saves the points in the interpolator to a text file, with the same format that saveToTextFile, but interpolating the path with the given period in seconds.

See Also
loadFromTextFile
Returns
true on success, false on any error.
bool mrpt::poses::CPoseInterpolatorBase< DIM >::saveToTextFile ( const std::string s) const
inherited

Saves the points in the interpolator to a text file, with this format: Each row contains these elements separated by spaces:

void mrpt::poses::CPoseInterpolatorBase< DIM >::setInterpolationMethod ( TInterpolatorMethod  method)
inherited

Change the method used to interpolate the robot path. The default method at construction is "imSpline".

See Also
getInterpolationMethod()
void mrpt::poses::CPoseInterpolatorBase< DIM >::setMaxTimeInterpolation ( double  time)
inherited

Set value of the maximum time to consider interpolation.

If set to a negative value, the check is disabled (default behavior).

size_t mrpt::poses::CPoseInterpolatorBase< DIM >::size ( ) const
inlineinherited

Definition at line 100 of file CPoseInterpolatorBase.h.

iterator mrpt::poses::CPoseInterpolatorBase< DIM >::upper_bound ( const mrpt::system::TTimeStamp t)
inlineinherited

Definition at line 95 of file CPoseInterpolatorBase.h.

const_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::upper_bound ( const mrpt::system::TTimeStamp t) const
inlineinherited

Definition at line 96 of file CPoseInterpolatorBase.h.

virtual mxArray* mrpt::utils::CSerializable::writeToMatlab ( ) const
inlinevirtualinherited

Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class.

Returns
A new mxArray (caller is responsible of memory freeing) or NULL is class does not support conversion to MATLAB.

Definition at line 79 of file CSerializable.h.

void CPose2DInterpolator::writeToStream ( mrpt::utils::CStream out,
int getVersion 
) const
protectedvirtual

Introduces a pure virtual method responsible for writing to a CStream.

This can not be used directly be users, instead use "stream << object;" for writing it to a stream.

Parameters
outThe output binary stream where object must be dumped.
getVersionIf NULL, the object must be dumped. If not, only the version of the object dump must be returned in this pointer. This enables the versioning of objects dumping and backward compatibility with previously stored data.
Exceptions
std::exceptionOn any error, see CStream::WriteBuffer
See Also
CStream

Implements mrpt::utils::CSerializable.

Definition at line 21 of file CPose2DInterpolator.cpp.

Member Data Documentation

mrpt::utils::CLASSINIT mrpt::poses::CPose2DInterpolator::_init_CPose2DInterpolator
staticprotected

Definition at line 50 of file CPose2DInterpolator.h.

const mrpt::utils::TRuntimeClassId mrpt::utils::CObject::classCObject
staticinherited

Definition at line 128 of file CObject.h.

mrpt::utils::TRuntimeClassId mrpt::poses::CPose2DInterpolator::classCPose2DInterpolator
static

Definition at line 50 of file CPose2DInterpolator.h.

const mrpt::utils::TRuntimeClassId mrpt::utils::CSerializable::classCSerializable
staticinherited

Definition at line 42 of file CSerializable.h.

const mrpt::utils::TRuntimeClassId* mrpt::poses::CPose2DInterpolator::classinfo
static

Definition at line 50 of file CPose2DInterpolator.h.

TInterpolatorMethod mrpt::poses::CPoseInterpolatorBase< DIM >::m_method
protectedinherited

Definition at line 172 of file CPoseInterpolatorBase.h.

TPath mrpt::poses::CPoseInterpolatorBase< DIM >::m_path
protectedinherited

The sequence of poses.

Definition at line 170 of file CPoseInterpolatorBase.h.

double mrpt::poses::CPoseInterpolatorBase< DIM >::maxTimeInterpolation
protectedinherited

Maximum time considered to interpolate. If the difference between the desired timestamp where to interpolate and the next timestamp stored in the map is bigger than this value, the interpolation will not be done.

Definition at line 171 of file CPoseInterpolatorBase.h.




Page generated by Doxygen 1.8.6 for MRPT 1.5.5 Git: e06b63d Fri Dec 1 14:41:11 2017 +0100 at sáb dic 2 13:00:21 CET 2017