Documentation Status

Cannot load information on name: controller_manager, distro: electric, which means that it is not yet in our index. Please see this page for information on how to submit your repository to our index.
Cannot load information on name: controller_manager, distro: fuerte, which means that it is not yet in our index. Please see this page for information on how to submit your repository to our index.
Cannot load information on name: controller_manager, distro: groovy, which means that it is not yet in our index. Please see this page for information on how to submit your repository to our index.
ros_control: control_toolbox | controller_interface | controller_manager | controller_manager_msgs | controller_manager_tests | hardware_interface | joint_limits_interface | realtime_tools | transmission_interface

Package Summary

Released Continuous integration Documented

The controller manager.

ros_control: combined_robot_hw | combined_robot_hw_tests | controller_interface | controller_manager | controller_manager_msgs | controller_manager_tests | hardware_interface | joint_limits_interface | realtime_tools | transmission_interface

Package Summary

Released Continuous integration Documented

The controller manager.

The controller_manager provides a hard-realtime-compatible loop to control a robot mechanism, which is represented by a hardware_interface::RobotHW instance (see the hardware_interface package). The controller_manager provides the infrastructure to load, unload, start and stop controllers.

When loading a controller, the controller_manager will use the controller name as the root for all controller specific parameters, most importantly, type which identifies which plugin to load.

Tools for running controllers

controller state.png

The controller manager provides the infrastructure to interact with controllers. Depending on if you're running controllers from a launch file, from the command line or from a ROS node, the controller manager provides different tools to run controllers.

Command-line tools

controller_manager

You can interact with the controller_manager from the command line, using the controller_manager script. To interact with a specific controller, use:

 $ rosrun controller_manager controller_manager <command> <controller_name>

The following commands are available:

  • load: load a controller (construct and initialize)

  • unload: unload a controller (destruct)

  • start: start a controller

  • stop: stop a controller

  • spawn: load and start a controller

  • kill: stop and unload a controller

To get the state of the controllers, use:

 $ rosrun controller_manager controller_manager <command>

The following commands are available:

  • list: list all the controllers in the order they are executed, and give the state of each controller

  • list-types: list all the controller types the controller manager knows about. If your controller is not in this list, you won't be able to spawn it.

  • reload-libraries: Reloads all the controller libraries that are available as plugins. This is convenient when you are developing a controller and you want to test your new controller code, without restarting the robot every time. This does not restart controllers which were running before.

  • reload-libraries --restore: Reloads all the controller libraries that are available as plugins and restores all controllers to their original state.

spawner

To automatically load and start a set of controllers at once, and automatically stop and unload those same controllers at once, use the spawner tool:

  $ rosrun controller_manager spawner [--stopped] name1 name2 name3

When you run spawner, the listed controllers will get loaded and started (unless you specify --stopped). Spawner will keep running while the controllers are up. When you kill spawner (ctrl-c) it will automatically stop and unload all controllers it initially started.

unspawner

To automatically stop a set of controllers, and restart them later, you can use the unspawner tool:

  $ rosrun controller_manager unspawner name1 name2 name3

The listed controllers will be stopped, but not unloaded. Once spawner is shut down, the controllers will be restarted.

Creating launch files

You could run controller_manager to start controllers from within a launch file. However, the controller would then stay up even after the launch file is taken down. Instead, use the spawner tool to automatically load, start, stop and unload a controller from within a launch file. When you start spawner, it will load and start the controller. When you stop spawner (when the launch file is taken down) it will stop and unload the controller. Your launch file would look something like this:

 <launch>
   <node pkg="controller_manager"
         type="spawner"
         args="controller_name1 controller_name2" />
 </launch>

or, if you just want to load the controller, but not start it yet:

 <launch>
   <node pkg="controller_manager"
         type="spawner"
         args="--stopped controller_name1 controller_name2" />
 </launch>

Graphical tools

The rqt_controller_manager is a rqt plugin that allows to graphically load, unload, start and stop controllers, as well as to display information about loaded controllers.

It can be started from rqt's Plugin menu, or as a standalone executable with:

rosrun rqt_controller_manager rqt_controller_manager

ROS API

To interact with controllers form another ROS node, the controller manager provides five service calls:

controller_manager

Services

controller_manager/load_controller (controller_manager_msgs/LoadController)
  • the service request contains the name of the controller to load, and the response contains a boolean indicating success or failure.
controller_manager/unload_controller (controller_manager_msgs/UnloadController)
  • the service request contains the name of the controller to unload, and the response contains a boolean indicating success or failure. A controller can only be unloaded when it is in the stopped state.
controller_manager/switch_controller (controller_manager_msgs/SwitchController)
  • the service request contains a list of controller names to start, a list of controller names to stop and an int to indicate the strictness (BEST_EFFORT or STRICT). STRICT means that switching will fail and result in a no-op if anything goes wrong (an invalid controller name, a controller that failed to start, etc. ). BEST_EFFORT means that even when something goes wrong with on controller, the service will still try to start/stop the remaining controllers. The service response contains a boolean indicating success or failure. The list of controllers to stop or start can be an empty list, if you are only stopping or only starting controllers.
controller_manager/list_controllers (controller_manager_msgs/ListControllers)
  • the service returns all the controllers that are currently loaded. The response includes the following information: controller name, state (running or stopped), type, hardware interface and claimed resources.
controller_manager/list_controller_types (controller_manager_msgs/ListControllerTypes)
  • the service returns all the controller types that are known to the controller_manager. Only the controller types that are known can be constructed.
controller_manager/reload_controller_libraries (controller_manager_msgs/ReloadControllerLibraries)
  • the service reloads all the controller libraries that are available as plugins. This is convenient when you are developing a controller, and you want to test your new controller code without restarting the robot every time. This service only works when there are NO controller loaded.

Wiki: controller_manager (last edited 2017-08-11 19:50:03 by MaxGittelman)