File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
joint_trajectory_controller/test Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 2626#include " hardware_interface/types/hardware_interface_type_values.hpp"
2727#include " joint_trajectory_controller/joint_trajectory_controller.hpp"
2828#include " joint_trajectory_controller/tolerances.hpp"
29+ #include " lifecycle_msgs/msg/state.hpp"
2930
3031namespace
3132{
@@ -383,6 +384,19 @@ class TrajectoryControllerTest : public ::testing::Test
383384 return traj_controller_->get_node ()->activate ();
384385 }
385386
387+ void DeactivateTrajectoryController ()
388+ {
389+ if (traj_controller_)
390+ {
391+ if (traj_controller_->get_state ().id () == lifecycle_msgs::msg::State::PRIMARY_STATE_ACTIVE)
392+ {
393+ EXPECT_EQ (
394+ traj_controller_->get_node ()->deactivate ().id (),
395+ lifecycle_msgs::msg::State::PRIMARY_STATE_INACTIVE);
396+ }
397+ }
398+ }
399+
386400 static void TearDownTestCase () { rclcpp::shutdown (); }
387401
388402 void subscribeToState (rclcpp::Executor & executor)
@@ -768,6 +782,8 @@ class TrajectoryControllerTestParameterized
768782 state_interface_types_ = std::get<1 >(GetParam ());
769783 }
770784
785+ virtual void TearDown () { TrajectoryControllerTest::DeactivateTrajectoryController (); }
786+
771787 static void TearDownTestCase () { TrajectoryControllerTest::TearDownTestCase (); }
772788};
773789
You can’t perform that action at this time.
0 commit comments