This class stores a time-stamped trajectory in SE(3) (CPose3D poses).
It can also interpolate SE(3) poses over time using linear, splines or SLERP interpolation, as set in CPose3DInterpolator::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".
Definition at line 49 of file CPose3DInterpolator.h.
#include <mrpt/poses/CPose3DInterpolator.h>
Public Member Functions | |
void * | operator new (size_t size) |
void * | operator new[] (size_t size) |
void | operator delete (void *ptr) noexcept |
void | operator delete[] (void *ptr) noexcept |
void | operator delete (void *memory, void *ptr) noexcept |
void * | operator new (size_t size, const std::nothrow_t &) noexcept |
void | operator delete (void *ptr, const std::nothrow_t &) noexcept |
virtual mxArray * | writeToMatlab () 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... | |
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_t & | 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. More... | |
cpose_t & | interpolate (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. 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... | |
RTTI classes and functions | |
mrpt::utils::CObject::Ptr | 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... | |
Static Public Member Functions | |
static void * | operator new (size_t size, void *ptr) |
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 |
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 |
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 override |
Introduces a pure virtual method responsible for writing to a CStream. More... | |
void | readFromStream (mrpt::utils::CStream &in, int version) override |
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. More... | |
TInterpolatorMethod | m_method |
RTTI stuff | |
using | Ptr = std::shared_ptr< CPose3DInterpolator > |
using | ConstPtr = std::shared_ptr< const CPose3DInterpolator > |
static mrpt::utils::CLASSINIT | _init_CPose3DInterpolator |
static const mrpt::utils::TRuntimeClassId | runtimeClassId |
static constexpr const char * | className = "CPose3DInterpolator" |
static const mrpt::utils::TRuntimeClassId * | _GetBaseClass () |
static const mrpt::utils::TRuntimeClassId & | GetRuntimeClassIdStatic () |
static mrpt::utils::CObject * | CreateObject () |
template<typename... Args> | |
static Ptr | Create (Args &&... args) |
virtual const mrpt::utils::TRuntimeClassId * | GetRuntimeClass () const override |
Returns information about the class of an object in runtime. More... | |
virtual mrpt::utils::CObject * | clone () const override |
Returns a deep copy (clone) of the object, indepently of its class. More... | |
|
inherited |
Definition at line 71 of file CPoseInterpolatorBase.h.
|
inherited |
Definition at line 73 of file CPoseInterpolatorBase.h.
using mrpt::poses::CPose3DInterpolator::ConstPtr = std::shared_ptr<const CPose3DInterpolator > |
Definition at line 52 of file CPose3DInterpolator.h.
|
inherited |
Definition at line 64 of file CPoseInterpolatorBase.h.
|
inherited |
Definition at line 70 of file CPoseInterpolatorBase.h.
|
inherited |
TPoint2D or TPoint3D.
Definition at line 66 of file CPoseInterpolatorBase.h.
|
inherited |
TPose2D or TPose3D.
Definition at line 62 of file CPoseInterpolatorBase.h.
using mrpt::poses::CPose3DInterpolator::Ptr = std::shared_ptr< CPose3DInterpolator > |
A typedef for the associated smart pointer
Definition at line 52 of file CPose3DInterpolator.h.
|
inherited |
Definition at line 72 of file CPoseInterpolatorBase.h.
|
inherited |
Definition at line 69 of file CPoseInterpolatorBase.h.
|
inherited |
Definition at line 68 of file CPoseInterpolatorBase.h.
|
staticprotected |
|
inlineinherited |
Definition at line 75 of file CPoseInterpolatorBase.h.
References mrpt::poses::CPoseInterpolatorBase< DIM >::m_path.
|
inlineinherited |
Definition at line 76 of file CPoseInterpolatorBase.h.
References mrpt::poses::CPoseInterpolatorBase< DIM >::m_path.
|
inlineinherited |
Definition at line 77 of file CPoseInterpolatorBase.h.
References mrpt::poses::CPoseInterpolatorBase< DIM >::m_path.
|
inlineinherited |
Definition at line 80 of file CPoseInterpolatorBase.h.
References mrpt::poses::CPoseInterpolatorBase< DIM >::m_path.
|
inherited |
Clears the current sequence of poses.
Definition at line 30 of file CPoseInterpolatorBase.hpp.
|
overridevirtual |
Returns a deep copy (clone) of the object, indepently of its class.
Implements mrpt::utils::CObject.
|
inlinestatic |
Definition at line 52 of file CPose3DInterpolator.h.
|
static |
|
inlineinherited |
Definition at line 110 of file CPoseInterpolatorBase.h.
References mrpt::poses::CPoseInterpolatorBase< DIM >::m_path.
|
inlineinherited |
Definition at line 78 of file CPoseInterpolatorBase.h.
References mrpt::poses::CPoseInterpolatorBase< DIM >::m_path.
|
inlineinherited |
Definition at line 79 of file CPoseInterpolatorBase.h.
References mrpt::poses::CPoseInterpolatorBase< DIM >::m_path.
|
inlineinherited |
Definition at line 103 of file CPoseInterpolatorBase.h.
References mrpt::poses::CPoseInterpolatorBase< DIM >::m_path.
|
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.
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(), and mrpt::bayes::CParticleFilterData< T >::m_particles.
|
inlineinherited |
Definition at line 111 of file CPoseInterpolatorBase.h.
References mrpt::poses::CPoseInterpolatorBase< DIM >::m_path.
|
inlineinherited |
Definition at line 112 of file CPoseInterpolatorBase.h.
References mrpt::poses::CPoseInterpolatorBase< DIM >::m_path.
|
inherited |
Computes the bounding box in all Euclidean coordinates of the whole path.
std::exception | On empty path |
Definition at line 323 of file CPoseInterpolatorBase.hpp.
References ASSERT_, mrpt::utils::keep_max(), mrpt::utils::keep_min(), MRPT_END, MRPT_START, and static_size.
|
inherited |
Returns the currently set interpolation method.
Definition at line 350 of file CPoseInterpolatorBase.hpp.
|
inherited |
Set value of the maximum time to consider interpolation.
Definition at line 219 of file CPoseInterpolatorBase.hpp.
|
inherited |
Get the previous CPose3D in the map with a minimum defined distance.
Definition at line 181 of file CPoseInterpolatorBase.hpp.
References mrpt::math::distance(), mrpt::poses::CPoseInterpolatorBase< DIM >::find(), and mrpt::math::norm().
|
inherited |
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.
References mrpt::math::distance().
|
overridevirtual |
Returns information about the class of an object in runtime.
Reimplemented from mrpt::utils::CSerializable.
|
static |
|
protectedinherited |
Definition at line 52 of file CPose2DInterpolator.cpp.
References mrpt::math::angDistance(), mrpt::poses::imLinear2Neig, mrpt::poses::imLinear4Neig, mrpt::poses::imLinearSlerp, mrpt::poses::imSpline, mrpt::poses::imSplineSlerp, mrpt::poses::imSSLLLL, mrpt::poses::imSSLSLL, mrpt::math::interpolate2points(), mrpt::math::spline(), THROW_EXCEPTION, and mrpt::math::unwrap2PiSequence().
|
protectedinherited |
Definition at line 63 of file CPose3DInterpolator.cpp.
References mrpt::poses::imLinear2Neig, mrpt::poses::imLinear4Neig, mrpt::poses::imLinearSlerp, mrpt::poses::imSpline, mrpt::poses::imSplineSlerp, mrpt::poses::imSSLLLL, mrpt::poses::imSSLSLL, mrpt::math::interpolate2points(), mrpt::obs::gnss::pitch, mrpt::obs::gnss::roll, mrpt::math::slerp_ypr(), mrpt::math::spline(), THROW_EXCEPTION, and mrpt::math::unwrap2PiSequence().
|
protectedinherited |
|
inherited |
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.
|
inherited |
Overload (slower)
Definition at line 36 of file CPoseInterpolatorBase.hpp.
|
inherited |
Returns the pose at a given time, or interpolates using splines if there is not an exact match.
t | The time of the point to interpolate. |
out_interp | The output interpolated pose. |
out_valid_interp | Whether there was information enough to compute the interpolation. |
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().
|
inherited |
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().
|
inherited |
Loads from a text file, in the format described by saveToTextFile.
std::exception | On 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().
|
inlineinherited |
Definition at line 85 of file CPoseInterpolatorBase.h.
References mrpt::poses::CPoseInterpolatorBase< DIM >::m_path.
|
inlineinherited |
Definition at line 89 of file CPoseInterpolatorBase.h.
References mrpt::poses::CPoseInterpolatorBase< DIM >::m_path.
Definition at line 52 of file CPose3DInterpolator.h.
Definition at line 52 of file CPose3DInterpolator.h.
|
inlinenoexcept |
Definition at line 52 of file CPose3DInterpolator.h.
Definition at line 52 of file CPose3DInterpolator.h.
|
inline |
Definition at line 52 of file CPose3DInterpolator.h.
|
inlinestatic |
Definition at line 52 of file CPose3DInterpolator.h.
|
inlinenoexcept |
Definition at line 52 of file CPose3DInterpolator.h.
|
inline |
Definition at line 52 of file CPose3DInterpolator.h.
|
inlineinherited |
Definition at line 81 of file CPoseInterpolatorBase.h.
References mrpt::poses::CPoseInterpolatorBase< DIM >::m_path.
|
inlineinherited |
Definition at line 82 of file CPoseInterpolatorBase.h.
References mrpt::poses::CPoseInterpolatorBase< DIM >::m_path.
|
overrideprotectedvirtual |
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.
in | The input binary stream where the object data must read from. |
version | The version of the object stored in the stream: use this version number in your code to know how to read the incoming data. |
std::exception | On any error, see CStream::ReadBuffer |
Implements mrpt::utils::CSerializable.
Definition at line 32 of file CPose3DInterpolator.cpp.
References MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION.
|
inlineinherited |
Definition at line 83 of file CPoseInterpolatorBase.h.
References mrpt::poses::CPoseInterpolatorBase< DIM >::m_path.
|
inlineinherited |
Definition at line 84 of file CPoseInterpolatorBase.h.
References mrpt::poses::CPoseInterpolatorBase< DIM >::m_path.
|
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.
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().
|
inherited |
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().
|
inherited |
Change the method used to interpolate the robot path.
The default method at construction is "imSpline".
Definition at line 344 of file CPoseInterpolatorBase.hpp.
|
inherited |
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_.
|
inlineinherited |
Definition at line 109 of file CPoseInterpolatorBase.h.
References mrpt::poses::CPoseInterpolatorBase< DIM >::m_path.
|
inlineinherited |
Definition at line 94 of file CPoseInterpolatorBase.h.
References mrpt::poses::CPoseInterpolatorBase< DIM >::m_path.
|
inlineinherited |
Definition at line 98 of file CPoseInterpolatorBase.h.
References mrpt::poses::CPoseInterpolatorBase< DIM >::m_path.
|
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.
mxArray
(caller is responsible of memory freeing) or nullptr is class does not support conversion to MATLAB. Definition at line 89 of file CSerializable.h.
|
overrideprotectedvirtual |
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.
out | The output binary stream where object must be dumped. |
getVersion | If nullptr, 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. |
std::exception | On any error, see CStream::WriteBuffer |
Implements mrpt::utils::CSerializable.
Definition at line 21 of file CPose3DInterpolator.cpp.
|
staticprotected |
Definition at line 52 of file CPose3DInterpolator.h.
|
static |
Definition at line 52 of file CPose3DInterpolator.h.
|
protectedinherited |
Definition at line 208 of file CPoseInterpolatorBase.h.
|
protectedinherited |
The sequence of poses.
Definition at line 203 of file CPoseInterpolatorBase.h.
|
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 207 of file CPoseInterpolatorBase.h.
|
staticprotected |
Definition at line 52 of file CPose3DInterpolator.h.
Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019 |