Skip to content

Commit

Permalink
add the perform switching logic to fix the issue with exclusive inter…
Browse files Browse the repository at this point in the history
…faces
  • Loading branch information
saikishor committed Apr 29, 2024
1 parent 77e932e commit 4a4d780
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions controller_manager/src/controller_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1514,6 +1514,20 @@ void ControllerManager::activate_controllers(
hardware_interface::lifecycle_state_names::ACTIVE,
lifecycle_msgs::msg::State::PRIMARY_STATE_ACTIVE);
controller->release_interfaces();
{
// Now prepare and perform the stop interface switching as this is needed for exclusive
// interfaces
if (
!command_interface_names.empty() &&
(!resource_manager_->prepare_command_mode_switch({}, command_interface_names) ||
!resource_manager_->perform_command_mode_switch({}, command_interface_names)))
{
RCLCPP_ERROR(
get_logger(),
"Error switching back the interfaces in the hardware as the controller activation "
"failed.");
}
}
return;
}

Expand Down

0 comments on commit 4a4d780

Please sign in to comment.