From e6c4a9eede618b435217d6a3607eafebbc715caa Mon Sep 17 00:00:00 2001 From: CursedRock17 Date: Sat, 6 Apr 2024 23:57:54 -0400 Subject: [PATCH 1/2] Adding Tests Signed-off-by: CursedRock17 --- tf2_eigen/test/tf2_eigen-test.cpp | 42 +++++++++++++++---------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/tf2_eigen/test/tf2_eigen-test.cpp b/tf2_eigen/test/tf2_eigen-test.cpp index 7bd02a1ea..403360289 100644 --- a/tf2_eigen/test/tf2_eigen-test.cpp +++ b/tf2_eigen/test/tf2_eigen-test.cpp @@ -80,18 +80,17 @@ TEST(TfEigen, ConvertVector3dStamped) EXPECT_EQ(v, v1); } -// TODO(clalancette) Re-enable these tests once we have tf2/convert.h:convert(A, B) implemented -// TEST(TfEigen, ConvertVector3d) -// { -// const Eigen::Vector3d v(1,2,3); +TEST(TfEigen, ConvertVector3d) +{ + const Eigen::Vector3d v(1, 2, 3); -// Eigen::Vector3d v1; -// geometry_msgs::msg::Point p1; -// tf2::convert(v, p1); -// tf2::convert(p1, v1); + Eigen::Vector3d v1; + geometry_msgs::msg::Point p1; + tf2::convert(v, p1); + tf2::convert(p1, v1); -// EXPECT_EQ(v, v1); -// } + EXPECT_EQ(v, v1); +} TEST(TfEigen, ConvertAffine3dStamped) { @@ -111,20 +110,19 @@ TEST(TfEigen, ConvertAffine3dStamped) EXPECT_EQ(v.stamp_, v1.stamp_); } -// TODO(clalancette) Re-enable these tests once we have tf2/convert.h:convert(A, B) implemented -// TEST(TfEigen, ConvertAffine3d) -// { -// const Eigen::Affine3d v( -// Eigen::Translation3d(1,2,3) * Eigen::AngleAxis(1, Eigen::Vector3d::UnitX())); +TEST(TfEigen, ConvertAffine3d) +{ + const Eigen::Affine3d v( + Eigen::Translation3d(1, 2, 3) * Eigen::AngleAxis(1, Eigen::Vector3d::UnitX())); -// Eigen::Affine3d v1; -// geometry_msgs::msg::Pose p1; -// tf2::convert(v, p1); -// tf2::convert(p1, v1); + Eigen::Affine3d v1; + geometry_msgs::msg::Pose p1; + tf2::convert(v, p1); + tf2::convert(p1, v1); -// EXPECT_EQ(v.translation(), v1.translation()); -// EXPECT_EQ(v.rotation(), v1.rotation()); -// } + EXPECT_EQ(v.translation(), v1.translation()); + EXPECT_EQ(v.rotation(), v1.rotation()); +} TEST(TfEigen, ConvertTransform) { From 9e57678206351baa23f3a0bd661d1bbaa4b90bd0 Mon Sep 17 00:00:00 2001 From: CursedRock17 Date: Sun, 7 Apr 2024 00:10:22 -0400 Subject: [PATCH 2/2] Fixing uncrustify Signed-off-by: CursedRock17 --- tf2_eigen/test/tf2_eigen-test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tf2_eigen/test/tf2_eigen-test.cpp b/tf2_eigen/test/tf2_eigen-test.cpp index 403360289..e6a5d776c 100644 --- a/tf2_eigen/test/tf2_eigen-test.cpp +++ b/tf2_eigen/test/tf2_eigen-test.cpp @@ -113,7 +113,7 @@ TEST(TfEigen, ConvertAffine3dStamped) TEST(TfEigen, ConvertAffine3d) { const Eigen::Affine3d v( - Eigen::Translation3d(1, 2, 3) * Eigen::AngleAxis(1, Eigen::Vector3d::UnitX())); + Eigen::Translation3d(1, 2, 3) * Eigen::AngleAxis(1, Eigen::Vector3d::UnitX())); Eigen::Affine3d v1; geometry_msgs::msg::Pose p1;