Skip to content

Commit

Permalink
donot run the on_error when already in UNCONFIGURED state
Browse files Browse the repository at this point in the history
  • Loading branch information
saikishor committed Aug 29, 2024
1 parent 9fdcdce commit 89c314c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion hardware_interface/src/actuator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ const rclcpp_lifecycle::State & Actuator::deactivate()
const rclcpp_lifecycle::State & Actuator::error()
{
std::unique_lock<std::recursive_mutex> lock(actuators_mutex_);
if (impl_->get_lifecycle_state().id() != lifecycle_msgs::msg::State::PRIMARY_STATE_UNKNOWN)
if (
impl_->get_lifecycle_state().id() != lifecycle_msgs::msg::State::PRIMARY_STATE_UNKNOWN &&
impl_->get_lifecycle_state().id() != lifecycle_msgs::msg::State::PRIMARY_STATE_UNCONFIGURED)
{
switch (impl_->on_error(impl_->get_lifecycle_state()))
{
Expand Down
4 changes: 3 additions & 1 deletion hardware_interface/src/sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ const rclcpp_lifecycle::State & Sensor::deactivate()
const rclcpp_lifecycle::State & Sensor::error()
{
std::unique_lock<std::recursive_mutex> lock(sensors_mutex_);
if (impl_->get_lifecycle_state().id() != lifecycle_msgs::msg::State::PRIMARY_STATE_UNKNOWN)
if (
impl_->get_lifecycle_state().id() != lifecycle_msgs::msg::State::PRIMARY_STATE_UNKNOWN &&
impl_->get_lifecycle_state().id() != lifecycle_msgs::msg::State::PRIMARY_STATE_UNCONFIGURED)
{
switch (impl_->on_error(impl_->get_lifecycle_state()))
{
Expand Down
4 changes: 3 additions & 1 deletion hardware_interface/src/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ const rclcpp_lifecycle::State & System::deactivate()
const rclcpp_lifecycle::State & System::error()
{
std::unique_lock<std::recursive_mutex> lock(system_mutex_);
if (impl_->get_lifecycle_state().id() != lifecycle_msgs::msg::State::PRIMARY_STATE_UNKNOWN)
if (
impl_->get_lifecycle_state().id() != lifecycle_msgs::msg::State::PRIMARY_STATE_UNKNOWN &&
impl_->get_lifecycle_state().id() != lifecycle_msgs::msg::State::PRIMARY_STATE_UNCONFIGURED)
{
switch (impl_->on_error(impl_->get_lifecycle_state()))
{
Expand Down

0 comments on commit 89c314c

Please sign in to comment.