50 using doubleDuration = std::chrono::duration<double>;
51 doubleDuration durationT(
t.time_since_epoch());
52 double td = durationT.count();
54 ts[0] = std::chrono::duration_cast<doubleDuration>(p1.first.time_since_epoch()).
count();
55 ts[1] = std::chrono::duration_cast<doubleDuration>(p2.first.time_since_epoch()).
count();
56 ts[2] = std::chrono::duration_cast<doubleDuration>(p3.first.time_since_epoch()).
count();
57 ts[3] = std::chrono::duration_cast<doubleDuration>(p4.first.time_since_epoch()).
count();
62 yaw[0] = p1.second.phi;
65 yaw[1] = p2.second.phi;
68 yaw[2] = p3.second.phi;
71 yaw[3] = p4.second.phi;
96 td, ts[1], yaw[1], ts[2], yaw[2],
true);
103 math::leastSquareLinearFit<double, decltype(ts), 4>(td, ts, X);
105 math::leastSquareLinearFit<double, decltype(ts), 4>(td, ts, Y);
107 math::leastSquareLinearFit<double, decltype(ts), 4>(
117 math::leastSquareLinearFit<double, decltype(ts), 4>(
132 const double ratio = (td - ts[1]) / (ts[2] - ts[1]);
134 out_interp.phi = yaw[1] + ratio * Aang;
145 const double ratio = (td - ts[1]) / (ts[2] - ts[1]);
147 out_interp.phi = yaw[1] + ratio * Aang;
GLuint GLuint GLsizei count
This class stores a time-stamped trajectory in SE(2) (mrpt::math::TPose2D poses). ...
std::chrono::time_point< Clock > time_point
#define THROW_EXCEPTION(msg)
std::pair< mrpt::Clock::time_point, pose_t > TTimePosePair
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
CArrayNumeric is an array for numeric types supporting several mathematical operations (actually...
T angDistance(T from, T to)
Computes the shortest angular increment (or distance) between two planar orientations, such that it is constrained to [-pi,pi] and is correct for any combination of angles (e.g.
TPath m_path
The sequence of poses.
typename mrpt::poses::SE_traits< DIM >::lightweight_pose_t pose_t
TPose2D or TPose3D.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Virtual base class for "archives": classes abstracting I/O streams.
void unwrap2PiSequence(VECTOR &x)
Modify a sequence of angle values such as no consecutive values have a jump larger than PI in absolut...
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
NUMTYPE spline(const NUMTYPE t, const VECTORLIKE &x, const VECTORLIKE &y, bool wrap2pi=false)
Interpolates the value of a function in a point "t" given 4 SORTED points where "t" is between the tw...
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
double interpolate2points(const double x, const double x0, const double y0, const double x1, const double y1, bool wrap2pi=false)
Linear interpolation/extrapolation: evaluates at "x" the line (x0,y0)-(x1,y1).
TInterpolatorMethod
Type to select the interpolation method in CPoseInterpolatorBase derived classes. ...