12 #include <gtest/gtest.h> 23 for (
size_t i=0;i<N;i++)
29 TEST(SE2_SE3_avrg,SO2_average)
33 const double angs[] = {.1};
34 const double ang_correct_avr = .1;
38 const double angs[] = {.0,
M_PI };
39 const double ang_correct_avr = .5*
M_PI;
43 const double angs[] = {-0.75*
M_PI, 0.75*
M_PI };
44 const double ang_correct_avr = 1.0*
M_PI;
48 const double angs [] = {-0.75*
M_PI, 0.75*
M_PI, 0.3*
M_PI };
50 const double ang_correct_avr = 2.3668403111754515;
55 const double dummy [] = {0.};
59 GTEST_FAIL() <<
"An exception should have been raised before this point!!";
60 }
catch (std::exception &)
67 void run_test_so3_avrg(
const double *angs,
const size_t N,
const Eigen::Matrix3d & correct_avr)
70 for (
size_t i=0;i<N;i++) {
75 EXPECT_NEAR( (correct_avr-calc_avr).array().abs().
sum(), .0, 1e-5);
78 TEST(SE2_SE3_avrg,SO3_average)
82 const double angs[] = { .0,.0,.0 };
87 const double angs[] = {-.75*
M_PI,.0,.0, .75*
M_PI,.0,.0 };
92 const double angs[] = {.0,-0.2,.0, .0,0.2,.0 };
97 const double angs[] = {.0,.0,.3, .0,.0,-.3 };
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Computes weighted and un-weighted averages of SO(2) orientations.
TEST(SE2_SE3_avrg, SO2_average)
void append(const double orientation_rad)
Adds a new orientation (radians) to the computation.
This base provides a set of functions for maths stuff.
CONTAINER::Scalar sum(const CONTAINER &v)
Computes the sum of all the elements.
void append(const Eigen::Matrix3d &M)
Adds a new orientation to the computation.
T wrapToPi(T a)
Modifies the given angle to translate it into the ]-pi,pi] range.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
double get_average() const
Returns the average orientation (radians).
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void run_test_so3_avrg(const double *angs, const size_t N, const Eigen::Matrix3d &correct_avr)
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Eigen::Matrix3d get_average() const
Returns the average orientation.
Computes weighted and un-weighted averages of SO(3) orientations.
void getRotationMatrix(mrpt::math::CMatrixDouble33 &ROT) const
Get the 3x3 rotation matrix.
void run_test_so2_avrg(const double *angs, const size_t N, const double ang_correct_avr)