10 #include <gtest/gtest.h>    13 #include <Eigen/Dense>    21     const double* angs, 
const size_t N, 
const double ang_correct_avr)
    24     for (
size_t i = 0; i < N; i++) so_avr.
append(angs[i]);
    29 TEST(SE2_SE3_avrg, SO2_average)
    33         const double angs[] = {.1};
    34         const double ang_correct_avr = .1;
    36             angs, 
sizeof(angs) / 
sizeof(angs[0]), ang_correct_avr);
    39         const double angs[] = {.0, 
M_PI};
    40         const double ang_correct_avr = .5 * 
M_PI;
    42             angs, 
sizeof(angs) / 
sizeof(angs[0]), ang_correct_avr);
    45         const double angs[] = {-0.75 * 
M_PI, 0.75 * 
M_PI};
    46         const double ang_correct_avr = 1.0 * 
M_PI;
    48             angs, 
sizeof(angs) / 
sizeof(angs[0]), ang_correct_avr);
    51         const double angs[] = {-0.75 * 
M_PI, 0.75 * 
M_PI, 0.3 * 
M_PI};
    53         const double ang_correct_avr = 2.3668403111754515;
    55             angs, 
sizeof(angs) / 
sizeof(angs[0]), ang_correct_avr);
    59         const double dummy[] = {0.};
    64                 << 
"An exception should have been raised before this point!!";
    66         catch (std::exception&)
    74     const double* angs, 
const size_t N,
    78     for (
size_t i = 0; i < N; i++)
    81             0, 0, 0, angs[3 * i + 0], angs[3 * i + 1], angs[3 * i + 2]);
    85     EXPECT_NEAR((correct_avr - calc_avr).array().abs().
sum(), .0, 1e-5);
    88 TEST(SE2_SE3_avrg, SO3_average)
    92         const double angs[] = {.0, .0, .0};
    93         const auto correct_avr =
    96             angs, 
sizeof(angs) / (3 * 
sizeof(angs[0])), correct_avr);
    99         const double angs[] = {-.75 * 
M_PI, .0, .0, .75 * 
M_PI, .0, .0};
   100         const auto correct_avr =
   103             angs, 
sizeof(angs) / (3 * 
sizeof(angs[0])), correct_avr);
   106         const double angs[] = {.0, -0.2, .0, .0, 0.2, .0};
   107         const auto correct_avr =
   110             angs, 
sizeof(angs) / (3 * 
sizeof(angs[0])), correct_avr);
   113         const double angs[] = {.0, .0, .3, .0, .0, -.3};
   114         const auto correct_avr =
   117             angs, 
sizeof(angs) / (3 * 
sizeof(angs[0])), correct_avr);
 void append(const mrpt::math::CMatrixDouble33 &M)
Adds a new orientation to the computation. 
 
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. 
 
void run_test_so3_avrg(const double *angs, const size_t N, const mrpt::math::CMatrixDouble33 &correct_avr)
 
CONTAINER::Scalar sum(const CONTAINER &v)
Computes the sum of all the elements. 
 
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. 
 
A class used to store a 3D pose (a 3D translation + a rotation in 3D). 
 
Computes weighted and un-weighted averages of SO(3) orientations. 
 
mrpt::math::CMatrixDouble33 get_average() const
Returns the average orientation. 
 
EXPECT_NEAR(out.cam_params.rightCameraPose.x, 0.1194, 0.005)
 
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)