From 2c517c3e9a74cb5faf39c51b11ef2cb93196fb2e Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Tue, 19 Oct 2021 08:25:40 -0700 Subject: [PATCH] Test tweaks (#42) Signed-off-by: Louise Poubel --- dolly/package.xml | 1 + dolly_ignition/launch/dolly.launch.py | 1 + dolly_tests/CMakeLists.txt | 1 - .../launch/follow_ignition_TEST.launch.py | 32 +++++++++---------- dolly_tests/package.xml | 7 ++++ dolly_tests/test/constants.hh.in | 1 - dolly_tests/test/follow_ignition_TEST.cpp | 2 +- 7 files changed, 26 insertions(+), 19 deletions(-) diff --git a/dolly/package.xml b/dolly/package.xml index d6d469f..b169601 100644 --- a/dolly/package.xml +++ b/dolly/package.xml @@ -14,6 +14,7 @@ dolly_follow dolly_gazebo dolly_ignition + dolly_tests ament_lint_auto ament_lint_common diff --git a/dolly_ignition/launch/dolly.launch.py b/dolly_ignition/launch/dolly.launch.py index ea49368..f8ee54e 100644 --- a/dolly_ignition/launch/dolly.launch.py +++ b/dolly_ignition/launch/dolly.launch.py @@ -39,6 +39,7 @@ def generate_launch_description(): ) # Spawn dolly + # TODO: expose pose as a launch argument spawn = Node(package='ros_ign_gazebo', executable='create', arguments=[ '-name', 'dolly', diff --git a/dolly_tests/CMakeLists.txt b/dolly_tests/CMakeLists.txt index 0025204..400972a 100644 --- a/dolly_tests/CMakeLists.txt +++ b/dolly_tests/CMakeLists.txt @@ -32,7 +32,6 @@ if(BUILD_TESTING) find_package(launch_testing_ament_cmake REQUIRED) ament_find_gtest() - set("PROJECT_BINARY_PATH" ${CMAKE_CURRENT_BINARY_DIR}) set("PROJECT_SOURCE_PATH" ${CMAKE_CURRENT_SOURCE_DIR}) configure_file(test/constants.hh.in constants.hh @ONLY) diff --git a/dolly_tests/launch/follow_ignition_TEST.launch.py b/dolly_tests/launch/follow_ignition_TEST.launch.py index aa0138c..541ef5b 100644 --- a/dolly_tests/launch/follow_ignition_TEST.launch.py +++ b/dolly_tests/launch/follow_ignition_TEST.launch.py @@ -27,6 +27,13 @@ def generate_test_description(): + # Test fixture + gazebo_test_fixture = Node( + package='dolly_tests', + executable='follow_ignition_TEST', + output='screen' + ) + # Spawn dolly pkg_dolly_ignition = get_package_share_directory('dolly_ignition') spawn = Node(package='ros_ign_gazebo', executable='create', @@ -37,6 +44,15 @@ def generate_test_description(): 'model.sdf')], output='screen') + # Bridge + bridge = Node( + package='ros_ign_bridge', + executable='parameter_bridge', + arguments=['/dolly/cmd_vel@geometry_msgs/msg/Twist@ignition.msgs.Twist', + '/dolly/laser_scan@sensor_msgs/msg/LaserScan@ignition.msgs.LaserScan'], + output='screen' + ) + # Follow node follow = Node( package='dolly_follow', @@ -48,22 +64,6 @@ def generate_test_description(): ] ) - # Bridge - bridge = Node( - package='ros_ign_bridge', - executable='parameter_bridge', - arguments=['/dolly/cmd_vel@geometry_msgs/msg/Twist@ignition.msgs.Twist', - '/dolly/laser_scan@sensor_msgs/msg/LaserScan@ignition.msgs.LaserScan', - '/dolly/odometry@nav_msgs/msg/Odometry@ignition.msgs.Odometry'], - output='screen' - ) - - # Test - gazebo_test_fixture = Node( - package='dolly_tests', - executable='follow_ignition_TEST', - output='screen' - ) return launch.LaunchDescription([ gazebo_test_fixture, diff --git a/dolly_tests/package.xml b/dolly_tests/package.xml index 4a21f59..098e44d 100644 --- a/dolly_tests/package.xml +++ b/dolly_tests/package.xml @@ -11,13 +11,20 @@ ament_cmake + ament_cmake_gtest ament_lint_auto ament_lint_common + + dolly_follow dolly_ignition + + launch_testing ros2launch + + ros_ign_bridge diff --git a/dolly_tests/test/constants.hh.in b/dolly_tests/test/constants.hh.in index f3c09e7..2bd31f7 100644 --- a/dolly_tests/test/constants.hh.in +++ b/dolly_tests/test/constants.hh.in @@ -14,7 +14,6 @@ #ifndef DOLLY_TESTS__CONSTANTS_HH__ #define DOLLY_TESTS__CONSTANTS_HH__ -#cmakedefine PROJECT_BINARY_PATH "@PROJECT_BINARY_PATH@" #cmakedefine PROJECT_SOURCE_PATH "@PROJECT_SOURCE_PATH@" #endif diff --git a/dolly_tests/test/follow_ignition_TEST.cpp b/dolly_tests/test/follow_ignition_TEST.cpp index 1a31f2d..6d15710 100644 --- a/dolly_tests/test/follow_ignition_TEST.cpp +++ b/dolly_tests/test/follow_ignition_TEST.cpp @@ -161,7 +161,7 @@ TEST(DollyTests, Follow) EXPECT_NE(ignition::gazebo::kNullEntity, targetEntity); EXPECT_LT(0u, dollyPoses.size()); - // Dolly hasn't moved, because simulation is paused + // Dolly hasn't moved yet { const auto & pose = dollyPoses.back(); EXPECT_NEAR(0.0, pose.Pos().X(), 1e-3);