I currently have a set of N controllers "controller_i" which all use the same resources. Intially when I launch Gazebo and Rviz all the controllers are stopped. What I would like to do is turn off and on the controllers in my code.
I can do this by calling the appropriate controller_manager service, see bellow.
ros::ServiceClient controller_manager_service;
controller_manager_msgs::SwitchController switch_msg;
controller_manager_service = nh.serviceClient<controller_manager_msgs::SwitchController>("/controller_manager/switch_controller");
switch_msg.request.start_controllers = {{"controller_1"}};
switch_msg.request.stop_controllers = {{"controller_2"}};
switch_msg.request.strictness = controller_manager_msgs::SwitchController::Request::STRICT;
controller_manager_service.call(switch_msg);
Here decided to start controller_1 and stop controller_2. However I would like to know of a way to query the controller_manager to know which controllers are active.
In this way I can set switch_msg.request.stop_controllers to the currently running controller.
Originally posted by gpldecha on ROS Answers with karma: 285 on 2015-12-13
Post score: 0