Go to the documentation of this file.
35 y[0] = cos(
x[0]) * exp(
x[1]) +
x[4];
37 y[2] =
x[4] / (1 +
square(
x[3])) + sin(
x[1] *
x[0]);
46 const double x0[] = {1.8, 0.7, 0.9, -5.6, 8.9};
47 const double x0cov[] = {
48 0.049400, 0.011403, -0.006389, 0.008132, -0.008595,
49 0.011403, 0.026432, 0.005382, 0.008622, -0.017399,
50 -0.006389, 0.005382, 0.063268, -0.019310, -0.017868,
51 0.008132, 0.008622, -0.019310, 0.028474, 0.003507,
52 -0.008595, -0.017399, -0.017868, 0.003507, 0.17398};
56 const double dumm = 0;
67 for (
size_t i = 0; i < N; i++)
73 cout <<
"SUT: Time (ms): " << 1e3 * tictac.
Tac() / N << endl;
76 cout <<
" ======= Scaled Unscented Transform ======== " << endl;
77 cout <<
"y_mean: " << y_mean << endl;
78 cout <<
"y_cov: " << endl << y_cov << endl << endl;
82 mrpt::make_aligned_shared<mrpt::opengl::COpenGLScene>();
84 mrpt::make_aligned_shared<opengl::CGridPlaneXY>(
85 -10, 10, -10, 10, 0, 1));
89 mrpt::make_aligned_shared<opengl::CEllipsoid>();
90 el->enableDrawSolid3D(
false);
91 el->setLocation(y_mean[0], y_mean[1], y_mean[2]);
92 el->setCovMatrix(y_cov);
93 el->setColor(0, 0, 1);
103 for (
size_t i = 0; i < N; i++)
112 cout <<
"MC: Time (ms): " << 1e3 * tictac.
Tac() / N << endl;
116 for (
int i = 0; i < 3; i++)
121 mrpt::make_aligned_shared<opengl::CEllipsoid>();
122 el->enableDrawSolid3D(
false);
123 el->setLocation(y_mean[0], y_mean[1], y_mean[2]);
124 el->setCovMatrix(y_cov);
125 el->setColor(0, 1, 0);
130 cout <<
" ======= Montecarlo Transform ======== " << endl;
131 cout <<
"y_mean: " << y_mean << endl;
132 cout <<
"y_cov: " << endl << y_cov << endl;
141 for (
size_t i = 0; i < N; i++)
145 y_mean, y_cov, x_incrs);
147 cout <<
"LIN: Time (ms): " << 1e3 * tictac.
Tac() / N << endl;
150 cout <<
" ======= Linear Transform ======== " << endl;
151 cout <<
"y_mean: " << y_mean << endl;
152 cout <<
"y_cov: " << endl << y_cov << endl;
156 mrpt::make_aligned_shared<opengl::CEllipsoid>();
157 el->enableDrawSolid3D(
false);
158 el->setLocation(y_mean[0], y_mean[1], y_mean[2]);
159 el->setCovMatrix(y_cov);
160 el->setColor(1, 0, 0);
165 "Comparison SUT (blue), Linear (red), MC (green)", 400, 300);
166 win.get3DSceneAndLock() = scene;
167 win.unlockAccess3DScene();
169 win.setCameraPointingToPoint(y_mean[0], y_mean[1], y_mean[2]);
170 win.setCameraZoom(5.0);
175 for (
int i = 0; i < 3; i++)
178 mrpt::make_aligned_shared<mrpt::gui::CDisplayWindowPlots>(
179 format(
"MC-based histogram of the %i dim", i), 300, 150);
181 std::vector<double> X;
185 winHistos[i]->plot(X, H,
"b");
186 winHistos[i]->axis_fit();
191 cout << endl <<
"Press any key to exit" << endl;
205 for (
int i = 0; i < 6; i++)
y[i] = p2[i];
220 o.
cov.multiply_AAt(
v);
221 for (
int i = 0; i < 7; i++) o.
cov(i, i) += 0.01;
223 o.
cov(0, 1) = o.
cov(1, 0) = 0.007;
225 cout <<
"p1quat: " << endl << o << endl;
231 static const bool elements_do_wrapPI[6] = {
232 false,
false,
false,
true,
true,
true};
234 static const double dummy = 0;
241 MC_y_mean, MC_y_cov, 500);
242 cout <<
"MC: " << endl
263 cout <<
"SUT: " << endl
273 int main(
int argc,
char** argv)
283 catch (std::exception& e)
285 std::cout <<
"Exception: " << e.what() << std::endl;
290 printf(
"Untyped exception!");
Declares a class that represents a Probability Density function (PDF) of a 3D pose .
CONTAINER::Scalar maximum(const CONTAINER &v)
std::shared_ptr< CDisplayWindowPlots > Ptr
A high-performance stopwatch, with typical resolution of nanoseconds.
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction.
std::vector< double > histogram(const CONTAINER &v, double limit_min, double limit_max, size_t number_bins, bool do_normalization=false, std::vector< double > *out_bin_centers=nullptr)
Computes the normalized or normal histogram of a sequence of numbers given the number of bins and the...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,...
T square(const T x)
Inline function for the square of a number.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
double Tac() noexcept
Stops the stopwatch.
std::vector< T, mrpt::aligned_allocator_cpp11< T > > aligned_std_vector
void TestCalibrate_pose2quat()
mrpt::math::CMatrixDouble77 cov
The 7x7 covariance matrix.
void myFun1(const CArrayDouble< 5 > &x, const double &user_param, CArrayDouble< 3 > &y)
mrpt::gui::CDisplayWindow3D::Ptr win
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
CArrayNumeric is an array for numeric types supporting several mathematical operations (actually,...
void Tic() noexcept
Starts the stopwatch.
A numeric matrix of compile-time fixed size.
A quaternion, which can represent a 3D rotation as pair , with a real part "r" and a 3D vector ,...
CPose3DQuat mean
The mean value.
CRandomGenerator & getRandomGenerator()
A static instance of a CRandomGenerator class, for use in single-thread applications.
Declares a class that represents a Probability Density function (PDF) of a 3D pose using a quaternion...
This base provides a set of functions for maths stuff.
void aux_posequat2poseypr(const CArrayDouble< 7 > &x, const double &dummy, CArrayDouble< 6 > &y)
mrpt::math::CMatrixDouble66 cov
The 6x6 covariance matrix.
std::shared_ptr< COpenGLScene > Ptr
std::shared_ptr< CEllipsoid > Ptr
CONTAINER::Scalar minimum(const CONTAINER &v)
void extractColumnFromVectorOfVectors(const size_t colIndex, const VECTOR_OF_VECTORS &data, VECTORLIKE &out_column)
Extract a column from a vector of vectors, and store it in another vector.
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.
void drawGaussian1DMatrix(MAT &matrix, const double mean=0, const double std=1)
Fills the given matrix with independent, 1D-normally distributed samples.
This namespace provides a OS-independent interface to many useful functions: filenames manipulation,...
double DEG2RAD(const double x)
Degrees to radians.
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |