From a9363ba45e98bbc9eb6842a5f41da135e2a0723d Mon Sep 17 00:00:00 2001 From: sahand-ghaffari-ocado Date: Mon, 16 Sep 2024 19:00:38 -0400 Subject: [PATCH 1/2] Fix hardware component unconfiguration --- hardware_interface/src/actuator.cpp | 6 +++--- hardware_interface/src/sensor.cpp | 6 +++--- hardware_interface/src/system.cpp | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) 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..eede03dde4 100644 --- a/hardware_interface/src/system.cpp +++ b/hardware_interface/src/system.cpp @@ -73,7 +73,7 @@ const rclcpp_lifecycle::State & System::configure() switch (impl_->on_configure(impl_->get_lifecycle_state())) { case CallbackReturn::SUCCESS: - impl_->set_lifecycle_state(rclcpp_lifecycle::State( + impl_->set_lifecycle_state(rclcpp_lifecycle::State( lifecycle_msgs::msg::State::PRIMARY_STATE_INACTIVE, lifecycle_state_names::INACTIVE)); break; case CallbackReturn::FAILURE: @@ -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: From ed2952b46211d087b98ba70df0690bf8f0145e7c Mon Sep 17 00:00:00 2001 From: sahand-ghaffari-ocado Date: Mon, 16 Sep 2024 19:07:10 -0400 Subject: [PATCH 2/2] Remove extra spaces --- hardware_interface/src/system.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware_interface/src/system.cpp b/hardware_interface/src/system.cpp index eede03dde4..d2c574db79 100644 --- a/hardware_interface/src/system.cpp +++ b/hardware_interface/src/system.cpp @@ -73,7 +73,7 @@ const rclcpp_lifecycle::State & System::configure() switch (impl_->on_configure(impl_->get_lifecycle_state())) { case CallbackReturn::SUCCESS: - impl_->set_lifecycle_state(rclcpp_lifecycle::State( + impl_->set_lifecycle_state(rclcpp_lifecycle::State( lifecycle_msgs::msg::State::PRIMARY_STATE_INACTIVE, lifecycle_state_names::INACTIVE)); break; case CallbackReturn::FAILURE: