From 11ed083dbc1126d8db03d90c32395ee18e6e4be4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Fr=C3=B6hlich?= Date: Tue, 4 Mar 2025 12:57:48 +0100 Subject: [PATCH] Fix the `ActivateWithWrongJointsNamesFails` test (#1570) --- .../test/test_joint_group_effort_controller.cpp | 5 +++-- .../test/test_joint_group_position_controller.cpp | 5 +++-- .../test/test_joint_group_velocity_controller.cpp | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/effort_controllers/test/test_joint_group_effort_controller.cpp b/effort_controllers/test/test_joint_group_effort_controller.cpp index c19cbff9cf..1ffa757478 100644 --- a/effort_controllers/test/test_joint_group_effort_controller.cpp +++ b/effort_controllers/test/test_joint_group_effort_controller.cpp @@ -85,12 +85,13 @@ TEST_F(JointGroupEffortControllerTest, ActivateWithWrongJointsNamesFails) // activate failed, 'joint4' is not a valid joint name for the hardware ASSERT_EQ(controller_->on_configure(rclcpp_lifecycle::State()), CallbackReturn::SUCCESS); ASSERT_EQ(controller_->on_activate(rclcpp_lifecycle::State()), CallbackReturn::ERROR); + ASSERT_EQ(controller_->on_cleanup(rclcpp_lifecycle::State()), CallbackReturn::SUCCESS); controller_->get_node()->set_parameter({"joints", std::vector{"joint1", "joint2"}}); - // activate failed, 'acceleration' is not a registered interface for `joint1` + // activate should succeed now ASSERT_EQ(controller_->on_configure(rclcpp_lifecycle::State()), CallbackReturn::SUCCESS); - ASSERT_EQ(controller_->on_activate(rclcpp_lifecycle::State()), CallbackReturn::ERROR); + ASSERT_EQ(controller_->on_activate(rclcpp_lifecycle::State()), CallbackReturn::SUCCESS); } TEST_F(JointGroupEffortControllerTest, CommandSuccessTest) diff --git a/position_controllers/test/test_joint_group_position_controller.cpp b/position_controllers/test/test_joint_group_position_controller.cpp index 96a5cead17..a9dd4517e9 100644 --- a/position_controllers/test/test_joint_group_position_controller.cpp +++ b/position_controllers/test/test_joint_group_position_controller.cpp @@ -85,12 +85,13 @@ TEST_F(JointGroupPositionControllerTest, ActivateWithWrongJointsNamesFails) // activate failed, 'joint4' is not a valid joint name for the hardware ASSERT_EQ(controller_->on_configure(rclcpp_lifecycle::State()), CallbackReturn::SUCCESS); ASSERT_EQ(controller_->on_activate(rclcpp_lifecycle::State()), CallbackReturn::ERROR); + ASSERT_EQ(controller_->on_cleanup(rclcpp_lifecycle::State()), CallbackReturn::SUCCESS); controller_->get_node()->set_parameter({"joints", std::vector{"joint1", "joint2"}}); - // activate failed, 'acceleration' is not a registered interface for `joint1` + // activate should succeed now ASSERT_EQ(controller_->on_configure(rclcpp_lifecycle::State()), CallbackReturn::SUCCESS); - ASSERT_EQ(controller_->on_activate(rclcpp_lifecycle::State()), CallbackReturn::ERROR); + ASSERT_EQ(controller_->on_activate(rclcpp_lifecycle::State()), CallbackReturn::SUCCESS); } TEST_F(JointGroupPositionControllerTest, CommandSuccessTest) diff --git a/velocity_controllers/test/test_joint_group_velocity_controller.cpp b/velocity_controllers/test/test_joint_group_velocity_controller.cpp index d781b6ca5c..31ba67ec60 100644 --- a/velocity_controllers/test/test_joint_group_velocity_controller.cpp +++ b/velocity_controllers/test/test_joint_group_velocity_controller.cpp @@ -85,12 +85,13 @@ TEST_F(JointGroupVelocityControllerTest, ActivateWithWrongJointsNamesFails) // activate failed, 'joint4' is not a valid joint name for the hardware ASSERT_EQ(controller_->on_configure(rclcpp_lifecycle::State()), CallbackReturn::SUCCESS); ASSERT_EQ(controller_->on_activate(rclcpp_lifecycle::State()), CallbackReturn::ERROR); + ASSERT_EQ(controller_->on_cleanup(rclcpp_lifecycle::State()), CallbackReturn::SUCCESS); controller_->get_node()->set_parameter({"joints", std::vector{"joint1", "joint2"}}); - // activate failed, 'acceleration' is not a registered interface for `joint1` + // activate should succeed now ASSERT_EQ(controller_->on_configure(rclcpp_lifecycle::State()), CallbackReturn::SUCCESS); - ASSERT_EQ(controller_->on_activate(rclcpp_lifecycle::State()), CallbackReturn::ERROR); + ASSERT_EQ(controller_->on_activate(rclcpp_lifecycle::State()), CallbackReturn::SUCCESS); } TEST_F(JointGroupVelocityControllerTest, CommandSuccessTest)