This repository sets up a complete Docker environment for running ArduPilot SITL (Software In The Loop) with ROS2. It is designed to provide a robust and flexible development environment, allowing seamless integration between ArduPilot, Gazebo, and ROS2.
Before using this setup, ensure that you have the following installed on your system:
- Docker: Install Docker using the instructions below.
- X11 for GUI applications: Required to run graphical applications inside the container (e.g., QGroundControl, Gazebo).
sudo apt update
sudo apt install -y ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo tee /etc/apt/keyrings/docker.gpg > /dev/null
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginTo enable Docker without sudo (optional):
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker-
Download and Install Docker Desktop
- Get Docker Desktop from Docker’s official website.
- Follow the installation guide: Windows Install Guide.
- During installation, enable WSL 2 Backend (recommended).
-
Verify Docker Installation
Open PowerShell and run:docker --versionIf Docker is installed correctly, this command will display the installed version.
-
Enable WSL Integration for Docker
- Open Docker Desktop on Windows.
- Go to Settings ⚙️ (click the gear icon).
- Navigate to Resources > WSL Integration.
- Find your Ubuntu distribution and toggle it ON.
- Click Apply & Restart.
-
Launch WSL and Verify Docker
Open PowerShell and start Ubuntu in WSL:wsl -d UbuntuOnce inside WSL, confirm that Docker is accessible:
docker --version
Now you’re ready to use Docker inside WSL! 🚀
If you want to skip building the image manually, you can pull the latest pre-built image from Docker Hub:
docker pull samuelteixeira1/caixinha:latestTo run the container:
docker run -it --runtime=runc \
--interactive --env=DISPLAY=$DISPLAY \
--env=QT_X11_NO_MITSHM=1 \
--volume=/tmp/.X11-unix:/tmp/.X11-unix:rw \
--volume=$HOME/.ssh:/home/ros/.ssh \
--name=caixinha_container \
samuelteixeira1/caixinha:latestgit clone https://github.com/SamuelTeixeira1/caixinha.git
cd caixinhadocker build --network=host -t caixinha .docker run -it --runtime=runc \
--interactive --env=DISPLAY=$DISPLAY \
--env=QT_X11_NO_MITSHM=1 \
--volume=/tmp/.X11-unix:/tmp/.X11-unix:rw \
--volume=$HOME/.ssh:/home/ros/.ssh \
--name=caixinha_container \
caixinhaOn Windows, add this:
export DISPLAY=:0To enter an already running container:
docker exec -it caixinha_container /bin/bashcd ~/ardu_ws/
colcon test --packages-select ardupilot_dds_testscd ~/ardu_ws
colcon build --packages-up-to ardupilot_sitl
colcon build --packages-up-to ardupilot_gz_bringupsource /opt/ros/humble/setup.bash
ros2 run demo_nodes_cpp talkerIn another terminal:
source /opt/ros/humble/setup.bash
ros2 run demo_nodes_py listenercd ~/ardupilot/ArduCopter
sim_vehicle.py -v ArduCopter --console --map -wcd ~/ardu_ws/
source install/setup.bash
ros2 launch ardupilot_gz_bringup iris_runway.launch.pycd ~
```bash
# Run QGroundControl directly from the AppImage
./QGroundControl.AppImage./QGroundControl.AppImage --appimage-extract ./squashfs-root/QGroundControl
## Additional Commands
Refer to [commands.txt](commands.txt) and [tests.txt](tests.txt) for more setup details.
## Contributions
Contributions are welcome! Feel free to open an issue or submit a pull request.