Skip to content

Commit

Permalink
apply fix to perform switch
Browse files Browse the repository at this point in the history
  • Loading branch information
chama1176 committed Feb 14, 2024
1 parent f1d7387 commit 6c92fbf
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions hardware_interface/src/resource_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1198,21 +1198,24 @@ bool ResourceManager::perform_command_mode_switch(

auto call_perform_mode_switch = [&start_interfaces, &stop_interfaces](auto & components)
{
bool ret = true;
bool ret = false;
for (auto & component : components)
{
if (
component.get_state().id() == lifecycle_msgs::msg::State::PRIMARY_STATE_INACTIVE ||
component.get_state().id() == lifecycle_msgs::msg::State::PRIMARY_STATE_ACTIVE)
{
if (
return_type::OK !=
return_type::OK ==
component.perform_command_mode_switch(start_interfaces, stop_interfaces))
{
ret = true;
}
else
{
RCUTILS_LOG_ERROR_NAMED(
"resource_manager", "Component '%s' could not perform switch",
component.get_name().c_str());
ret = false;
}
}
}
Expand All @@ -1222,7 +1225,7 @@ bool ResourceManager::perform_command_mode_switch(
const bool actuators_result = call_perform_mode_switch(resource_storage_->actuators_);
const bool systems_result = call_perform_mode_switch(resource_storage_->systems_);

return actuators_result && systems_result;
return actuators_result || systems_result;
}

// CM API: Called in "callback/slow"-thread
Expand Down

0 comments on commit 6c92fbf

Please sign in to comment.