Beginner

ROS Framework

Learn the Robot Operating System (ROS) - the industry-standard middleware for building modular, scalable robot software with nodes, topics, and services.

What is ROS?

The Robot Operating System (ROS) is an open-source middleware framework that provides tools, libraries, and conventions for writing robot software. Despite its name, ROS is not an operating system - it runs on top of Linux (primarily Ubuntu) and provides a structured communication layer between software components called nodes.

ROS 2 (the current generation) is built on the DDS (Data Distribution Service) communication standard, offering improved real-time performance, security, and multi-platform support compared to ROS 1.

💡
ROS 1 vs ROS 2: ROS 2 is the actively developed version with better real-time support, security features, and Windows/macOS compatibility. New projects should use ROS 2 (Humble or Iron). ROS 1 (Noetic) reaches end-of-life in 2025.

Core ROS 2 Concepts

🔷

Nodes

Independent processes that perform specific tasks (e.g., camera driver, object detector, motor controller). Nodes communicate via topics and services.

🔃

Topics

Named buses for publish/subscribe messaging. A camera node publishes images on /camera/image_raw, and any node can subscribe to receive them.

🔄

Services

Request/response communication for synchronous operations. A node can request a path from the planner and wait for the result.

📋

Actions

Long-running tasks with feedback. Navigate to a goal, receive progress updates, and get a final result - with the ability to cancel mid-execution.

Setting Up ROS 2

# Install ROS 2 Humble on Ubuntu 22.04
sudo apt update && sudo apt install -y ros-humble-desktop

# Source the ROS 2 environment
source /opt/ros/humble/setup.bash

# Create a workspace
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws
colcon build
source install/setup.bash

Your First ROS 2 Node

import rclpy
from rclpy.node import Node
from std_msgs.msg import String

class HelloRobot(Node):
    def __init__(self):
        super().__init__('hello_robot')
        self.publisher = self.create_publisher(String, 'greetings', 10)
        self.timer = self.create_timer(1.0, self.publish_message)

    def publish_message(self):
        msg = String()
        msg.data = 'Hello from AI Robotics!'
        self.publisher.publish(msg)
        self.get_logger().info(f'Published: {msg.data}')

def main():
    rclpy.init()
    node = HelloRobot()
    rclpy.spin(node)
    node.destroy_node()
    rclpy.shutdown()

Essential ROS 2 Packages for AI Robotics

PackagePurposeUse Case
nav2Navigation stackAutonomous mobile robot navigation
MoveIt 2Motion planningRobotic arm manipulation
image_pipelineCamera processingImage rectification, depth processing
ros2_controlHardware abstractionMotor controllers, actuator interfaces
tf2Coordinate transformsTracking spatial relationships between frames
pcl_rosPoint cloud processingLiDAR data processing and filtering
Key takeaway: ROS 2 provides the communication backbone for AI robotics. By structuring your software as independent nodes that communicate via topics, services, and actions, you can build modular, testable, and reusable robot systems.

Ready to Go Deeper?

Live instructor-led courses from our partners. Affiliate disclosure.