- π³ Pre-configured Docker environment with ROS2 Humble
- π©οΈ ArduPilot SITL (Software In The Loop) integration
- π Gazebo Harmonic for simulation
- π ArduPilot-Gazebo plugins and integration
- π‘ DDS middleware for ArduPilot communication
- ποΈ Ready-to-use development workspace
- π» Visual Studio Code DevContainer support for seamless development
- π³ Docker installed on your system
- π Docker Compose installed on your system
- π₯οΈ X11 server running for GUI applications (on Linux this is normally running by default)
- π» Visual Studio Code with Remote - Containers extension (for DevContainer support)
-
Clone this repository:
git clone https://github.com/Jagadeesh-pradhani/ROS2_ardupilot_Iris_docker.git cd ardupilot-ros2-docker
-
Build and start the container:
docker compose build docker compose up -d
-
Connect to the container:
docker compose exec ardupilot_ros bash
OR
-
Pull docker image:
docker pull ghcr.io/jagadeesh-pradhani/ros2_ardupilot_iris_docker:main
- Install the "Remote - Containers" extension in VS Code
- Clone this repository and open it in VS Code
- Click on the green button in the bottom-left corner of VS Code
- Select "Reopen in Container" from the menu
- VS Code will build the container and open it automatically
The DevContainer configuration is located in the .devcontainer
directory, containing:
devcontainer.json
: Configuration for VS Code integrationdocker-compose.yml
: Container configuration for the development environment
.
βββ bashrc # Custom bashrc for the container
βββ docker-compose.yml # Docker Compose configuration
βββ Dockerfile # Docker image definition
βββ entrypoint.sh # Container entrypoint script
βββ install-prereqs-ubuntu.sh # ArduPilot prerequisites installer
βββ instruction.sh # Additional instructions
βββ ros2_gz.repos # ROS2 Gazebo repos file
βββ ros2.repos # ROS2 repos file
βββ workspace # Shared workspace directory
βββ .devcontainer/ # VS Code DevContainer configuration
βββ devcontainer.json
βββ docker-compose.yml
The container includes a helper script ~/Ardupilot_ROS.sh
that provides various testing commands for ArduPilot SITL and ROS2 integration.
Run the following commands to test SITL with different options. After running, close all processes cleanly using Ctrl+C:
# Basic ArduCopter simulation
cd ~/ardupilot
./sim_vehicle.py -v ArduCopter -w
# ArduCopter with console and map
./sim_vehicle.py -v ArduCopter --console --map
# ArduCopter at San Francisco International Airport
./sim_vehicle.py -v ArduCopter -L KSFO --console --map
# ArduCopter in quadcopter configuration with console, map, and OSD
./sim_vehicle.py -v ArduCopter -f quadcopter --console --map --osd
# Launch ROS2 with SITL using DDS over UDP
cd ~/ros2_ws
source install/setup.bash
ros2 launch ardupilot_sitl sitl_dds_udp.launch.py transport:=udp4 refs:=$(ros2 pkg prefix ardupilot_sitl)/share/ardupilot_sitl/config/dds_xrce_profile.xml synthetic_clock:=True wipe:=False model:=quad speedup:=1 slave:=0 instance:=0 defaults:=$(ros2 pkg prefix ardupilot_sitl)/share/ardupilot_sitl/config/default_params/copter.parm,$(ros2 pkg prefix ardupilot_sitl)/share/ardupilot_sitl/config/default_params/dds_udp.parm sim_address:=127.0.0.1 master:=tcp:127.0.0.1:5760 sitl:=127.0.0.1:5501
Terminal 1 (Launch the container with display support):
docker run -it --user ros --network=host --ipc=host -v /tmp/.X11-unix:/tmp/.X11-unix:rw --env=DISPLAY ros_humble
cd ~/ros2_ws
source install/setup.bash
ros2 launch ardupilot_gz_bringup iris_runway.launch.py
Terminal 2 (Connect to the running container):
docker exec -it [container_name] /bin/bash
mavproxy.py --console --map --aircraft test --master=:14550
Note: Replace [container_name] with the actual container name.
The workspace comes pre-built, but if you need to rebuild:
cd ~/ros2_ws
colcon test --packages-select ardupilot_dds_tests
colcon build --packages-up-to ardupilot_sitl
colcon build --packages-up-to ardupilot_gz_bringup
source install/setup.bash
The Docker container includes:
- π€ ROS2 Humble Desktop
- π Gazebo Harmonic
- π ArduPilot source code with SITL capabilities
- π‘ MAVProxy
- π Micro-XRCE-DDS-Gen for DDS communication
- π¦ All ROS2 packages needed for ArduPilot-ROS2 integration
- π ROS2-Gazebo bridges and plugins
-
Source the workspace: Always remember to source the workspace setup file before running ROS2 commands:
source ~/ros2_ws/install/setup.bash
-
Customizing ArduPilot parameters: You can modify the default parameters in the
ros2_ws/src/ardupilot_sitl/config/default_params/
directory. -
Using tmuxinator: A tmuxinator configuration is included for managing multiple terminal sessions:
tmuxinator start -p ~/tmuxinator.yml
-
Debugging: To debug ROS2 nodes, you can use:
ros2 run --prefix 'gdb -ex run --args' package_name node_name
You can modify the Dockerfile
to add additional dependencies or change the build configuration.
-
β X11 Display Issues: If GUI applications don't appear, check that your X11 server is properly configured. You may need to run
xhost +local:docker
on the host. -
β οΈ Permission Issues: Ensure the USER_UID and USER_GID in the docker-compose.yml match your host system:echo "UID: $(id -u), GID: $(id -g)"
-
π DevContainer Issues: Check that your Docker is properly configured and that the Remote - Containers extension is up to date.
-
π¦ ROS2 Package Not Found: If you get package not found errors, make sure you've sourced the workspace:
source ~/ros2_ws/install/setup.bash
-
π Gazebo Models Not Loading: Set the GAZEBO_MODEL_PATH environment variable:
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:~/ros2_ws/src/ardupilot_gz/models
-
ardupilot_gazebo package not built: Solution:
cd ~/ros2_ws rm -rf build/ardupilot_gazebo/ rm -rf install/ardupilot_gazebo/
colcon build --packages-select ardupilot_gazebo
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- π ArduPilot - ArduPilot project
- π€ ROS2 - ROS2 Humble documentation
- π Gazebo - Gazebo simulation platform
- π ArduPilot-Gazebo-ROS2 Integration - ArduPilot Gazebo integration