Understanding the rosserial package in ROS

The rosserial package is a set of standardized communication protocols implemented for communicating from ROS to character devices, such as serial ports, and sockets, and vice versa. The rosserial protocol can convert the standard ROS messages and services data types to embedded device equivalent data types. It also implements multi-topic support by multiplexing the serial data from a character device. The serial data is sent as data packets by adding header and tail bytes on the packet. The packet representation is shown next:

Figure 2: rosserial packet representation

The function of each byte follows:

  • Sync Flag: This is the first byte of the packet, which is always 0xff
  • Sync Flag/Protocol version: This byte was 0xff on ROS Groovy and after that it is set to 0xfe
  • Message Length: This is the length of the packet
  • Checksum Over Message Length: This is the checksum of length for finding packet corruption
  • Topic ID: This is the ID allocated for each topic; the range 0-100 is allocated for the system-related functionalities
  • Serialized Message data: This is the data associated with each topic
  • Checksum of Topic ID and Message data: This is the checksum for the topic and its serial data for finding the packet, corruption

The checksum of length is computed using the following equation:

Checksum = 255 - ( (Topic ID Low Byte + Topic ID High Byte + ... data byte values) % 256)

The ROS client libraries, such as roscpp, rospy, and roslisp, enable us to develop ROS nodes that can run from various devices. One of the ports of the ROS clients that enables us to run a ROS node from the embedded devices, such as Arduino and embedded Linux based boards, is called the rosserial_client library. Using the rosserial_client libraries, we can develop the ROS nodes from Arduino, embedded Linux platforms, and Windows. The following is the list of rosserial_client libraries for each of these platforms:

  • rosserial_arduino: This rosserial_client works on Arduino platforms, such as Arduino UNO, Leonardo, Mega, and Due series for advance robotic projects
  • rosserial_embeddedlinux: This client supports embedded Linux platforms, such as VEXPro, Chumby alarm clock, WRT54GL router, and so on
  • rosserial_windows: This is a client for the Windows platform

In the PC side, we need some other packages to decode the serial message and convert to exact topics from the rosserial_client libraries. The following packages help in decoding the serial data:

  • rosserial_python: This is the recommended PC-side node for handling serial data from a device. The receiving node is completely written in Python.
  • rosserial_server: This is a C++ implementation of rosserial in the PC side. The inbuilt functionalities are less compared to rosserial_python, but it can be used for high-performance applications.

We are mainly focusing on running the ROS nodes from Arduino. First, we will see how to set up the rosserial packages, and then discuss how to set up the rosserial_arduino client in the Arduino IDE.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.7.236