Skip to main content

Module 1 – The Robotic Nervous System (ROS 2)

Estimated Reading Time: 8 minutes Prerequisites: Module 0 (Foundations) Difficulty: Beginner

Introduction​

Welcome to Module 1! This is where you learn ROS 2. ROS 2 stands for Robot Operating System 2. It's the nervous system for modern robots.

Think about your own nervous system. It sends messages between your brain and body. ROS 2 does the same thing for robots. It lets different robot parts talk to each other.

By the end of this module, you'll understand how robots communicate. You'll also build your own robot programs.

What is ROS 2?​

ROS 2 is middleware for robots. Middleware is software that connects different programs. It helps them work together.

ROS 2 provides three main things:

  1. Communication tools: Let robot parts send messages
  2. Libraries: Pre-built code for common robot tasks
  3. Tools: Programs to test and debug your robot

Example 1: The Robot Nervous System​

Type: Analogy

Context: Imagine a humanoid robot trying to pick up a cup. Its camera sees the cup. Its brain decides to grab it. Its arm motors need to move.

Explanation: Without ROS 2, each part works alone. The camera can't tell the brain what it sees. The brain can't tell the arm what to do. ROS 2 connects everything. The camera publishes what it sees. The brain processes this data. It sends commands to the arm. All of this happens automatically.

Takeaway: ROS 2 is the communication network that makes robots work as a unified system.

Why ROS 2?​

You might wonder why we use ROS 2 instead of building from scratch.

Reusability: Thousands of developers have built ROS 2 tools. You can use their work instead of starting over.

Industry Standard: Most robot companies use ROS 2. Learning it opens career opportunities.

Hardware Support: ROS 2 works with many robots. You write code once. It runs on different hardware.

Active Community: When you have problems, thousands of developers can help.

What You'll Learn​

This module covers five main topics:

1. ROS 2 Core Concepts​

Learn about nodes, topics, services, and actions. These are the building blocks of robot programs.

2. Python Development​

Build ROS 2 programs using Python. Python is easier than C++ for beginners.

3. Robot Description​

Define robot models using URDF and Xacro. These formats describe robot structure.

4. Package Management​

Create, build, and launch ROS 2 packages. Packages organize your code.

5. Walking Gait Publisher​

Build a real project. Make a humanoid robot walk using joint control.

Learning Objectives​

By the end of this module, you will be able to:

  1. Understand how ROS 2 programs communicate
  2. Create nodes, topics, services, and actions
  3. Write robot programs in Python
  4. Define robot models
  5. Build and launch packages
  6. Control humanoid robot walking

Example 2: From Zero to Walking Robot​

Type: Scenario

Context: Meet Alex. He's a web developer with no robotics background. He completed Module 0. Now he's starting Module 1.

Explanation: Alex starts by learning basic concepts. He creates his first node. It prints "Hello Robot" to the screen. Next, he makes nodes talk to each other. By the end, he builds a gait publisher. This makes a simulated humanoid robot walk. The entire learning path takes about 12 hours spread over one week.

Takeaway: You can go from zero robotics knowledge to controlling a walking robot in one module. The path is structured and beginner-friendly.

Prerequisites​

Before starting, make sure you have:

  • ✅ Completed Module 0 (Foundations)
  • ✅ Basic Python knowledge (variables, functions, loops)
  • ✅ Command line familiarity (cd, ls, basic commands)
  • ✅ Ubuntu 22.04 access (native, WSL2, or Docker)

Don't worry if you're not an expert. We explain everything step by step.

Module Structure​

This module contains five chapters. Work through them in order:

  1. Core Concepts - Learn ROS 2 fundamentals
  2. Python + rclpy - Build your first programs
  3. URDF/Xacro - Define robot models
  4. Packages - Organize and build projects
  5. Mini-Project - Create a walking gait publisher

Each chapter takes 2-3 hours. Budget about 12 hours total.

Mini-Project: Walking Gait Publisher​

The module ends with a hands-on project. You'll build a walking gait publisher in Python.

What it does: Your program generates joint trajectories. These make a humanoid robot walk. You'll see your robot take its first steps in simulation.

Why it matters: Walking is complex. It requires coordinating many joints. This project teaches you real-world robot control.

What you'll use:

  • ROS 2 nodes for control
  • Topics for publishing joint commands
  • Python for programming logic
  • URDF models for robot description

Tools You'll Use​

Throughout this module, you'll work with:

  • ROS 2 Humble: The LTS (Long Term Support) version
  • Python 3.10: For writing programs
  • VS Code: For editing code
  • Terminal: For running commands
  • RViz: For visualizing robots

All tools are open source and free.

Time Commitment​

  • Per Chapter: 2-3 hours
  • Total Module: 10-12 hours
  • Recommended Pace: 1 week (2 chapters per day)

You can go faster or slower based on your schedule.

Getting Help​

Stuck on something? Here's how to get help:

  1. Check the FAQ: Common questions answered in Appendix
  2. Read Error Messages: They often tell you what's wrong
  3. Use ROS Answers: Community Q&A site
  4. Review Examples: Each chapter has working code samples

What's Next?​

Ready to dive in? Start with the first chapter:

Continue to: Chapter 1: Core Communication Patterns

Related topics:

Success Tips​

Before you start, here are some tips:

  1. Follow in Order: Each chapter builds on the previous one
  2. Type Code Yourself: Don't just copy-paste. Type it to learn.
  3. Experiment: Try changing values. See what happens.
  4. Take Breaks: Learning is more effective in short sessions
  5. Build the Project: The mini-project cements your learning

Let's explore the nervous system of modern robots!