ROSSerial Connection Guide

This page will detail the procedure for establishing a ROSSerial connection with the XBEE devices.

This guide assumes that you already have some form of ROS Melodic installed on your system. If this is not the case, you should be able to substitute 'melodic' for whatever your current ROS version is, but no guarantees that will work.

Installing ROSSerial

Installing rosserial is a very easy process. As long as you have already installed ROS on your system, as well as configured the apt repository (odds are you have already done this if you installed ROS using apt or apt-get) this is a very straightforward process.

sudo apt-get install ros-melodic-rosserial*

Once this is completed, congratulations you have installed rosserial!

Arduino Library Installation

If you will be writing rosserial code for the Arduino, you will need to follow a few extra steps in order to configure the development environment on your own computer. The following steps will configure the ROS library in your Arduino workspace.

# Ensure that the rosserial-arduino package is installed onto your system
sudo apt-get install ros-melodic-rosserial-arduino

# Replace arduino_sketchbook with the actual link to the sketchbook directory
cd <arduino_sketchbook>/libraries

# Delete any existing ros_lib installation
rm -rf ros_lib

# Install the rosserial_library
# NOTE: You may need to run a ROS Master in a different terminal
rosrun rosserial_arduino make_libraries.py .

Examples

These two examples are common scenarios you will find yourself in as you test the development robots. These are based off of working with the Milieu Babel robot.

Connecting to the Arduino (Hardwired)

This guide will assume that you are connected to the Arduino device with the USB cable. Before you perform these steps, make sure that you have the communications port for the Arduino. You can find this by opening the Arduino IDE and viewing the communication port it uses for connecting to the Arduino Board.

# In Terminal A
roscore

# In Terminal B
rosrun rosserial_arduino serial_node.py _port:=/dev/ttyACM0 _baud:=9600

Connecting to the Arduino (XBee)

Make sure that you have configured the XBee radios by using the information in XBee Configuration before you follow the steps in this guide.

This guide will assume that you are trying to connect to the Arduino device over the XBee network. Luckily, this process is very straightforward. Simply start a ROS master and start the rosserial node, and the node should be able to establish a connection between your device and the Arduino

# In Terminal A
roscore

# In Terminal B
rosrun rosserial_python serial_node.py _port:=/dev/ttyUSB0 _baud:=9600

Last updated