What Is rosserial?

If you've started exploring robotics with ROS (Robot Operating System), you've likely encountered the challenge of getting a microcontroller — like an Arduino or an ESP32 — to communicate meaningfully with your ROS-powered robot. That's precisely where rosserial comes in.

rosserial is a protocol and a set of libraries that allows microcontrollers and other embedded devices to participate in a ROS network over a serial interface. In plain terms, it lets your Arduino "speak ROS" — publishing topics, subscribing to messages, and even calling services — just like any other ROS node running on a full computer.

Why Does rosserial Exist?

ROS was originally designed for Unix-like systems (primarily Linux). Microcontrollers, on the other hand, have very limited memory, no operating system, and no native networking stack. Without a bridge, your microcontroller would be isolated from the rest of your ROS system.

rosserial solves this by:

  • Serializing ROS messages into a compact binary format suitable for serial transmission
  • Running a lightweight client library on the microcontroller (e.g., rosserial_arduino)
  • Running a server-side node on the ROS host that relays messages between the serial link and the ROS network

How Does It Work? A High-Level Overview

The rosserial architecture has two main components:

  1. The Client (Microcontroller Side): A library (such as ros_lib) is installed on your microcontroller. Your sketch or firmware uses this library to define publishers, subscribers, and message types. When your code runs, it sends/receives serialized data over UART, USB serial, or another serial link.
  2. The Server (ROS Host Side): A ROS node called rosserial_python (or rosserial_server for a C++ variant) runs on your Linux PC or Raspberry Pi. It listens on the serial port, deserializes the incoming data, and re-publishes the messages onto the standard ROS network — and vice versa.

What Can You Do With rosserial?

With rosserial properly set up, your microcontroller can:

  • Publish sensor data (IMU readings, ultrasonic distances, encoder counts) as ROS topics
  • Subscribe to command topics (motor velocity commands, servo angles, LED states)
  • Use ROS time synchronization so timestamps on messages are accurate
  • Interact with ROS services for request/response-style communication
  • Use standard ROS message types (e.g., std_msgs/Int32, sensor_msgs/Range)

Supported Platforms

rosserial is designed to be platform-agnostic. The most widely used implementation is rosserial_arduino, but the protocol is also supported on:

  • Arduino (Uno, Mega, Leonardo, Nano, etc.)
  • Teensy boards
  • STM32 microcontrollers
  • ESP8266 and ESP32 (via Wi-Fi serial)
  • Raspberry Pi Pico (community ports)

ROS 1 vs ROS 2 Compatibility

It's important to note that the classic rosserial stack is primarily a ROS 1 (Noetic, Melodic) solution. For ROS 2, the ecosystem has evolved — micro-ROS is the recommended approach, offering native DDS communication for microcontrollers. However, rosserial remains highly relevant for anyone working on ROS 1 projects or learning the fundamentals of ROS-embedded integration.

Getting Started: What You'll Need

To begin working with rosserial, you'll need:

  1. A ROS 1 installation (Ubuntu with ROS Noetic is recommended for beginners)
  2. The rosserial packages: sudo apt install ros-noetic-rosserial ros-noetic-rosserial-arduino
  3. The Arduino IDE with the ros_lib library installed
  4. A USB cable connecting your microcontroller to your ROS host machine

From there, a simple "Hello World" publisher on your Arduino can have data flowing into your ROS network in under an hour. Subsequent guides on this site will walk you through every step of that journey.

Summary

rosserial is an elegant solution to the classic problem of connecting low-power microcontrollers to the full ROS ecosystem. Whether you're building a line-following robot, a robotic arm, or an autonomous vehicle, rosserial gives your embedded hardware a first-class seat at the ROS table.