DeparturesRobotic Operating System Middleware

Messages and Types

A complex network of glowing nodes, Victorian botanical illustration style, representing a Learning Whistle learning path on Robotic Operating System Middleware.
Robotic Operating System Middleware

Imagine you are trying to order coffee in a busy shop while everyone speaks different languages. You would likely struggle to get your drink if the barista could not understand your specific request. Robots face this same issue when they try to share data between their internal parts. They need a shared language to ensure that every sensor and motor understands the incoming information. This shared language relies on strict rules for how data is packaged and sent through a robotic system.

The Structure of Standard Messages

When a robot moves, its sensors constantly generate raw data that must be organized before other parts can use it. This organization happens through messages, which act as structured containers for information like distance, speed, or temperature. Think of a message like a standardized shipping label on a package that tells the handler exactly what is inside. Without this label, the robot would receive a pile of numbers without knowing if those numbers represent a laser reading or a battery level. By using these predefined structures, a robot ensures that every node knows exactly where to look for the data it needs to perform a task. This consistency allows different developers to build sensors and motors that work together seamlessly without needing custom software for every single new connection.

Key term: Message — a standardized data structure that allows different robot nodes to communicate information in a format they both recognize.

To make this communication work, every message must follow a specific layout that defines the type of data it carries. These layouts are called message types, and they function like a blueprint for the information being transmitted. If a node expects a message type that contains a decimal number for speed, it will crash if it receives a text string instead. This strict typing prevents errors by ensuring that the data matches the expectations of the receiving software. Just as a bank requires a specific form to process a deposit, a robot requires a specific message type to process a sensor update. This rigid structure allows the robot to handle massive amounts of incoming data at high speeds while maintaining total accuracy.

Defining Custom Data Structures

Sometimes a robot needs to track unique data that standard types do not cover, such as a custom sensor that measures air quality. In these cases, engineers create custom message files to define the exact data fields required for that specific hardware component. These files use a simple syntax to list the name and type of each piece of data, such as an integer for parts per million or a float for humidity levels. Once defined, the robot compiles these files into usable code that any node can access during operation. This modularity is essential because it allows the robot to grow and adapt to new tasks without a complete system overhaul. The following table outlines how different data types help the robot organize various sensor inputs effectively.

Data Type Purpose Example Use Case
Integer Whole counts Wheel rotation count
Float Precision Precise distance measurement
String Labels Unique sensor ID tags
Boolean States On or off switch status

By organizing data into these categories, the robot can prioritize critical information like safety alerts over less important status updates. This prioritization helps the robot react to obstacles in real time without getting bogged down by unnecessary background noise. The system essentially acts like a high-speed post office that sorts incoming mail based on its contents and urgency. When the robot encounters an obstacle, it sends a high-priority message that interrupts other processes to trigger an immediate stop. This level of coordination is only possible because the messages are structured and typed in a way that the entire system understands.


Standardized message types act as a universal language that allows diverse robotic components to exchange complex data accurately and reliably.

The next Station introduces services and actions, which determine how these messages trigger specific robot behaviors.

Explore related books & resources on Amazon ↗As an Amazon Associate I earn from qualifying purchases. #ad

Keep Learning