Figure 4. Arduino Preference.
Figure 3. Arduino IDE.
Figure 5. Generating Arduino ros_lib.
1. Navigate to File -> Preference in the Arduino IDE,
and find the sketchbook location (Figure 4). Go to the
sketchbook location and find the folder called libraries. If it
is not there, you can create a new
one. This is the location where we
are going to create the Arduino-ROS
Go to https://www.arduino.cc
/en/Main/Software. We can either
download the IDE from this website
or install it via the Ubuntu software
package manager. Downloading
directly from the website will give
you the most current version.
2. To build the Arduino-ROS
library, open a new terminal and
For installing the Arduino IDE
from the Ubuntu software package
manager, use this command:
sudo apt-get install
After installation, you can run
the command arduino in your
terminal, or if you are working with
binaries downloaded from the
website, extract the archive and you
can see an executable called arduino. Simply execute it
using this command:
3. Open a new terminal in
and enter the command shown in
Figure 5. This command will
generate the ros_lib library which
consists of embedded equivalent
messages of actual ROS messages
and ROS serial client APIs. Note: It
may show an error during
generation. Just ignore the error
messages. For some ROS messages,
embedded equivalent conversions may not be possible.
If the ros_lib is now properly in the folder, you may get
the examples of ros_lib from the following option (refer to
If everything works fine, the Arduino IDE will pop up
and you will see the screen in Figure 3.
File -> Examples -> ros_lib
Congratulations! You have successfully set up the
Arduino IDE in Linux. Our next procedure is to set up the
rosserial Arduino library.
Setting Up ros_lib in the Arduino
Now, we can work on simple examples using it. We
can start with a Blink LED code. Using this example, we can
toggle the state of the LED whenever we publish a value to
a topic. Here is how we do that.
After setting up the Arduino IDE, we have to create an
Arduino-ROS library for writing Arduino-ROS nodes. Here
are the steps for setting it:
Setting the Board Name and
Serial Device in the Arduino IDE
You can either program Arduino in the real Ubuntu
system or VirtualBox. If you are working with a PC, just
plug in the Arduino device and when you plug the Arduino
in Ubuntu, it will act as a serial device and the Linux kernel
will load the USB to serial driver.
32 SERVO 11.2016