36 std::vector<mrpt::poses::CPose3D>
p;
47 ts += std::chrono::seconds(1);
48 pose.setFromValues(1, 1, 0, 0, 1, 0);
51 ts += std::chrono::seconds(1);
52 pose.setFromValues(2, 2.5, 1, 0, 1.3, 0);
55 ts += std::chrono::seconds(1);
56 pose.setFromValues(3, 1.7, 2, 0, 1.57, 0);
60 for (i = 0, ots = iniTs;
61 ots <= iniTs + std::chrono::seconds(3);
62 ots += std::chrono::milliseconds(100), i++)
67 f,
"%d %f %f %f %f %f %f\n", i, outPose.x(), outPose.y(),
68 outPose.z(), outPose.yaw(), outPose.pitch(), outPose.roll());
98 for (
t =
x[1];
t <=
x[2];
t += 0.01)
103 ys_interp.push_back(
w);
108 cout <<
"Done" << endl;
110 #if MRPT_HAS_WXWIDGETS 112 figure.plot(
x,
y,
"r.4",
"true points");
113 figure.plot(ts, ys_interp,
"b",
"interp");
139 bool valid =
interp.queryVector(xs, ys);
142 #if MRPT_HAS_WXWIDGETS 144 figure.plot(data_x, data_y,
"r.6",
"true points");
145 figure.plot(xs, ys,
"b",
"interp");
154 int main(
int argc,
char** argv)
164 catch (std::exception& e)
166 std::cout <<
"MRPT exception caught: " << e.what() << std::endl;
171 printf(
"Another exception!!");
A namespace of pseudo-random numbers generators of diferent distributions.
std::chrono::time_point< Clock > time_point
Create a GUI window and display plots with MATLAB-like interfaces and commands.
int void fclose(FILE *f)
An OS-independent version of fclose.
void drawGaussian1DVector(VEC &v, const double mean=0, const double std=1)
Fills the given vector with independent, 1D-normally distributed samples.
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction...
static time_point now() noexcept
Returns the current time, with the highest resolution available.
GLubyte GLubyte GLubyte GLubyte w
void TestSplineInterpolation()
#define ASSERT_(f)
Defines an assertion mechanism.
A (persistent) sequence of (x,y) coordinates, allowing queries of intermediate points through spline ...
This base provides a set of functions for maths stuff.
void linspace(T first, T last, size_t count, VECTOR &out_vector)
Generates an equidistant sequence of numbers given the first one, the last one and the desired number...
int fprintf(FILE *fil, const char *format,...) noexcept MRPT_printf_format_check(2
An OS-independent version of fprintf.
void setMaxTimeInterpolation(const mrpt::Clock::duration &time)
Set value of the maximum time to consider interpolation.
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...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
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 TestSplineInterpolationVector()
This class stores a time-stamped trajectory in SE(3) (CPose3D poses).
FILE * fopen(const char *fileName, const char *mode) noexcept
An OS-independent version of fopen.
Classes for creating GUI windows for 2D and 3D visualization.
void insert(const mrpt::Clock::time_point &t, const pose_t &p)
Inserts a new pose in the sequence.
CRandomGenerator & getRandomGenerator()
A static instance of a CRandomGenerator class, for use in single-thread applications.
void TestCPose3DInterpolation()