ROS and Arduino code for the charging system

In this post, I will explain how the mobile robot is programmed. As I already explained, the mobile robot has two Arduino boards and they are connected to a notebook which is running ROS. One of the boards (Arduino Motor) controls the movement of the robot, through the MD23 board which is connected to the 2 motors, and the 3 ultrasonic SRF08 sensors. They are connected to the Arduino board according to the I2C protocol. The other Arduino board (Arduino IR) controls the IR receivers, and as the first one, it is connected to the notebook with a USB cable.


The communication between the Arduino boards and ROS is controlled using the ROSserial package. Both boards publish information of the sensors in different topics, and the main node (listener1) in ROS is subscribed to them. This node, the main program which controls everything, also publish messages to the velocity topics (speed1 and speed2), which are read by the Arduino Motor and sent to the MD23 board, which controls the motors. The “rqt graph” is shown in the next figure:

Captura de pantalla de 2016-06-06 11_34_57 b

The code for both Arduino boards are available in GitHub, and the complete system of files for ROS is also in this link. All the codes are full of explanations, but if you are interested in something, just write us here!

Leave a Reply

Your email address will not be published. Required fields are marked *