Skip to main content

Module 1: The Robotic Nervous System (ROS 2)

As the brain of a humanoid robot processes high-level goals, it needs a reliable nervous system to relay information between sensors (eyes), controllers (brainstem), and actuators (muscles). In modern robotics, that nervous system is ROS 2 (Robot Operating System 2).

1. ROS 2 Architecture and DDS Communication

Unlike its predecessor, ROS 2 is built on top of DDS (Data Distribution Service), an industrial-grade standard for real-time, peer-to-peer data sharing.

Why DDS for Humanoids?

  • Decentralization: No single point of failure (no Master node).
  • Quality of Service (QoS): Fine-grained control over reliability, durability, and deadline enforcement—critical for keeping a balancing robot stable.

2. Nodes, Topics, Services, and Actions

The building blocks of a ROS 2 application:

  • Nodes: Individual processes (e.g., one for camera processing, one for leg control).
  • Topics: Continuous data streams (e.g., IMU data published at 200Hz).
  • Services: Request/Response patterns (e.g., "Reset Robot Position").
  • Actions: Long-running goals with feedback (e.g., "Walk to the kitchen").

3. Lifecyle Management and Real-Time Considerations

For complex humanoids, we use Managed Nodes (Lifecycle Nodes). This ensures that a robot doesn't start moving its legs until its vision and balance systems are fully "Active" and "Configured."

4. Bridging AI Agents to Controllers (rclpy)

Integrating Python-based AI (like PyTorch or OpenAI scripts) with ROS 2 is done via rclpy.

Example: Simple Python Action Client

import rclpy
from rclpy.action import ActionClient
from my_robot_msgs.action import WalkToGoal

def send_goal(client, x, y):
goal_msg = WalkToGoal.Goal()
goal_msg.target_x = x
goal_msg.target_y = y
client.wait_for_server()
return client.send_goal_async(goal_msg)

The URDF (Unified Robot Description Format) is the DNA of your robot. It defines the physical structure:

  • Links: The physical parts (thigh, shin, torso).
  • Joints: The connections (hinge joints for knees, ball joints for shoulders).
  • Visual & Collision Properties: How it looks vs. how it interacts with objects.

6. Hands-on: Controlling a Humanoid in Simulation

In the next chapters, we will use the teleop_twist_keyboard to send velocity commands to a simulated bipedal robot and observe how ROS 2 manages the transformation (TF) of coordinate frames from the torso to the feet.

Textbook Assistant

AI Tutor

Hello! I am your Textbook Assistant. I can help you find information within the course materials, modules, and code examples.
AI Tutor