Skip to content

Commit

Permalink
make tf2_eigen_test a ROS node
Browse files Browse the repository at this point in the history
  • Loading branch information
gleichdick committed Feb 8, 2021
1 parent e5c60f9 commit aefdc7b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
7 changes: 5 additions & 2 deletions tf2_eigen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ install(DIRECTORY include/${PROJECT_NAME}/

if(CATKIN_ENABLE_TESTING)

catkin_add_gtest(tf2_eigen-test test/tf2_eigen-test.cpp)
target_link_libraries(tf2_eigen-test ${catkin_LIBRARIES} ${GTEST_LIBRARIES})
find_package(rostest REQUIRED)

add_executable(tf2_eigen_test test/tf2_eigen-test.cpp)
target_link_libraries(tf2_eigen_test ${catkin_LIBRARIES} ${GTEST_LIBRARIES})
add_rostest(${CMAKE_CURRENT_SOURCE_DIR}/test/test.launch)

endif()
3 changes: 2 additions & 1 deletion tf2_eigen/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@

<depend>geometry_msgs</depend>
<depend>tf2</depend>
<depend>tf2_ros</depend>

<build_depend>cmake_modules</build_depend>
<build_depend>eigen</build_depend>
<build_depend>tf2_ros</build_depend>

<build_export_depend>eigen</build_export_depend>

<test_depend>rostest</test_depend>
</package>
3 changes: 3 additions & 0 deletions tf2_eigen/test/test.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<launch>
<test test-name="tf2_eigen_test" pkg="tf2_eigen" type="tf2_eigen_test" time-limit="120" />
</launch>
4 changes: 3 additions & 1 deletion tf2_eigen/test/tf2_eigen-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@


#include <gtest/gtest.h>
#include <ros/ros.h>
#include <tf2/convert.h>
#include <tf2_eigen/tf2_eigen.h>
#include <tf2_ros/buffer.h>
Expand Down Expand Up @@ -336,7 +337,8 @@ TEST_F(EigenBufferTransform, QuaternionRotZ)
int main(int argc, char ** argv)
{
testing::InitGoogleTest(&argc, argv);
ros::Time::init();
ros::init(argc, argv, "test");
ros::NodeHandle n;

return RUN_ALL_TESTS();
}

0 comments on commit aefdc7b

Please sign in to comment.