rotation_tests.cpp
Go to the documentation of this file.
2 #include <gtest/gtest.h>
3 
6 
7 TEST(RotationTests, rotationsOK)
8 {
9  KDL::Rotation one_radian_axis_x1 = KDL::Rotation::RPY(1.0, 0.0, 0.0);
10  KDL::Rotation one_radian_axis_x2 = rotation_from_axis_magnitude(1.0, 0.0, 0.0);
11 
12  EXPECT_EQ(one_radian_axis_x1.UnitX(), one_radian_axis_x2.UnitX());
13  EXPECT_EQ(one_radian_axis_x1.UnitY(), one_radian_axis_x2.UnitY());
14  EXPECT_EQ(one_radian_axis_x1.UnitZ(), one_radian_axis_x2.UnitZ());
15 
16  KDL::Rotation neg_radian_axis_x1 = KDL::Rotation::RPY(-1.0, 0.0, 0.0);
17  KDL::Rotation neg_radian_axis_x2 = rotation_from_axis_magnitude(-1.0, 0.0, 0.0);
18 
19  EXPECT_EQ(neg_radian_axis_x1.UnitX(), neg_radian_axis_x2.UnitX());
20  EXPECT_EQ(neg_radian_axis_x1.UnitY(), neg_radian_axis_x2.UnitY());
21  EXPECT_EQ(neg_radian_axis_x1.UnitZ(), neg_radian_axis_x2.UnitZ());
22 
23  KDL::Rotation one_radian_axis_z1 = KDL::Rotation::RPY(0.0, 0.0, 1.0);
24  KDL::Rotation one_radian_axis_z2 = rotation_from_axis_magnitude(0.0, 0.0, 1.0);
25 
26  EXPECT_EQ(one_radian_axis_z1.UnitX(), one_radian_axis_z2.UnitX());
27  EXPECT_EQ(one_radian_axis_z1.UnitY(), one_radian_axis_z2.UnitY());
28  EXPECT_EQ(one_radian_axis_z1.UnitZ(), one_radian_axis_z2.UnitZ());
29 
30  double x, y, z;
31  axis_magnitude_from_rotation(one_radian_axis_x1, x, y, z);
32  EXPECT_DOUBLE_EQ(1.0, x);
33  EXPECT_DOUBLE_EQ(0.0, y);
34  EXPECT_DOUBLE_EQ(0.0, z);
35 
36  axis_magnitude_from_rotation(neg_radian_axis_x1, x, y, z);
37  EXPECT_DOUBLE_EQ(-1.0, x);
38  EXPECT_DOUBLE_EQ(0.0, y);
39  EXPECT_DOUBLE_EQ(0.0, z);
40 
41  axis_magnitude_from_rotation(one_radian_axis_z1, x, y, z);
42  EXPECT_DOUBLE_EQ(0.0, x);
43  EXPECT_DOUBLE_EQ(0.0, y);
44  EXPECT_DOUBLE_EQ(1.0, z);
45 }
46 
47 int main(int argc, char** argv)
48 {
49  testing::InitGoogleTest(&argc, argv);
50  return RUN_ALL_TESTS();
51 }
Vector UnitX() const
Vector UnitZ() const
Vector UnitY() const
TEST(RotationTests, rotationsOK)
TFSIMD_FORCE_INLINE const tfScalar & y() const
static Rotation RPY(double roll, double pitch, double yaw)
TFSIMD_FORCE_INLINE const tfScalar & x() const
void axis_magnitude_from_rotation(const KDL::Rotation &r, double &x, double &y, double &z)
Converts from KDL::Rotation to angle-axis-with-integrated-magnitude.
Definition: models.cpp:261
KDL::Rotation rotation_from_axis_magnitude(const double x, const double y, const double z)
Converts our angle-axis-with-integrated-magnitude representation to a KDL::Rotation.
Definition: models.cpp:248
TFSIMD_FORCE_INLINE const tfScalar & z() const
int main(int argc, char **argv)


robot_calibration
Author(s): Michael Ferguson
autogenerated on Tue Nov 3 2020 17:30:30