@@ -963,6 +963,16 @@ controller_interface::return_type ControllerManager::switch_controller(
963
963
964
964
const std::vector<ControllerSpec> & controllers = rt_controllers_wrapper_.get_updated_list (guard);
965
965
966
+ LABEL_CHECK_REQUEST:
967
+ // Set these interfaces as unavailable when clearing requests to avoid leaving them in available
968
+ // state without the controller being in active state
969
+ for (const auto & controller_name : to_chained_mode_request_)
970
+ {
971
+ resource_manager_->make_controller_reference_interfaces_unavailable (controller_name);
972
+ }
973
+ to_chained_mode_request_.clear ();
974
+ from_chained_mode_request_.clear ();
975
+
966
976
// if a preceding controller is deactivated, all first-level controllers should be switched 'from'
967
977
// chained mode
968
978
propagate_deactivation_of_chained_mode (controllers);
@@ -1006,7 +1016,7 @@ controller_interface::return_type ControllerManager::switch_controller(
1006
1016
// remove controller that can not be activated from the activation request and step-back
1007
1017
// iterator to correctly step to the next element in the list in the loop
1008
1018
activate_request_.erase (ctrl_it);
1009
- --ctrl_it ;
1019
+ goto LABEL_CHECK_REQUEST ;
1010
1020
}
1011
1021
if (strictness == controller_manager_msgs::srv::SwitchController::Request::STRICT)
1012
1022
{
@@ -1052,7 +1062,7 @@ controller_interface::return_type ControllerManager::switch_controller(
1052
1062
// remove controller that can not be activated from the activation request and step-back
1053
1063
// iterator to correctly step to the next element in the list in the loop
1054
1064
deactivate_request_.erase (ctrl_it);
1055
- --ctrl_it ;
1065
+ goto LABEL_CHECK_REQUEST ;
1056
1066
}
1057
1067
if (strictness == controller_manager_msgs::srv::SwitchController::Request::STRICT)
1058
1068
{
0 commit comments