[Documentation] [TitleIndex] [WordIndex

  Documentation Status

pr2_mechanism: pr2_controller_interface | pr2_controller_manager | pr2_hardware_interface | pr2_mechanism_diagnostics | pr2_mechanism_model

Package Summary

Documented

This package specifies the interface to a realtime controller. A controller that implements this interface can be executed by the controller manager in the real time control loop. The package basically contains the C++ controller base class that all controllers need to inherit from.

pr2_mechanism: pr2_controller_interface | pr2_controller_manager | pr2_hardware_interface | pr2_mechanism_diagnostics | pr2_mechanism_model

Package Summary

Released Continuous integration Documented

This package specifies the interface to a realtime controller. A controller that implements this interface can be executed by the controller manager in the real time control loop. The package basically contains the C++ controller base class that all controllers need to inherit from.

pr2_mechanism: pr2_controller_interface | pr2_controller_manager | pr2_hardware_interface | pr2_mechanism_diagnostics | pr2_mechanism_model

Package Summary

Released Continuous integration Documented

This package specifies the interface to a realtime controller. A controller that implements this interface can be executed by the controller manager in the real time control loop. The package basically contains the C++ controller base class that all controllers need to inherit from.

Package Summary

Released Continuous integration No API documentation

This package specifies the interface to a realtime controller. A controller that implements this interface can be executed by thecontroller managerin the real time control loop. The package basically contains the C++ controller base class that all controllers need to inherit from.

  • Maintainer status: maintained
  • Maintainer: Devon Ash <dash AT clearpathrobotics DOT com>
  • Author: Wim Meeussen
  • License: BSD
Cannot load information on name: pr2_controller_interface, distro: kinetic, 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: pr2_controller_interface, distro: lunar, 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.

The controller interface

To implement a real time controller, your controller needs to inherit from the pr2_controller_interface::Controller base class. The base class contains

The base class looks like this:

   1 namespace pr2_controller_interface
   2 {
   3   class Controller
   4   {
   5   public:
   6     virtual bool init(pr2_mechanism_model::RobotState *robot, 
   7                      ros::NodeHandle &n);
   8     virtual void starting();
   9     virtual void update();
  10     virtual void stopping();
  11 
  12     bool getController(const std::string& name, 
  13                        int sched, 
  14                        ControllerType*& c);
  15   };
  16 }

The image below gives the flowchart that shows in what order these four methods are called (more details in the text below).

controllers.png

Initializing the controller

The init method is executed in non-realtime.

   6     virtual bool init(pr2_mechanism_model::RobotState *robot, 
   7                      ros::NodeHandle &n);

The init method is called when you load a controller, to initialize the controller. Note that initializing a controller is independent of starting it: the initialization can be done any amount of time before starting the controller. The init method takes two arguments:

The init method returns if the initialization was successful or not. If the initialization fails, the controller will get unloaded by pr2_controller_manager. Make sure to always use ROS_ERROR("explanation"); to inform the user why your controller failed to initialize. A controller can only be initialized once. If you want to re-initialize a controller, you first need to unload it, and then load it again.

Starting the controller

The starting method is executed in hard realtime.

   8     virtual void starting();

The starting method is called once every time a controller is started, by the controller manager. Starting is executed in the same cycle as the first update call, right before this update call.

The starting method initializes the controller right before the first time update is called. The controller manager is allowed to re-start a controller at a later time, without having to unload/load the controller.

Updating the controller

The update method is executed in hard realtime.

   9     virtual void update();

The update method of every controller is called periodically by pr2_controller_manager at a frequency of 1000 Hz. This means that the execution time of all controllers combined cannot take more than 1 mili-second. In the update loop, the real control work is done.

Stopping the controller

The stopping method is executed in hard realtime.

  10     virtual void stopping();

The stopping method is called once every time a controller is stopped. Stopping is executed in the same cycle as the last update call, right after this update call.

The stopping method does not return anything, it is not allowed to fail.

Requesting a pointer to another controller

The getController method is executed in non-realtime.

  12     bool getController(const std::string& name, 
  13                        int sched, 
  14                        ControllerType*& c);

The getController method allows a controller to get a pointer to another controller. This is used to create a "chain" of controllers, where each controller sends its output to the next controller, in realtime. This system is a poor replacement of the non-realtime ROS communication.

The getController method takes three arguments:


2017-09-16 13:22