ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

controller_manager query running controllers and switch

asked 2015-12-13 10:29:39 -0500

gpldecha gravatar image

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;;

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-12-13 11:33:15 -0500

gvdhoorn gravatar image

Wouldn't controller_manager_msgs/srv/ListControllers get you the list of controllers (then check state field of each ControllerState)?

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-12-13 10:29:39 -0500

Seen: 337 times

Last updated: Dec 13 '15