Template Class CPoseInterpolatorBase
Defined in File CPoseInterpolatorBase.h
Class Documentation
-
template<size_t DIM>
class CPoseInterpolatorBase Base class for SE(2)/SE(3) interpolators. See docs for derived classes.
Type definitions and STL-like container interface
-
inline const_iterator begin() const
-
inline const_iterator cbegin() const
-
inline const_iterator end() const
-
inline const_iterator cend() const
-
inline reverse_iterator rbegin()
-
inline const_reverse_iterator rbegin() const
-
inline reverse_iterator rend()
-
inline const_reverse_iterator rend() const
-
inline const_iterator lower_bound(const mrpt::Clock::time_point &t) const
-
inline const_iterator upper_bound(const mrpt::Clock::time_point &t) const
-
inline size_t size() const
-
inline bool empty() const
-
inline const_iterator find(const mrpt::Clock::time_point &t) const
Public Functions
-
CPoseInterpolatorBase()
Default ctor: empty sequence of poses
-
void insert(const mrpt::Clock::time_point &t, const pose_t &p)
Inserts a new pose in the sequence. It overwrites any previously existing pose at exactly the same time.
-
pose_t &interpolate(const mrpt::Clock::time_point &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:
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.
- Returns:
A reference to out_interp
-
cpose_t &interpolate(const mrpt::Clock::time_point &t, cpose_t &out_interp, bool &out_valid_interp) const
-
void clear()
Clears the current sequence of poses
-
void setMaxTimeInterpolation(const mrpt::Clock::duration &time)
Set value of the maximum time to consider interpolation. If set to a negative value, the check is disabled (default behavior).
-
mrpt::Clock::duration getMaxTimeInterpolation()
Set value of the maximum time to consider interpolation
-
bool getPreviousPoseWithMinDistance(const mrpt::Clock::time_point &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
-
bool getPreviousPoseWithMinDistance(const mrpt::Clock::time_point &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:
Timestamp: As a “double time_t”
x y z: The 3D position in meters.
yaw pitch roll: The angles, in radians
See also
- Returns:
true on success, false on any error.
-
bool saveToTextFile_TUM(const std::string &s) const
Saves the points in the interpolator to a text file in the “TUM” dataset format: each row contains these elements separated by spaces:
Timestamp: As a “double time_t”
x y z: The 3D position in meters.
q_x q_y q_z q_w: Quaternion
See also
loadFromTextFile, saveTextFile_TUM
- Returns:
true on success, false on any error.
-
bool saveInterpolatedToTextFile(const std::string &s, const mrpt::Clock::duration &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
- Returns:
true on success, false on any error.
-
bool loadFromTextFile(const std::string &s)
Loads from a text file, in the format described by saveToTextFile.
- Throws:
std::exception – On invalid file format
- Returns:
true on success, false on any error.
-
bool loadFromTextFile_TUM(const std::string &s)
Loads from a text file, in the “TUM” dataset format.
- Throws:
std::exception – On invalid file format
- Returns:
true on success, false on any error.
-
void getBoundingBox(point_t &minCorner, point_t &maxCorner) const
Computes the bounding box in all Euclidean coordinates of the whole path.
- Throws:
std::exception – On empty path
-
void setInterpolationMethod(TInterpolatorMethod method)
Change the method used to interpolate the robot path. The default method at construction is “imSpline”.
See also
-
TInterpolatorMethod getInterpolationMethod() const
Returns the currently set interpolation method.
See also
-
void 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.
Protected Functions
-
void impl_interpolation(const TTimePosePair &p1, const TTimePosePair &p2, const TTimePosePair &p3, const TTimePosePair &p4, const TInterpolatorMethod method, const mrpt::Clock::time_point &td, pose_t &out_interp) const
Protected Attributes
-
mrpt::Clock::duration 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.
-
TInterpolatorMethod m_method = {mrpt::poses::imLinearSlerp}
-
inline const_iterator begin() const