test_pose_cov_ops.cpp
Go to the documentation of this file.
1 /*
2  * test_pose_cov_ops.cpp
3  *
4  * Created on: Dec 23, 2019
5  * Author: Jose Luis Blanco Claraco
6  */
7 
8 #include <gtest/gtest.h>
9 #include <mrpt/poses/CPose3D.h>
10 #include <mrpt/version.h>
12 
13 using namespace std;
14 
15 TEST(PoseCovOps, composition) {
16  // Test added whiel debugging report:
17  // https://github.com/mrpt-ros-pkg/pose_cov_ops/issues/7
18 
20  a.pose.position.x = -0.333330;
21  a.pose.position.y = 0;
22  a.pose.position.z = 0.100000;
23 
24  a.pose.orientation.x = 0.707107;
25  a.pose.orientation.y = 0;
26  a.pose.orientation.z = 0.707107;
27  a.pose.orientation.w = -0.000005;
28 
30  b.pose.position.x = 1.435644;
31  b.pose.position.y = 0;
32  b.pose.position.z = 0;
33  b.pose.orientation.x = 1.000000;
34  b.pose.orientation.y = 0;
35  b.pose.orientation.z = 0;
36  b.pose.orientation.w = 0;
37 
39  pose_cov_ops::compose(a, b, ab);
40 
41  mrpt::poses::CPose3D a_mrpt, b_mrpt, ab_mrpt;
42  mrpt_bridge::convert(a.pose, a_mrpt);
43  mrpt_bridge::convert(b.pose, b_mrpt);
44  mrpt_bridge::convert(ab.pose, ab_mrpt);
45 #if MRPT_VERSION >= 0x199
46  std::cout << "a: " << a_mrpt.asString() << "\nRot:\n"
47  << a_mrpt.getRotationMatrix() << "\n";
48  std::cout << "b: " << b_mrpt.asString() << "\nRot:\n"
49  << b_mrpt.getRotationMatrix() << "\n";
50  std::cout << "a+b: " << ab_mrpt.asString() << "\nRot:\n"
51  << ab_mrpt.getRotationMatrix() << "\n";
52 #endif
53  std::cout << "a: " << a << "\n";
54  std::cout << "b: " << b << "\n";
55  std::cout << "a(+)b: " << ab << "\n";
56 
57  EXPECT_NEAR(ab.pose.position.x, -0.3333333, 0.01);
58 }
59 
60 // Run all the tests that were declared with TEST()
61 int main(int argc, char **argv) {
62  testing::InitGoogleTest(&argc, argv);
63  return RUN_ALL_TESTS();
64 }
GLboolean GLboolean GLboolean GLboolean a
int main(int argc, char **argv)
void compose(const geometry_msgs::Pose &a, const geometry_msgs::Pose &b, geometry_msgs::Pose &out)
TEST(PoseCovOps, composition)
#define EXPECT_NEAR(val1, val2, abs_error)
void convert(const ros::Time &src, mrpt::system::TTimeStamp &des)
void asString(std::string &s) const
void getRotationMatrix(mrpt::math::CMatrixDouble33 &ROT) const
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
GLdouble GLdouble GLdouble b


pose_cov_ops
Author(s):
autogenerated on Tue Dec 24 2019 04:03:31