Skip to content

Commit 4a4d780

Browse files
committed
add the perform switching logic to fix the issue with exclusive interfaces
1 parent 77e932e commit 4a4d780

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

controller_manager/src/controller_manager.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,6 +1514,20 @@ void ControllerManager::activate_controllers(
15141514
hardware_interface::lifecycle_state_names::ACTIVE,
15151515
lifecycle_msgs::msg::State::PRIMARY_STATE_ACTIVE);
15161516
controller->release_interfaces();
1517+
{
1518+
// Now prepare and perform the stop interface switching as this is needed for exclusive
1519+
// interfaces
1520+
if (
1521+
!command_interface_names.empty() &&
1522+
(!resource_manager_->prepare_command_mode_switch({}, command_interface_names) ||
1523+
!resource_manager_->perform_command_mode_switch({}, command_interface_names)))
1524+
{
1525+
RCLCPP_ERROR(
1526+
get_logger(),
1527+
"Error switching back the interfaces in the hardware as the controller activation "
1528+
"failed.");
1529+
}
1530+
}
15171531
return;
15181532
}
15191533

0 commit comments

Comments
 (0)