test_utils.h
Go to the documentation of this file.
1 #ifndef MOVEIT_OPW_KINEMATICS_TEST_UTILS_
2 #define MOVEIT_OPW_KINEMATICS_TEST_UTILS_
3 
4 #include <Eigen/Geometry>
5 
7 {
8 namespace testing
9 {
10 const double TOLERANCE = 1e-6; // absolute tolerance for EXPECT_NEAR checks
11 
12 // Transform represented as Affine3T, change this to Isometry3T for future
13 // versions
14 template <typename T>
15 using Transform = Eigen::Transform<T, 3, Eigen::Affine>;
16 
19 template <typename T>
20 void comparePoses(const Transform<T>& Ta, const Transform<T>& Tb)
21 {
22  using Matrix = Eigen::Matrix<T, 3, 3>;
23  using Vector = Eigen::Matrix<T, 3, 1>;
24 
25  Matrix Ra = Ta.rotation(), Rb = Tb.rotation();
26  for (int i = 0; i < Ra.rows(); ++i)
27  {
28  for (int j = 0; j < Ra.cols(); ++j)
29  {
30  EXPECT_NEAR(Ra(i, j), Rb(i, j), TOLERANCE);
31  }
32  }
33 
34  Vector pa = Ta.translation(), pb = Tb.translation();
35  EXPECT_NEAR(pa[0], pb[0], TOLERANCE);
36  EXPECT_NEAR(pa[1], pb[1], TOLERANCE);
37  EXPECT_NEAR(pa[2], pb[2], TOLERANCE);
38 }
39 } // namespace testing
40 } // namespace moveit_opw_kinematics_plugin
41 
42 #endif
Eigen::Transform< T, 3, Eigen::Affine > Transform
Definition: test_utils.h:15
#define EXPECT_NEAR(a, b, prec)
void comparePoses(const Transform< T > &Ta, const Transform< T > &Tb)
Compare every element of two eigen affine3 poses.
Definition: test_utils.h:20


moveit_opw_kinematics_plugin
Author(s): Jeroen De Maeyer, Simon Schmeisser (isys vision)
autogenerated on Wed Jun 3 2020 03:17:14