ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The best way to do this IMO is to use your first option: ROS_control. Here you will write an interface between ROS and the micro controllers that you are using. It will start a hardware interface and a controller manager. You can load ROS controllers into the controller manager using a launch file. The type of controller that you will use (position_controllers, velocity_controller, and effort_controllers) will depend on the input that your micro controllers are expecting. The controller manager has an update() method that can be called, asking all controllers to calculate a new error and corresponding output, depending on the interface that you are using. To do this, the controller will read (in order to get sensor data) and write (to pass the output to the microcontrollers) from/to the hardware interface.

Here is a detailed explanation of what is needed to write a hardware interface: https://slaterobots.com/blog/5abd8a1ed4442a651de5cb5b/how-to-implement-ros_control-on-a-custom-robot

The best way to understand this is by example:

https://github.com/SlateRobotics/tr1_hardware_interface/blob/master/src/tr1_hardware_interface.cpp

This same repository also shows more than just the writing of the hardware interface. It also shows how to load the controllers. Checkout the launch files.