Inital Setup for Tutorial¶
Prerequisites¶
Common:
- Git
- A Linux environment (Ubuntu recommended)
There are 2 way to do it:
1. Without Using docker¶
gazebo-sim-plugins-tutorial github
gazebo-sim-plugins-tutorial/
├── standalone_gz_sim_plugins/
│ ├── plugin_name_1/ # Standalone Gazebo Sim system plugin
│ ├── plugin_name_2/ # Standalone Gazebo Sim system plugin
│ └── ... # More standalone plugins
│
├── ros2_ws/
│ ├── src/
│ │ ├── yt_tutorial_gazebo_ros/ # ROS 2 Gazebo launch & integration
│ │ └── tutorial_gazebo_plugins/ # ROS 2 Gazebo plugins
│ └── ... # ROS 2 build, install, log folders
│
└── README.md
Needed¶
- ROS 2 installed on host
- Gazebo Sim installed on host
- Build tools (CMake / make)
- colcon (for ROS 2 workspace)
NOTE:
- Make sure you already have ROS 2 + Gazebo Sim installed on your system.
- The main difference vs Docker is simply where your X path points.
Clone:
git clone https://github.com/Hrithik-verma/gazebo-sim-plugins-tutorial.git
cd gazebo-sim-plugins-tutorial
Build & Run¶
A) Standalone Gazebo Sim Plugins¶
1) Go to a standalone plugin folder:
2) Build:
3) Export plugin path (so Gazebo Sim can find it):
4) Launch Gazebo Sim with an SDF:
Notes: - "-v 4" prints debug logs (useful while developing) - If Gazebo can’t find the plugin, re-check GZ_SIM_SYSTEM_PLUGIN_PATH and that build succeeded.
B) ROS 2 Workspace (ros2_ws)¶
1) Go to the ROS 2 workspace:
2) Build ROS 2 packages:
3) Source the workspace:
4) Launch:
2. Using Docker¶
ros2-jazzy-gazebo-harmonic-docker github
ros2-jazzy-gazebo-harmonic-docker/
├──gazebo-sim-plugins-tutorial/ # other repo containing gazebo sim & ros2 launch
| ├─── standalone_gz_sim_plugins/
│ | ├── plugin_name_1/ # Standalone Gazebo Sim system plugin
│ | ├── plugin_name_2/ # Standalone Gazebo Sim system plugin
│ | └── ... # More standalone plugins
│ |
| ├── ros2_ws/
│ ├── src/
│ │ ├── yt_tutorial_gazebo_ros/ # ROS 2 Gazebo launch & integration
│ │ └── tutorial_gazebo_plugins/ # ROS 2 Gazebo plugins
│ └── ... # ROS 2 build, install, log folders
│
├── README.md
│
├── Dockerfile # docker file to make the docker image
├── docker-compose.yaml # docker container setup details
│
└── README.md
Clone¶
git clone https://github.com/Hrithik-verma/ros2-jazzy-gazebo-harmonic-docker.git
git submodule update --init --recursive
Docker Setup¶
Build the docker container
output:

[+] up 2/2ding layer 5f70bf18a086 32B / 32B 0.1s
✔ Image jazzy-gz-harmonic-full Built 323.2s
✔ Container gz-tutorial-container Created
```
check image
```bash
docker images
output:
it shows image we build using yt_tuturial_ws/Dockerfile
check image
output:
output current running container
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
61314940b998 jazzy-gz-harmonic-full "/ros_entrypoint.sh …" 10 minutes ago Up 10 minutes gz-tutorial-container
Run Container¶
Important: container need to have display access for gazebo gui, rviz gui
go inside the container
Check Container¶
To check if container is running or not. Container name not in the list that means it not running
start
stopDocker Volume Shared¶
In ros2-jazzy-gazebo-harmonic-docker/docker-compose.yaml
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- ./gazebo-sim-plugins-tutorial/ros2_ws:/root/ros2_ws
- ./gazebo-sim-plugins-tutorial/standalone_gz_sim_plugins:/root/standalone_gz_sim_plugins
X11: for display access
ros2_ws: entire ros2_ws is mounted inside root/ros2_ws. So any changes we make in ros2_ws will be reflected inside the container. standalone_gz_sim_plugins similary standalone_gz_sim_plugins is mounted inside root/standalone_gz_sim_plugins
Troubleshooting¶
GUI / Gazebo window not opening (Docker): - Ensure you ran: xhost + - Ensure DISPLAY is correctly passed into container (depends on your docker setup) - Display id is same in host & container host & docker container should have same id
if not export same display id in host & docker container