This repository contains 10 practical ROS2 projects designed to help understand and master the core concepts of ROS2.
The tasks gradually cover topics, services, actions, parameters, lifecycle management, TF2, plugin architecture, and a simplified Navigation (Nav2) flow.
Completing these exercises will prepare you for working with ROS2 core libraries like rclcpp
, and complex frameworks like Navigation2 (Nav2).
. ├── Task01_PubSub ├── Task02_CustomMsg ├── Task03_Service ├── Task04_Action ├── Task05_Parameters ├── Task06_LifecycleNode ├── Task07_Pluginlib ├── Task08_TF2 ├── Task09_Composition └── Task10_MiniNavDemo
Each folder contains:
src/
→ ROS2 node source filesmsg/
,srv/
, oraction/
→ Custom interfaces (when applicable)CMakeLists.txt
&package.xml
→ ROS2 package configurationREADME.md
→ Task-specific details and run instructions
- Goal: Implement a basic publisher and subscriber node.
- Key Concepts:
rclcpp::Node
,create_publisher
,create_subscription
. - Deliverable: Publishes random integers, subscriber prints them.
- Goal: Learn how to create and use custom message types.
- Key Concepts:
rosidl
, custom.msg
files, message generation. - Deliverable: Publishes custom
SensorReading
messages and subscribes to them.
- Goal: Implement request-response communication.
- Key Concepts:
create_service
,create_client
, synchronous and asynchronous calls. - Deliverable: Simple
AddTwoInts
service and client.
- Goal: Handle long-running tasks with progress feedback.
- Key Concepts: Action servers, action clients, feedback and result handling.
- Deliverable:
MoveRobot.action
with progress updates.
- Goal: Tune node parameters at runtime.
- Key Concepts:
declare_parameter
,get_parameter
, parameter callbacks. - Deliverable: Node with dynamically adjustable speed and name parameters.
- Goal: Understand deterministic node state transitions (important for Nav2).
- Key Concepts: Managed nodes, transition services.
- Deliverable: Lifecycle node with
configure()
,activate()
,deactivate()
.
- Goal: Implement a runtime plugin architecture.
- Key Concepts: Abstract base classes,
pluginlib
registration, dynamic loading. - Deliverable: Two controller plugins (
SimpleController
,AdvancedController
) loaded dynamically.
- Goal: Work with robot frames and coordinate transforms.
- Key Concepts:
tf2_ros::TransformBroadcaster
,tf2_ros::Buffer
,lookupTransform
. - Deliverable: Broadcast a moving transform (
odom → base_link
) and query it from another node.
- Goal: Launch multiple nodes within one process.
- Key Concepts:
rclcpp_components
, intra-process communication. - Deliverable: Publisher & Subscriber as composable nodes loaded in a
component_container
.
- Goal: Implement a simplified navigation pipeline.
- Key Concepts: Multi-node system (Goal node → Planner → Controller → TF → Velocity command).
- Deliverable:
- Goal node sends target position
- Simple planner calculates path
- Controller publishes velocity commands
- TF updates robot movement
- Ubuntu 22.04 or similar
- ROS2 Humble or newer
- Colcon build system
# Source ROS2 environment
source /opt/ros/humble/setup.bash
# Clone repository
git clone https://github.com/<your-username>/ros2-hands-on-tasks.git
cd ros2-hands-on-tasks
# Build all packages
colcon build --symlink-install
# Source workspace
source install/setup.bash
# Run an example (Task 1)
ros2 run task01_pubsub publisher
ros2 run task01_pubsub subscriber