Robotics StackExchange | Archived questions

How to interface high level controllers i.e ros_control with low level controllers such as Arduino/Tiva-c?

I am building a 5-DOF robotic manipulator from scratch and using Moveit! for motion planning. I've completed initial setup of Moveit! but I'm stuck on sending joint trajectories to micro-controller for implementing the planned motion. I've done appropriate research about the same and concluded that it can be implemented in 3 ways-

(i) roscontrol - Write a hardware interface to command the joints but unable to understand how exactly will it be interfaced with low level controllers. Sample codes will be hugely appreciated. I've read roscontrol documentation and read about roscon 2014 talk about ros_control.

(ii) Using Moveit! - https://github.com/jesseweisberg/moveo_ros Don't see a hardware interface being used.

(iii) Writing custom controllers - https://github.com/BourbonCreams/braccio_arm/tree/master/braccio_controller
Controller code https://github.com/BourbonCreams/braccio_arm/tree/master/braccio_arduino Arduino Code

What method is to be preferred and also how to implement it?

Thanks in advance.

Asked by Voyager97 on 2019-07-29 08:17:18 UTC

Comments

Answers

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.

Asked by bvaningen on 2019-08-05 03:14:41 UTC

Comments

Hi,

I'm facing the same problem as described here and I was considering to use ros_control and communicate with the microcontroller as described by @bvaningen, however I have a question: my uC also controls some sensors, such as an IMU and some ultrasonic sensors and it uses Rosserial to publish the sensors reads to the network. I was considering to also publish the joint status (as I'm already using rosserial) and then the hw_interface on the PC would suscribe to the topic where the joints are being published to get the readings and forward them to the controller upon read() calls.

Somehow I think this might be inefficient, so I was wondering if there were any other way to do what I want.

Thank you very much in advance.

Cheers, Javier

Asked by javieralso on 2020-09-21 17:19:22 UTC