11# 🐢 Learning-ROS2
22
3+ ![ ROS2 Version] ( https://img.shields.io/badge/ROS2-Humble-blue?logo=ros\& logoColor=white ) ![ License] ( https://img.shields.io/badge/License-Apache--2.0-green ) ![ Platform] ( https://img.shields.io/badge/Platform-Manjaro%20Linux-lightgrey?logo=arch-linux\& logoColor=white ) ![ Docker] ( https://img.shields.io/badge/Container-Docker-blue?logo=docker\& logoColor=white )
4+
35A personal workspace for learning and experimenting with ** ROS 2 Humble** using Docker, GPU acceleration (NVIDIA RTX 4060), and VS Code integration. This README documents setup, installation, and usage so anyone can reproduce the environment.
46
57---
68
79## 📖 What is ROS 2?
810
9- ROS 2 (Robot Operating System 2) is a flexible framework for writing robot software. It provides:
11+ [ ROS 2 (Robot Operating System 2) ] ( https://docs.ros.org/en/humble/ ) is a flexible framework for writing robot software. It provides:
1012
11- - A publish/subscribe communication system between nodes
12- - Tools for simulation (Gazebo, RViz2)
13- - Libraries for robotics, AI, and machine learning integration
14- - Support for C++ and Python development
13+ * A publish/subscribe communication system between nodes
14+ * Tools for simulation (Gazebo, RViz2)
15+ * Libraries for robotics, AI, and machine learning integration
16+ * Support for C++ and Python development
1517
1618---
1719
18- ## 📚 Table of contents
19-
20- - [ Overview] ( #-overview )
21- - [ Design choices] ( #-design-choices )
22- - [ Prerequisites (Host: Manjaro Linux)] ( #-prerequisites-host-manjaro-linux )
23- - [ Recommended (Docker) installation] ( #-recommended-docker-installation )
20+ ## 📚 Table of Contents
2421
25- - [ NVIDIA / GPU passthrough] ( #nvidia--gpu-passthrough )
26- - [ Docker Compose example] ( #docker-compose-example )
27- - [ Common container workflow] ( #common-container-workflow )
22+ * [ Overview] ( #-overview )
23+ * [ Design Choices] ( #-design-choices )
24+ * [ Prerequisites (Host: Manjaro Linux)] ( #-prerequisites-host-manjaro-linux )
25+ * [ Recommended (Docker) Installation] ( #-recommended-docker-installation )
2826
29- - [ Developing inside the container (VS Code)] ( #developing-inside-the-container-vs-code )
30- - [ Building & running ROS 2 packages] ( #building--running-ros-2-packages )
31- - [ Alternative installation methods] ( #-alternative-installation-methods )
32- - [ Tips & troubleshooting] ( #tips--troubleshooting )
33- - [ Resources & further reading] ( #resources--further-reading )
34- - [ License] ( #license )
27+ * [ NVIDIA / GPU Passthrough] ( #nvidia--gpu-passthrough )
28+ * [ Docker Compose Example] ( #docker-compose-example )
29+ * [ Common Container Workflow] ( #common-container-workflow )
30+ * [ Developing Inside the Container (VS Code)] ( #-developing-with-vs-code )
31+ * [ Building & Running ROS 2 Packages] ( #-building-your-workspace-inside-container )
32+ * [ Alternative Installation Methods] ( #-alternative-installation-methods-on-manjaro )
33+ * [ Tips & Troubleshooting] ( #-tips--troubleshooting )
34+ * [ Resources & Further Reading] ( #-resources--further-reading )
35+ * [ Contributing] ( #-contributing )
36+ * [ License] ( #-license )
3537
3638---
3739
@@ -41,13 +43,13 @@ This repository prioritizes a **Docker-first** approach so you get a reproducibl
4143
4244** Why Docker?**
4345
44- - Isolates ROS 2 Humble environment from host package manager (Manjaro)
45- - Easier to enable NVIDIA GPU support via ` --gpus ` and ` nvidia-container-toolkit `
46- - Quick reproducible setup for teammates or future you
46+ * Isolates ROS 2 Humble environment from host package manager (Manjaro)
47+ * Easier to enable NVIDIA GPU support via ` --gpus ` and ` nvidia-container-toolkit `
48+ * Quick reproducible setup for teammates or future you
4749
4850---
4951
50- ## ⚙️ Design choices
52+ ## ⚙️ Design Choices
5153
52541 . ** Docker (Recommended)** – reproducible, GPU-enabled, minimal host changes.
53552 . ** AUR packages** – quicker to get binaries but can break with rolling releases.
@@ -59,10 +61,9 @@ This repository prioritizes a **Docker-first** approach so you get a reproducibl
5961
6062These steps assume you have an NVIDIA GPU (RTX 4060) and want GPU acceleration inside the container.
6163
62- 1 . Install NVIDIA drivers (host):
64+ 1 . Install NVIDIA drivers (host) and verify :
6365
6466``` bash
65- # verify drivers are active
6667nvidia-smi
6768```
6869
@@ -91,7 +92,7 @@ You should see your RTX 4060 listed in the container output.
9192
9293---
9394
94- ## ✅ Recommended (Docker) installation
95+ ## ✅ Recommended (Docker) Installation
9596
9697### 1) Clone this repository
9798
@@ -102,37 +103,36 @@ cd Learning-ROS2
102103
103104### 2) Example Dockerfile (optional)
104105
105- If you want a custom image (base: ubuntu 22.04 + ROS Humble):
106+ If you want a custom image (base: Ubuntu 22.04 + ROS Humble):
106107
107108``` dockerfile
108109# Dockerfile
109110FROM ubuntu:22.04
110111ARG DEBIAN_FRONTEND=noninteractive
111112
112- # Install basic dependencies and ROS 2 Humble
113+ # Install basic dependencies and ROS 2 keys & repos (follow official instructions)
113114RUN apt-get update && apt-get install -y \
114- curl gnupg2 lsb-release locales sudo \
115- && locale-gen en_US.UTF-8
115+ curl gnupg2 lsb-release locales sudo && \
116+ locale-gen en_US.UTF-8
116117
117- # Add ROS 2 repo and install (shortened for brevity)
118- # ... follow official ROS 2 instructions to add keys and apt sources
118+ # (Add ROS 2 apt repository & install ros-humble-desktop or ros-humble-ros-base as needed)
119119
120- # Create a user (optional)
120+ # Optional: create a developer user
121121RUN useradd -m developer && echo "developer:developer" | chpasswd && adduser developer sudo
122122USER developer
123123WORKDIR /home/developer
124124
125125CMD ["/bin/bash" ]
126126```
127127
128- > Tip: You can start from ` ros:humble ` or ` ros:humble-ros-base ` official images for faster iteration.
128+ > Tip: Use ` ros:humble ` or ` ros:humble-ros-base ` official images for faster iteration when possible .
129129
130130### 3) docker-compose.yml (example)
131131
132132A minimal ` docker-compose.yml ` for development with GPU support:
133133
134134``` yaml
135- version : " 3.8"
135+ version : ' 3.8'
136136services :
137137 ros2_dev :
138138 image : ros:humble
@@ -161,7 +161,7 @@ services:
161161docker compose up -d --build
162162```
163163
164- Attach to the container shell:
164+ ** Attach to the container shell:**
165165
166166``` bash
167167docker exec -it ros2_dev bash
@@ -179,7 +179,7 @@ source /opt/ros/humble/setup.bash
179179
180180You can configure VS Code to open a terminal that drops you into the running container with your workspace sourced. Examples for ` .vscode/settings.json ` and ` .vscode/tasks.json ` are shown below.
181181
182- ** Example: ` settings.json ` terminal profile**
182+ ** Example: ` .vscode/ settings.json` terminal profile**
183183
184184``` json
185185{
@@ -196,7 +196,7 @@ You can configure VS Code to open a terminal that drops you into the running con
196196}
197197```
198198
199- ** Example: ` tasks.json ` snippets for running talker/listener**
199+ ** Example: ` .vscode/ tasks.json` snippets for running talker/listener**
200200
201201``` json
202202{
@@ -216,22 +216,21 @@ You can configure VS Code to open a terminal that drops you into the running con
216216}
217217```
218218
219- > Tip: Use the Remote - Containers extension if you prefer VS Code to manage containers for you.
219+ > Tip: Use the ** Remote - Containers** extension if you prefer VS Code to manage containers for you.
220220
221221---
222222
223- ## 🛠 Building your workspace (inside container)
223+ ## 🛠 Building Your Workspace (inside container)
224224
225225Assuming your ROS 2 workspace is at ` /root/LEARN ` inside the container:
226226
227227``` bash
228- # inside container
229228cd /root/LEARN
230229colcon build
231230source install/setup.bash
232231```
233232
234- Install extra packages if needed (example) :
233+ Install extra packages if needed:
235234
236235``` bash
237236apt update && apt install -y ros-humble-turtlesim
@@ -250,44 +249,44 @@ ros2 run demo_nodes_cpp listener
250249
251250---
252251
253- ## 🔁 Common workflow (quick checklist )
252+ ## 🔁 Common Workflow (Quick Checklist )
254253
255- - Start container: ` docker compose up -d `
256- - Attach shell: ` docker exec -it ros2_dev bash `
257- - Source ROS 2 and workspace: ` source /opt/ros/humble/setup.bash && source /root/LEARN/install/setup.bash `
258- - Build: ` colcon build `
259- - Run nodes with ` ros2 run ` or ` ros2 launch `
254+ * Start container: ` docker compose up -d `
255+ * Attach shell: ` docker exec -it ros2_dev bash `
256+ * Source ROS 2 and workspace: ` source /opt/ros/humble/setup.bash && source /root/LEARN/install/setup.bash `
257+ * Build: ` colcon build `
258+ * Run nodes with ` ros2 run ` or ` ros2 launch `
260259
261260---
262261
263- ## 🧭 Alternative installation methods on Manjaro
262+ ## 🧭 Alternative Installation Methods on Manjaro
264263
265- 1 . ** AUR packages** – search for ` ros-humble-* ` packages in AUR . Good for quick native installs but may require maintenance.
266- 2 . ** Source build** – follow official ROS 2 instructions to build from source. This is useful if you need bleeding-edge patches or custom core changes.
264+ * ** AUR packages** – e.g., ` yay -S ros-humble-desktop ` . Good for native installs but may require maintenance on rolling distributions .
265+ * ** Source build** – follow the official ROS 2 instructions to build from source. Useful for bleeding-edge patches or custom core changes.
267266
268267---
269268
270- ## 🛠 Tips & troubleshooting
269+ ## 🛠 Tips & Troubleshooting
271270
272- - ` nvidia-smi ` not visible in container: ensure ` nvidia-container-toolkit ` is installed and ` docker run --gpus all ` works.
273- - Permission issues with Docker: add your user to the ` docker ` group or use ` sudo ` for Docker commands.
274- - ` DISPLAY ` issues for GUI apps: ensure X11 socket is mounted (` /tmp/.X11-unix ` ) and ` xhost +local:root ` (or better: more secure alternatives ).
275- - If ` colcon build ` fails: check package ` package.xml ` and ` CMakeLists.txt ` for missing dependencies, and ` rosdep ` can help install OS dependencies.
271+ * ** GPU not visible in container:** ensure ` nvidia-container-toolkit ` is installed and ` docker run --gpus all ... ` works.
272+ * ** Docker permission issues: ** add your user to the ` docker ` group or use ` sudo ` for Docker commands.
273+ * ** GUI apps not showing: ** mount the X11 socket (` /tmp/.X11-unix ` ) and run ` xhost +local:root ` (or a more secure alternative ).
274+ * ** colcon build failures: ** verify ` package.xml ` and ` CMakeLists.txt ` for missing dependencies and use ` rosdep ` to install OS dependencies.
276275
277276---
278277
279- ## 🔗 Resources & further reading
278+ ## 🔗 Resources & Further Reading
280279
281- - ROS 2 official docs: [ https://docs.ros.org/en/humble/ ] ( https://docs.ros.org/en/humble/ )
282- - Colcon build tool: [ https://colcon.readthedocs.io/ ] ( https://colcon.readthedocs.io/ )
283- - NVIDIA Container Toolkit: [ https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/ ] ( https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/ )
284- - ROS 2 tutorials (beginner-friendly )
280+ * ROS 2 official docs: [ https://docs.ros.org/en/humble/ ] ( https://docs.ros.org/en/humble/ )
281+ * Colcon build tool: [ https://colcon.readthedocs.io/ ] ( https://colcon.readthedocs.io/ )
282+ * NVIDIA Container Toolkit: [ https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/ ] ( https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/ )
283+ * ROS 2 tutorials: [ https://docs.ros.org/en/humble/Tutorials.html ] ( https://docs.ros.org/en/humble/Tutorials.html )
285284
286285---
287286
288287## 🤝 Contributing
289288
290- Feel free to open issues or PRs if you have suggestions, updates for newer ROS 2 distributions or better Docker setups.
289+ Feel free to open issues or PRs if you have suggestions, updates for newer ROS 2 distributions, or improved Docker setups.
291290
292291---
293292
@@ -296,3 +295,4 @@ Feel free to open issues or PRs if you have suggestions, updates for newer ROS 2
296295Licensed under the ** Apache-2.0** License.
297296
298297---
298+
0 commit comments