diff --git a/hardware_interface/src/actuator.cpp b/hardware_interface/src/actuator.cpp index 653b25aac3..6cd6e1fbca 100644 --- a/hardware_interface/src/actuator.cpp +++ b/hardware_interface/src/actuator.cpp @@ -96,12 +96,12 @@ const rclcpp_lifecycle::State & Actuator::cleanup() std::unique_lock lock(actuators_mutex_); if (impl_->get_lifecycle_state().id() == lifecycle_msgs::msg::State::PRIMARY_STATE_INACTIVE) { + impl_->set_lifecycle_state(rclcpp_lifecycle::State( + lifecycle_msgs::msg::State::PRIMARY_STATE_UNCONFIGURED, + lifecycle_state_names::UNCONFIGURED)); switch (impl_->on_cleanup(impl_->get_lifecycle_state())) { case CallbackReturn::SUCCESS: - impl_->set_lifecycle_state(rclcpp_lifecycle::State( - lifecycle_msgs::msg::State::PRIMARY_STATE_UNCONFIGURED, - lifecycle_state_names::UNCONFIGURED)); break; case CallbackReturn::FAILURE: case CallbackReturn::ERROR: diff --git a/hardware_interface/src/sensor.cpp b/hardware_interface/src/sensor.cpp index b5484ee233..edad2f2c81 100644 --- a/hardware_interface/src/sensor.cpp +++ b/hardware_interface/src/sensor.cpp @@ -95,12 +95,12 @@ const rclcpp_lifecycle::State & Sensor::cleanup() std::unique_lock lock(sensors_mutex_); if (impl_->get_lifecycle_state().id() == lifecycle_msgs::msg::State::PRIMARY_STATE_INACTIVE) { + impl_->set_lifecycle_state(rclcpp_lifecycle::State( + lifecycle_msgs::msg::State::PRIMARY_STATE_UNCONFIGURED, + lifecycle_state_names::UNCONFIGURED)); switch (impl_->on_cleanup(impl_->get_lifecycle_state())) { case CallbackReturn::SUCCESS: - impl_->set_lifecycle_state(rclcpp_lifecycle::State( - lifecycle_msgs::msg::State::PRIMARY_STATE_UNCONFIGURED, - lifecycle_state_names::UNCONFIGURED)); break; case CallbackReturn::FAILURE: case CallbackReturn::ERROR: diff --git a/hardware_interface/src/system.cpp b/hardware_interface/src/system.cpp index 044eea9d6b..d2c574db79 100644 --- a/hardware_interface/src/system.cpp +++ b/hardware_interface/src/system.cpp @@ -94,12 +94,12 @@ const rclcpp_lifecycle::State & System::cleanup() std::unique_lock lock(system_mutex_); if (impl_->get_lifecycle_state().id() == lifecycle_msgs::msg::State::PRIMARY_STATE_INACTIVE) { + impl_->set_lifecycle_state(rclcpp_lifecycle::State( + lifecycle_msgs::msg::State::PRIMARY_STATE_UNCONFIGURED, + lifecycle_state_names::UNCONFIGURED)); switch (impl_->on_cleanup(impl_->get_lifecycle_state())) { case CallbackReturn::SUCCESS: - impl_->set_lifecycle_state(rclcpp_lifecycle::State( - lifecycle_msgs::msg::State::PRIMARY_STATE_UNCONFIGURED, - lifecycle_state_names::UNCONFIGURED)); break; case CallbackReturn::FAILURE: case CallbackReturn::ERROR: