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 template <typename T>
13 using Transform = Eigen::Transform<T, 3, Eigen::Isometry>;
14 
17 template <typename T>
18 void comparePoses(const Transform<T>& Ta, const Transform<T>& Tb)
19 {
20  using Matrix = Eigen::Matrix<T, 3, 3>;
21  using Vector = Eigen::Matrix<T, 3, 1>;
22 
23  Matrix Ra = Ta.rotation(), Rb = Tb.rotation();
24  for (int i = 0; i < Ra.rows(); ++i)
25  {
26  for (int j = 0; j < Ra.cols(); ++j)
27  {
28  EXPECT_NEAR(Ra(i, j), Rb(i, j), TOLERANCE);
29  }
30  }
31 
32  Vector pa = Ta.translation(), pb = Tb.translation();
33  EXPECT_NEAR(pa[0], pb[0], TOLERANCE);
34  EXPECT_NEAR(pa[1], pb[1], TOLERANCE);
35  EXPECT_NEAR(pa[2], pb[2], TOLERANCE);
36 }
37 } // namespace testing
38 } // namespace moveit_opw_kinematics_plugin
39 
40 #endif
#define EXPECT_NEAR(a, b, prec)
Eigen::Transform< T, 3, Eigen::Isometry > Transform
Definition: test_utils.h:13
void comparePoses(const Transform< T > &Ta, const Transform< T > &Tb)
Compare every element of two transforms.
Definition: test_utils.h:18


moveit_opw_kinematics_plugin
Author(s): Jeroen De Maeyer, Simon Schmeisser (isys vision)
autogenerated on Mon Feb 28 2022 22:50:11