Skip to content

Commit

Permalink
remove the controller from the use_references_from_subscribers_ list …
Browse files Browse the repository at this point in the history
…when needed by the controller to be active
  • Loading branch information
saikishor committed Jul 9, 2023
1 parent 40808d1 commit 6e92e76
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion controller_manager/src/controller_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2159,7 +2159,9 @@ void ControllerManager::propagate_deactivation_of_chained_mode(
from_chained_mode_request_.push_back(following_ctrl_it->info.name);
to_use_references_from_subscribers_.push_back(following_ctrl_it->info.name);
RCLCPP_DEBUG(
get_logger(), "Adding controller '%s' in 'from chained mode' request.",
get_logger(),
"Adding controller '%s' in 'from chained mode' and 'use references from "
"subscriber' request.",
following_ctrl_it->info.name.c_str());
}
}
Expand Down Expand Up @@ -2283,6 +2285,18 @@ controller_interface::return_type ControllerManager::check_following_controllers
"should stay in chained mode.",
following_ctrl_it->info.name.c_str());
}
auto ref_from_sub_it = std::find(
to_use_references_from_subscribers_.begin(), to_use_references_from_subscribers_.end(),
following_ctrl_it->info.name);
if (found_it != to_use_references_from_subscribers_.end())
{
to_use_references_from_subscribers_.erase(ref_from_sub_it);
RCLCPP_DEBUG(
get_logger(),
"Removing controller '%s' in 'use references from subscriber' request because it "
"should stay in chained mode and accept references from the active controller.",
following_ctrl_it->info.name.c_str());
}
}
}
return controller_interface::return_type::OK;
Expand Down

0 comments on commit 6e92e76

Please sign in to comment.