From a34c665b68051dfbdc613fbfdfb721bb1897ee30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dr=2E=20Denis=20=C5=A0togl?= Date: Wed, 19 Jun 2024 22:43:29 +0200 Subject: [PATCH] Update the use explict parameters for the wheels. --- mecanum_drive_controller/CMakeLists.txt | 10 +++++----- .../test/test_load_mecanum_drive_controller.cpp | 13 ++++++++++--- .../test/test_mecanum_drive_controller.hpp | 6 +++++- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/mecanum_drive_controller/CMakeLists.txt b/mecanum_drive_controller/CMakeLists.txt index 4e930ccb72..6ff338e75e 100644 --- a/mecanum_drive_controller/CMakeLists.txt +++ b/mecanum_drive_controller/CMakeLists.txt @@ -58,12 +58,12 @@ if(BUILD_TESTING) find_package(hardware_interface REQUIRED) find_package(ros2_control_test_assets REQUIRED) - ament_add_gmock(test_load_mecanum_drive_controller test/test_load_mecanum_drive_controller.cpp) - target_include_directories(test_load_mecanum_drive_controller PRIVATE include) - ament_target_dependencies( - test_load_mecanum_drive_controller + add_rostest_with_parameters_gmock(test_load_mecanum_drive_controller + test/test_load_mecanum_drive_controller.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test/mecanum_drive_controller_params.yaml + ) + ament_target_dependencies(test_load_mecanum_drive_controller controller_manager - hardware_interface ros2_control_test_assets ) diff --git a/mecanum_drive_controller/test/test_load_mecanum_drive_controller.cpp b/mecanum_drive_controller/test/test_load_mecanum_drive_controller.cpp index 36d0b679f2..52ec07ded0 100644 --- a/mecanum_drive_controller/test/test_load_mecanum_drive_controller.cpp +++ b/mecanum_drive_controller/test/test_load_mecanum_drive_controller.cpp @@ -22,10 +22,8 @@ #include "rclcpp/utilities.hpp" #include "ros2_control_test_assets/descriptions.hpp" -TEST(TestLoadMecanumDriveController, when_loading_controller_expect_no_exception) +TEST(TestLoadMecanumDriveController, load_controller) { - rclcpp::init(0, nullptr); - std::shared_ptr executor = std::make_shared(); @@ -41,3 +39,12 @@ TEST(TestLoadMecanumDriveController, when_loading_controller_expect_no_exception rclcpp::shutdown(); } + +int main(int argc, char ** argv) +{ + ::testing::InitGoogleTest(&argc, argv); + rclcpp::init(argc, argv); + int result = RUN_ALL_TESTS(); + rclcpp::shutdown(); + return result; +} diff --git a/mecanum_drive_controller/test/test_mecanum_drive_controller.hpp b/mecanum_drive_controller/test/test_mecanum_drive_controller.hpp index d2c0a79b0f..8c6fdfc44d 100644 --- a/mecanum_drive_controller/test/test_mecanum_drive_controller.hpp +++ b/mecanum_drive_controller/test/test_mecanum_drive_controller.hpp @@ -163,7 +163,11 @@ class MecanumDriveControllerFixture : public ::testing::Test protected: void SetUpController(const std::string controller_name = "test_mecanum_drive_controller") { - ASSERT_EQ(controller_->init(controller_name), controller_interface::return_type::OK); + const auto urdf = ""; + const auto ns = ""; + ASSERT_EQ( + controller_->init(controller_name, urdf, 0, ns, controller_->define_custom_node_options()), + controller_interface::return_type::OK); std::vector command_ifs; command_itfs_.reserve(joint_command_values_.size());