Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the non-deprecated service fields for switching controllers #2927

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ class Ros2ControlManager : public moveit_controller_manager::MoveItControllerMan
ControllersMap::iterator c = managed_controllers_.find(it);
if (c != managed_controllers_.end())
{ // controller belongs to this manager
request->stop_controllers.push_back(c->second.name);
request->deactivate_controllers.push_back(c->second.name);
claimed_resources.right.erase(c->second.name); // remove resources
}
}
Expand All @@ -430,16 +430,16 @@ class Ros2ControlManager : public moveit_controller_manager::MoveItControllerMan
ControllersMap::iterator c = managed_controllers_.find(it);
if (c != managed_controllers_.end())
{ // controller belongs to this manager
request->start_controllers.push_back(c->second.name);
request->activate_controllers.push_back(c->second.name);
for (const auto& required_resource : c->second.required_command_interfaces)
{
resources_bimap::right_const_iterator res = claimed_resources.right.find(required_resource);
if (res != claimed_resources.right.end())
{ // resource is claimed
if (std::find(request->stop_controllers.begin(), request->stop_controllers.end(), res->second) ==
request->stop_controllers.end())
if (std::find(request->deactivate_controllers.begin(), request->deactivate_controllers.end(),
res->second) == request->deactivate_controllers.end())
{
request->stop_controllers.push_back(res->second); // add claiming controller to stop list
request->deactivate_controllers.push_back(res->second); // add claiming controller to stop list
}
claimed_resources.left.erase(res->second); // remove claimed resources
}
Expand All @@ -451,7 +451,7 @@ class Ros2ControlManager : public moveit_controller_manager::MoveItControllerMan
// successfully activated or deactivated.
request->strictness = controller_manager_msgs::srv::SwitchController::Request::STRICT;

if (!request->start_controllers.empty() || !request->stop_controllers.empty())
if (!request->activate_controllers.empty() || !request->deactivate_controllers.empty())
{ // something to switch?
auto result_future = switch_controller_service_->async_send_request(request);
if (result_future.wait_for(std::chrono::duration<double>(SERVICE_CALL_TIMEOUT)) == std::future_status::timeout)
Expand Down
Loading