Welcome! This repository contains a fully containerized ROS 2 Jazzy environment. It includes all the dependencies needed to complete the official ROS 2 Tutorials.
Open a terminal on your host machine and clone this repo:
git clone https://github.com/gglaspell/jazzy_tutorial.git
cd jazzy_tutorialBecause you will be using graphical tools like Turtlesim and RViz2, you need to allow the Docker container to talk to your host's display server. Run this once per session:
xhost +local:rootBuild and start the container in the background using Docker Compose:
docker compose up -d(Note: The first time you run this, it will take a few minutes to download and build the ROS 2 Jazzy image).
To start working, open a bash shell inside the running container:
docker exec -it ros2_jazzy_tutorial_env bashYou should now see your terminal prompt change. You are inside the container! All the ROS 2 environment variables are automatically sourced for you.
ROS 2 requires running multiple nodes in separate terminals at the same time. Open a new terminal tab on your host machine and simply run the docker exec command again:
docker exec -it ros2_jazzy_tutorial_env /entrypoint.sh bashYour code should go inside the ros2_ws/src/ directory. This folder is bind-mounted from your host machine into the container.
- This means you can use your favorite code editor (like VS Code) on your host machine to edit the files, and then compile/run them inside the container.
- If the container is destroyed, your code is safe!
When you are done for the day, exit your container terminals and run:
docker compose downThe security tutorials require a keystore and per-node enclave certificates. The sros2/ folder contains helper scripts to set this up.
All commands below are run inside the container unless noted otherwise.
Run the setup script once. It is safe to re-run; it skips any step that is already complete.
bash /workspace/sros2/setup_sros2.shNote: The
sros2/keystore/directory in the repo contains only a.gitkeepplaceholder. The script detects this correctly and creates a real keystore in its place.
Source secure_env.sh in every terminal that will run a secured node:
source /workspace/sros2/secure_env.shThis sets the three required environment variables:
| Variable | Value |
|---|---|
ROS_SECURITY_KEYSTORE |
absolute path to sros2/keystore/ |
ROS_SECURITY_ENABLE |
true |
ROS_SECURITY_STRATEGY |
Enforce |
Open Terminal A inside the container, source secure_env.sh, then run the talker:
source /workspace/sros2/secure_env.sh
ros2 run demo_nodes_cpp talker --ros-args --enclave /talker_listener/talkerOpen Terminal B inside the container, source secure_env.sh, then run the listener:
source /workspace/sros2/secure_env.sh
ros2 run demo_nodes_py listener --ros-args --enclave /talker_listener/listenerJazzy requirement: Enclave names must be absolute paths (start with
/). Relative names liketalker_listener/talkerare rejected by the Jazzy security layer.
--node-nameis not used here. The--ros-args --enclaveflag sets the security enclave, which is separate from the node name. Do not pass--node-namealongside--enclave.
| Symptom | Fix |
|---|---|
secure_env.sh: No such file or directory |
Make sure you are using the path /workspace/sros2/secure_env.sh (not sros2_demo/) |
Security directory does not exist for enclave |
Re-run setup_sros2.sh; confirm enclave paths start with / |
| Setup script skips keystore creation even though it is empty | The fix is already applied: setup now checks for identity_ca.cert.pem, not just whether the folder is non-empty |
| Nodes connect but messages are not received | Verify both terminals have ROS_SECURITY_STRATEGY=Enforce and the same ROS_SECURITY_KEYSTORE |
Primary Resource: Tutorials — ROS 2 Documentation: Jazzy documentation
Learn how to interact with ROS 2 from the command line.
- Configuring your ROS 2 environment (✅ Handled by the Docker
entrypoint.shautomatically sourcing the setup scripts) - Using
turtlesim,ros2, andrqt - Understanding ROS 2 nodes
- Understanding ROS 2 topics
- Understanding ROS 2 services
- Understanding ROS 2 parameters
- Understanding ROS 2 actions
- Using
rqt_consoleto view logs - Launching multiple nodes
- Recording and playing back data (
ros2 bag)
Write your first ROS 2 code in Python and/or C++.
- Using
colconto build packages (✅colconis pre-installed in the Docker image. You should still read this tutorial to learn thecolcon buildcommand!) - Creating a workspace (✅ The
ros2_ws/srcfolder is already created and mapped to the container) - Creating a package
- Writing a simple publisher and subscriber (C++)
- Writing a simple publisher and subscriber (Python)
- Writing a simple service and client (C++)
- Writing a simple service and client (Python)
- Creating custom
msgandsrvfiles - Implementing custom interfaces
- Using parameters in a class (C++)
- Using parameters in a class (Python)
- Using
ros2doctorto identify issues - Creating and using plugins (C++)
Level up with complex system architectures and foundational tools.
- Managing dependencies with
rosdep(✅ Note:rosdep initandupdateare handled by the Dockerfile, but read this to learn how to userosdep installfor new packages) - Creating a custom action
- Writing an action server and client (C++)
- Writing an action server and client (Python)
- Composing multiple nodes in a single process
- Monitoring for parameter changes
- Launch tutorials: Creating advanced launch files
- tf2 tutorials: Understanding coordinate frames and transforms
- URDF tutorials: Building a visual robot model from scratch
Explore under-the-hood configurations and performance tuning.
- Enabling topic statistics
- Using Fast DDS Discovery Server
- Implementing a custom memory allocator
- Security tutorials (Setting up SROS2) — see SROS2 setup section above
- Recording a bag from a node (C++)
- Reading from a bag file (C++)
- Simulators (Connecting ROS 2 with Gazebo Harmonic)
See ROS 2 in action with practical, real-world examples.
- Quality of Service (QoS) features and degradation testing
- Managing nodes with Managed Nodes (Lifecycle nodes)
- Using ROS 2 with Eclipse Cyclone DDS (✅ Configured as our environment's default via
entrypoint.sh) - Real-time programming in ROS 2 (Pendulum demo)
- Dummy robot demo
- Advanced logging and logger configuration