ROS Serial Arduino

Introduction

In the previous tutorials, we have seen the working of various ROS concepts and basic simulations on the turtlebot. In this using the ROS Serial, it supports serial communication to transfer the code or the data. 

When we connect the new hardware to the ROS ecosystem, like adding a new sensor or actuator to the ROS ecosystem; If at all the new hardware has the pre-built drivers to import into the ROS, then it is totally fine, but the problem exists when the external hardware doesn’t support the ROS ecosystem.

ROS Serial is a protocol to have the integration of the microcontrollers and the embedded systems into ROS. It acts as a communication protocol between new hardware and the ROS ecosystem. 

ROS Serial allows the new electronic hardware to talk directly to the ROS System, without any custom installation of drivers and other communication protocols.

ROS Serial has a good number of libraries developed to connect to various embedded devices.

ROS Client library is designed for the microcontrollers and can run on any processor which have ANSI C++ compiler and the serial port communication to the computer where the ROS is running.

Some other Important ROS Serial Libraries 

rosserial_arduino

rosserial_embeddedlinux

rosserial_windows

rosserial_mbed

rosserial_tivac

rosserial_stm32

rosserial_teensy

ROS side Interfaces

Rosserial_python: A python-based implementation used in the pc to work with ROS

Rosserial_server: A C++ implementation has some limitations used for the high-performance applications

We can run rosserial_arduino to run ROS commands on Arduino and rosserial_python to run the ROS on the computer and can communicate by sending the ROS messages

ARDUINO

If you want to know about Arduino and about the Arduino UNO development board and about the Arduino IDE platform can read here.

For any basic interfacing of the sensors or the projects related to the Arduino can be seen in this section. Click here.

Installing ROS Serial Libraries

Follow the below commands in the command prompt to install the ROS Serial libraries. Before installing the ROS Serial, make sure you have installed the ROS and necessary requirements. If not, you can install from this tutorial Installation of ROS.

sudo apt-get install ros-kinetic-rosserial-arduino
sudo apt-get install ros-kinetic-rosserial

Now, the rosserial_python package can be accessible with the following command

rosrun rosserial_python

Next step is to generate the Arduino ROS libraries.

First, change the directory to the libraries in the command prompt and run the following commands inside the Arduino libraries folder

rm -rf ros_lib
rosrun rosserial_arduino make_libraries.py .

Now, you can open the Arduino IDE and develop the ROS programs.

After the successful installation of the ROS Serial libraries, you can work on various codes and dump them into the Arduino board and then execute them with the ROS environment. In the upcoming tutorial, shall look into the interfacing of the Arduino UNO board with the sensor and them work accordingly with the ROS using the ROS Serial. For any sort of doubts or questions in this tutorial, you can reach out through the comment box.

Spread knowledge

Leave a Comment

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