Ensure you have Docker installed on your system. You can follow the official installation guide:
Docker Installation Guide
For systems with NVIDIA GPUs, install the NVIDIA Container Toolkit (official installation guide):
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt update
sudo apt install -y nvidia-container-toolkit
sudo systemctl restart dockerDownload the prebuilt Docker image from Docker Hub:
docker image pull dierust/knr_ap_sim:latestFirst you should source your graphic session to docker:
echo "xhost +local:docker" >> ~/.bashrcNavigate to the docker/docker_ap directory and execute the setup script:
If your host has nvidia gpu:
cd docker/docker_ap
./setup_container_gpu.sh dierust/knr_ap_sim:latestIf your host doesnt have nvidia gpu:
cd docker/docker_ap
./setup_container_cpu.sh dierust/knr_ap_sim:latestOnce executed, you will be attached to the newly created Docker container.
Note:
In some cases, the provided setup scripts may not work correctly and the container might not mount thesrcdirectory as expected (for example, you see an empty container after runningls).
If this happens, you can start the container manually with the following command (replace/absolute/path/to/Dron_symulacja/srcwith the full path to yoursrcdirectory on your machine):docker run --gpus all -it --name knr_drone -v /absolute/path/to/Dron_symulacja/src:/root/ros_ws/src -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --device /dev/dri dierust/knr_ap_sim:latest
For systems without NVIDIA GPU, remove the `--gpus all` flag: ```bash docker run -it --name knr_drone -v /absolute/path/to/Dron_symulacja/src:/root/ros_ws/src -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --device /dev/dri dierust/knr_ap_sim:latest
Inside the container:
cd ~/ros_ws
colcon build
source install/setup.bashTo launch the Webots simulator along with required ROS2 packages:
ros2 launch drone_bringup drone_simulation.launch.pyTo start the ArduPilot SITL environment, open new terminal and run the following command outside the Docker container:
./run_ardupilot_sitl.shFirst run can take a while since ardupilot will build required components.
You have two options to control the drone:
- Option A – custom mission
Write your owntest_missionnode/script and run it using:./run_test_mission.sh
Press Ctrl + P then Ctrl + Q
docker attach knr_dronedocker start knr_dronedocker stop knr_drone- The
srcdirectory is shared between the host and the Docker container. In the container, it is located at~/ros_ws/src. - Your development code should be placed inside this directory to be visible in the container.
- After stopping the container, its memory persists. However, if the container is removed, all data outside the shared
srcdirectory will be lost. - Keep everything in the
srcdirectory to prevent data loss. - If you encounter any issues, contact: piotrek2995 / prujasiedomnie / DieRust on Discord.