Main MRPT website > C++ reference for MRPT 1.5.6
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
mrpt::poses::CPoseInterpolatorBase< DIM > Class Template Reference

Detailed Description

template<int DIM>
class mrpt::poses::CPoseInterpolatorBase< DIM >

Base class for SE(2)/SE(3) interpolators.

See docs for derived classes.

Definition at line 47 of file CPoseInterpolatorBase.h.

#include <mrpt/poses/CPoseInterpolatorBase.h>

Inheritance diagram for mrpt::poses::CPoseInterpolatorBase< DIM >:
Inheritance graph

Public Member Functions

 CPoseInterpolatorBase ()
 Default ctor: empty sequence of poses. 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...
 

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
 
template<>
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
 
template<>
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
 

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
 

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

template<int DIM>
typedef TPath::const_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::const_iterator

Definition at line 62 of file CPoseInterpolatorBase.h.

template<int DIM>
typedef TPath::const_reverse_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::const_reverse_iterator

Definition at line 64 of file CPoseInterpolatorBase.h.

CPose2D or CPose3D.

Definition at line 56 of file CPoseInterpolatorBase.h.

template<int DIM>
typedef TPath::iterator mrpt::poses::CPoseInterpolatorBase< DIM >::iterator

Definition at line 61 of file CPoseInterpolatorBase.h.

TPoint2D or TPoint3D.

Definition at line 57 of file CPoseInterpolatorBase.h.

template<int DIM>
typedef mrpt::poses::SE_traits<DIM>::lightweight_pose_t mrpt::poses::CPoseInterpolatorBase< DIM >::pose_t

TPose2D or TPose3D.

Definition at line 55 of file CPoseInterpolatorBase.h.

template<int DIM>
typedef TPath::reverse_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::reverse_iterator

Definition at line 63 of file CPoseInterpolatorBase.h.

template<int DIM>
typedef std::map<mrpt::system::TTimeStamp,pose_t> mrpt::poses::CPoseInterpolatorBase< DIM >::TPath

Definition at line 60 of file CPoseInterpolatorBase.h.

Definition at line 59 of file CPoseInterpolatorBase.h.

Constructor & Destructor Documentation

Default ctor: empty sequence of poses.

Definition at line 24 of file CPoseInterpolatorBase.hpp.

References mrpt::poses::CPoseInterpolatorBase< DIM >::maxTimeInterpolation.

Member Function Documentation

template<int DIM>
iterator mrpt::poses::CPoseInterpolatorBase< DIM >::begin ( )
inline
template<int DIM>
const_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::begin ( ) const
inline

Definition at line 67 of file CPoseInterpolatorBase.h.

template<int DIM>
const_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::cbegin ( ) const
inline

Definition at line 68 of file CPoseInterpolatorBase.h.

template<int DIM>
const_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::cend ( ) const
inline

Definition at line 78 of file CPoseInterpolatorBase.h.

template<int DIM>
void mrpt::poses::CPoseInterpolatorBase< DIM >::clear ( )
template<int DIM>
bool mrpt::poses::CPoseInterpolatorBase< DIM >::empty ( ) const
inline
template<int DIM>
iterator mrpt::poses::CPoseInterpolatorBase< DIM >::end ( )
inline

Definition at line 76 of file CPoseInterpolatorBase.h.

Referenced by mrpt::topography::path_from_rtk_gps().

template<int DIM>
const_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::end ( ) const
inline

Definition at line 77 of file CPoseInterpolatorBase.h.

template<int DIM>
iterator mrpt::poses::CPoseInterpolatorBase< DIM >::erase ( iterator  element_to_erase)
inline
template<int DIM>
void mrpt::poses::CPoseInterpolatorBase< DIM >::filter ( unsigned int  component,
unsigned int  samples 
)

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.

Definition at line 356 of file CPoseInterpolatorBase.hpp.

References mrpt::math::distance(), mrpt::poses::CPose3DPDFParticles::getMean(), int(), and mrpt::bayes::CParticleFilterData< T >::m_particles.

template<int DIM>
iterator mrpt::poses::CPoseInterpolatorBase< DIM >::find ( const mrpt::system::TTimeStamp t)
inline

Definition at line 103 of file CPoseInterpolatorBase.h.

template<int DIM>
const_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::find ( const mrpt::system::TTimeStamp t) const
inline

Definition at line 104 of file CPoseInterpolatorBase.h.

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

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

Exceptions
std::exceptionOn empty path

Definition at line 323 of file CPoseInterpolatorBase.hpp.

References ASSERT_, mrpt::mrpt::utils::keep_max(), mrpt::mrpt::utils::keep_min(), MRPT_END, MRPT_START, and static_size.

template<int DIM>
TInterpolatorMethod mrpt::poses::CPoseInterpolatorBase< DIM >::getInterpolationMethod ( ) const

Returns the currently set interpolation method.

See Also
setInterpolationMethod()

Definition at line 350 of file CPoseInterpolatorBase.hpp.

template<int DIM>
double mrpt::poses::CPoseInterpolatorBase< DIM >::getMaxTimeInterpolation ( )

Set value of the maximum time to consider interpolation.

Definition at line 219 of file CPoseInterpolatorBase.hpp.

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

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

Returns
true if pose was found, false otherwise

Definition at line 181 of file CPoseInterpolatorBase.hpp.

References mrpt::math::norm().

template<int DIM>
bool mrpt::poses::CPoseInterpolatorBase< DIM >::getPreviousPoseWithMinDistance ( const mrpt::system::TTimeStamp t,
double  distance,
cpose_t out_pose 
)

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

Definition at line 172 of file CPoseInterpolatorBase.hpp.

template<>
void mrpt::poses::CPoseInterpolatorBase< 2 >::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
protected
template<>
void mrpt::poses::CPoseInterpolatorBase< 3 >::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
protected
template<int DIM>
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
protected
template<int DIM>
void mrpt::poses::CPoseInterpolatorBase< DIM >::insert ( mrpt::system::TTimeStamp  t,
const pose_t p 
)

Inserts a new pose in the sequence.

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

Definition at line 41 of file CPoseInterpolatorBase.hpp.

Referenced by mrpt::topography::path_from_rtk_gps(), TEST(), and mrpt::nav::CAbstractNavigator::updateCurrentPoseAndSpeeds().

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

Overload (slower)

Definition at line 36 of file CPoseInterpolatorBase.hpp.

template<int DIM>
CPoseInterpolatorBase< DIM >::pose_t & mrpt::poses::CPoseInterpolatorBase< DIM >::interpolate ( 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.

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

Definition at line 59 of file CPoseInterpolatorBase.hpp.

References mrpt::poses::imLinear2Neig, mrpt::poses::imLinearSlerp, mrpt::poses::imSplineSlerp, INVALID_TIMESTAMP, static_size, and mrpt::system::timestampTotime_t().

Referenced by mrpt::nav::CAbstractPTGBasedReactive::performNavigationStep(), and TEST().

template<int DIM>
CPoseInterpolatorBase< DIM >::cpose_t & mrpt::poses::CPoseInterpolatorBase< DIM >::interpolate ( mrpt::system::TTimeStamp  t,
cpose_t out_interp,
bool &  out_valid_interp 
) const

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

Definition at line 50 of file CPoseInterpolatorBase.hpp.

References mrpt::math::interpolate().

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

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

Definition at line 289 of file CPoseInterpolatorBase.hpp.

References ASSERT_, mrpt::utils::clear(), MRPT_END, MRPT_START, static_size, and mrpt::system::time_tToTimestamp().

template<int DIM>
iterator mrpt::poses::CPoseInterpolatorBase< DIM >::lower_bound ( const mrpt::system::TTimeStamp t)
inline

Definition at line 92 of file CPoseInterpolatorBase.h.

template<int DIM>
const_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::lower_bound ( const mrpt::system::TTimeStamp t) const
inline

Definition at line 93 of file CPoseInterpolatorBase.h.

template<int DIM>
reverse_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::rbegin ( )
inline
template<int DIM>
const_reverse_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::rbegin ( ) const
inline

Definition at line 87 of file CPoseInterpolatorBase.h.

template<int DIM>
reverse_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::rend ( )
inline

Definition at line 89 of file CPoseInterpolatorBase.h.

template<int DIM>
const_reverse_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::rend ( ) const
inline

Definition at line 90 of file CPoseInterpolatorBase.h.

template<int DIM>
bool mrpt::poses::CPoseInterpolatorBase< DIM >::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.

See Also
loadFromTextFile
Returns
true on success, false on any error.

Definition at line 252 of file CPoseInterpolatorBase.hpp.

References mrpt::format(), mrpt::math::interpolate(), mrpt::utils::CStream::printf(), mrpt::system::secondsToTimestamp(), and mrpt::system::timestampTotime_t().

template<int DIM>
bool mrpt::poses::CPoseInterpolatorBase< DIM >::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:

Definition at line 225 of file CPoseInterpolatorBase.hpp.

References mrpt::format(), mrpt::utils::CStream::printf(), and mrpt::system::timestampTotime_t().

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

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

See Also
getInterpolationMethod()

Definition at line 344 of file CPoseInterpolatorBase.hpp.

Referenced by mrpt::nav::CAbstractNavigator::CAbstractNavigator(), and mrpt::topography::path_from_rtk_gps().

template<int DIM>
void mrpt::poses::CPoseInterpolatorBase< DIM >::setMaxTimeInterpolation ( double  time)

Set value of the maximum time to consider interpolation.

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

Definition at line 212 of file CPoseInterpolatorBase.hpp.

References ASSERT_.

Referenced by mrpt::topography::path_from_rtk_gps().

template<int DIM>
size_t mrpt::poses::CPoseInterpolatorBase< DIM >::size ( ) const
inline
template<int DIM>
iterator mrpt::poses::CPoseInterpolatorBase< DIM >::upper_bound ( const mrpt::system::TTimeStamp t)
inline

Definition at line 95 of file CPoseInterpolatorBase.h.

template<int DIM>
const_iterator mrpt::poses::CPoseInterpolatorBase< DIM >::upper_bound ( const mrpt::system::TTimeStamp t) const
inline

Definition at line 96 of file CPoseInterpolatorBase.h.

Member Data Documentation

template<int DIM>
TInterpolatorMethod mrpt::poses::CPoseInterpolatorBase< DIM >::m_method
protected

Definition at line 172 of file CPoseInterpolatorBase.h.

template<int DIM>
TPath mrpt::poses::CPoseInterpolatorBase< DIM >::m_path
protected

The sequence of poses.

Definition at line 170 of file CPoseInterpolatorBase.h.

template<int DIM>
double mrpt::poses::CPoseInterpolatorBase< DIM >::maxTimeInterpolation
protected

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.

Referenced by mrpt::poses::CPoseInterpolatorBase< DIM >::CPoseInterpolatorBase().




Page generated by Doxygen 1.8.6 for MRPT 1.5.6 Git: 4c65e84 Tue Apr 24 08:18:17 2018 +0200 at mar abr 24 08:26:17 CEST 2018