A ROS node is a self-contained executable that uses the ROS middleware API. It represents a major robot function as a separate process rather than placing every capability in one monolithic program. Nodes can publish, subscribe, provide services, use actions, and access parameters. section 4.4 section 4.8
This structure resembles a service-oriented software system: independent components exchange typed data through named interfaces. A node may contain any number of publishers and subscribers, while the ROS middleware delivers topic messages without requiring publishers and subscribers to know one another directly. Nodes and their connections form the ROS graph, and ROS packages contain the node executables. section 4.4
A publisher and subscriber pair
A Python publisher subclasses rclpy.node.Node, initializes itself as my_ros_pub, creates a publisher for the String message type on my_topic, and publishes once per second from a timer callback. A second node creates a subscription to the same topic and logs each received message. After registering both executables in a package, ros2 run starts them as separate processes. section 4.4
Figure 4.5 A ROS graph consists of multiple independent nodes that communicate by publishing and subscribing to topics, relying on the middleware to deliver messages based on shared topic names and message types.
Use the ROS graph diagram to trace independent nodes and the topic connections through which the middleware routes typed messages. section 4.4
A practical ROS node typically involves:
- A client library such as rclpy for Python or rclcpp for C++, connected to common ROS communication libraries. section 4.4
- Publishers and subscribers that exchange messages through named, typed topics. section 4.4
- A package, executable entry point, build step, and ros2 run command for deployment. section 4.4
