Skip to content

Commit

Permalink
Refine the logic of the global state interfaces declare parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
saikishor committed Oct 17, 2024
1 parent 5665b3a commit 836de9a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions controller_manager/src/controller_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,13 +768,17 @@ controller_interface::return_type ControllerManager::configure_controller(
try
{
const auto avilable_state_interfaces = resource_manager_->available_state_interfaces();
std::map<std::string, std::string> default_state_interfaces_remap;
std::for_each(
avilable_state_interfaces.begin(), avilable_state_interfaces.end(),
[&default_state_interfaces_remap](const auto & state_interface)
{ default_state_interfaces_remap[state_interface] = state_interface; });
controller->get_node()->declare_parameters(
"remap.state_interfaces", default_state_interfaces_remap);
[&controller](const auto & state_interface)
{
const auto ctrl_node = controller->get_node();
if (!ctrl_node->has_parameter("remap.state_interfaces." + state_interface))
{
ctrl_node->declare_parameter(
"remap.state_interfaces." + state_interface, state_interface);
}
});
new_state = controller->configure();
if (new_state.id() != lifecycle_msgs::msg::State::PRIMARY_STATE_INACTIVE)
{
Expand Down

0 comments on commit 836de9a

Please sign in to comment.