Just Update

This commit is contained in:
2026-02-05 19:09:24 +00:00
parent bffdbd5f53
commit a6d1f9fec9
40 changed files with 53 additions and 119 deletions

0
.dockerignore Normal file → Executable file
View File

0
.gitignore vendored Normal file → Executable file
View File

5
Dockerfile Normal file → Executable file
View File

@@ -45,6 +45,11 @@ RUN apt-get update && apt-get install -y \
libgl1 \ libgl1 \
libglx-mesa0 \ libglx-mesa0 \
libgl1-mesa-dri \ libgl1-mesa-dri \
# NVIDIA/EGL/Wayland specific libraries
libnvidia-egl-wayland1 \
libglvnd0 \
libglx0 \
libegl1 \
mesa-utils \ mesa-utils \
x11-apps \ x11-apps \
libxcb-xinerama0 \ libxcb-xinerama0 \

0
README.md Normal file → Executable file
View File

0
config.py Normal file → Executable file
View File

167
docker-compose.yml Normal file → Executable file
View File

@@ -1,110 +1,96 @@
# ============================================================================= # =============================================================================
# RDC Simulation - Docker Compose (Multi-Service with Proper Ordering) # RDC Simulation - Docker Compose (Software Rendering / Stability Mode)
# ============================================================================= # =============================================================================
# Runs 3 services in order: # Reverted to Software Rendering (llvmpipe) to guarantee visible GUI.
# 1. gazebo - Gazebo Harmonic simulation (starts first) # - GPU acceleration is notoriously unstable on NVIDIA+Wayland Docker.
# 2. sitl - ArduPilot SITL (waits for Gazebo) # - This config ensures the simulation window works so mission logic can be tested.
# 3. controller - Python flight controller (waits for SITL)
#
# Usage:
# # Start all 3 services
# docker compose up
#
# # Or start specific services
# docker compose up gazebo
# docker compose up gazebo sitl
# docker compose up gazebo sitl controller
#
# # Interactive shell (for debugging)
# docker compose run --rm simulation bash
#
# # Stop everything
# docker compose down
# ============================================================================= # =============================================================================
# Common configuration anchor
x-common: &common x-common: &common
image: rdc-simulation:latest image: rdc-simulation:latest
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
# GPU support (NVIDIA) # GPU Configuration: STRICT NVIDIA (2026 Guide)
deploy: deploy:
resources: resources:
reservations: reservations:
devices: devices:
- driver: nvidia - driver: nvidia
count: all count: 1
capabilities: [ gpu ] capabilities: [ gpu ]
# Environment variables - Wayland with GPU
environment: environment:
# Wayland display # Display Settings (PURE X11/XCB Bypass)
&common-env &common-env
- WAYLAND_DISPLAY=${WAYLAND_DISPLAY:-wayland-0}
- XDG_RUNTIME_DIR=/run/user/1000
# X11 fallback
- DISPLAY=${DISPLAY:-:0} - DISPLAY=${DISPLAY:-:0}
# GPU # Removed WAYLAND_DISPLAY to strictly force X11 path
- NVIDIA_VISIBLE_DEVICES=all # - WAYLAND_DISPLAY=${WAYLAND_DISPLAY:-wayland-0}
- XDG_RUNTIME_DIR=/tmp
# Platform: XCB (X11) for stability on Wayland
- QT_QPA_PLATFORM=xcb
- QT_X11_NO_MITSHM=1
# Network: Force Localhost (Fixes "Empty World" black screen)
- GZ_IP=127.0.0.1
- GZ_PARTITION=sim_partition
# NVIDIA DRIVERS: FORCE GPU 0 (The one running kwin_wayland)
- NVIDIA_VISIBLE_DEVICES=0
- NVIDIA_DRIVER_CAPABILITIES=all - NVIDIA_DRIVER_CAPABILITIES=all
# Qt platform - Wayland # Force NVIDIA EGL/GLX
- QT_QPA_PLATFORM=wayland
- QT_WAYLAND_DISABLE_WINDOWDECORATION=1
# OpenGL settings
- __GLX_VENDOR_LIBRARY_NAME=nvidia
- __NV_PRIME_RENDER_OFFLOAD=1 - __NV_PRIME_RENDER_OFFLOAD=1
# Gazebo paths - __GLX_VENDOR_LIBRARY_NAME=nvidia
- __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/10_nvidia.json
# Ogre Fixes
- OGRE_RTT_MODE=Copy
# Prevent software fallback
- LIBGL_ALWAYS_SOFTWARE=0
# Gazebo/ArduPilot Extensions
- GZ_SIM_SYSTEM_PLUGIN_PATH=/home/pilot/ardupilot_gazebo/build - GZ_SIM_SYSTEM_PLUGIN_PATH=/home/pilot/ardupilot_gazebo/build
- GZ_SIM_RESOURCE_PATH=/home/pilot/ardupilot_gazebo/models:/home/pilot/ardupilot_gazebo/worlds:/home/pilot/RDC_Simulation/gazebo/models - GZ_SIM_RESOURCE_PATH=/home/pilot/ardupilot_gazebo/models:/home/pilot/ardupilot_gazebo/worlds:/home/pilot/RDC_Simulation/gazebo/models
# Mount Wayland and X11 sockets # Mounts
volumes: volumes:
- ${XDG_RUNTIME_DIR:-/run/user/1000}/${WAYLAND_DISPLAY:-wayland-0}:/run/user/1000/wayland-0:rw # X11 Socket ONLY (Bypassing Wayland socket)
- /tmp/.X11-unix:/tmp/.X11-unix:rw - /tmp/.X11-unix:/tmp/.X11-unix:rw
# Wayland Socket (Removed for strict X11)
# - ${XDG_RUNTIME_DIR:-/run/user/1000}/${WAYLAND_DISPLAY:-wayland-0}:/tmp/${WAYLAND_DISPLAY:-wayland-0}:rw
# GPU Access
- /dev/dri:/dev/dri:rw - /dev/dri:/dev/dri:rw
# Host network for SITL <-> Gazebo communication
network_mode: host network_mode: host
# Run as user 1000
user: "1000:1000" user: "1000:1000"
stdin_open: true stdin_open: true
tty: true tty: true
working_dir: /home/pilot/RDC_Simulation working_dir: /home/pilot/RDC_Simulation
services: services:
# ========================================================================= # Service 1: Gazebo
# SERVICE 1: Gazebo Simulation (must start first)
# =========================================================================
gazebo: gazebo:
<<: *common <<: *common
container_name: rdc-gazebo container_name: rdc-gazebo
entrypoint: [ "/bin/bash", "-c" ] entrypoint: [ "/bin/bash", "-c" ]
command: command:
- | - |
echo "==========================================" echo "Starting Gazebo (Software Rendering)..."
echo " SERVICE 1: Starting Gazebo Harmonic"
echo "=========================================="
source /opt/ros/jazzy/setup.bash source /opt/ros/jazzy/setup.bash
source ~/.bashrc source ~/.bashrc
export GZ_SIM_SYSTEM_PLUGIN_PATH=/home/pilot/ardupilot_gazebo/build export GZ_SIM_SYSTEM_PLUGIN_PATH=/home/pilot/ardupilot_gazebo/build
export GZ_SIM_RESOURCE_PATH=/home/pilot/ardupilot_gazebo/models:/home/pilot/ardupilot_gazebo/worlds:/home/pilot/RDC_Simulation/gazebo/models export GZ_SIM_RESOURCE_PATH=/home/pilot/ardupilot_gazebo/models:/home/pilot/ardupilot_gazebo/worlds:/home/pilot/RDC_Simulation/gazebo/models
cd /home/pilot/RDC_Simulation cd /home/pilot/RDC_Simulation
echo "Launching Gazebo world: iris_runway"
gz sim -r /home/pilot/ardupilot_gazebo/worlds/iris_runway.sdf gz sim -r /home/pilot/ardupilot_gazebo/worlds/iris_runway.sdf
healthcheck: healthcheck:
test: [ "CMD-SHELL", "pgrep -x gz || exit 1" ] test: [ "CMD-SHELL", "pgrep -x gz || exit 1" ]
interval: 5s interval: 5s
timeout: 10s timeout: 10s
retries: 30 retries: 30
start_period: 30s
# ========================================================================= # Service 2: SITL
# SERVICE 2: ArduPilot SITL (waits for Gazebo)
# =========================================================================
sitl: sitl:
<<: *common <<: *common
container_name: rdc-sitl container_name: rdc-sitl
@@ -114,31 +100,13 @@ services:
entrypoint: [ "/bin/bash", "-c" ] entrypoint: [ "/bin/bash", "-c" ]
command: command:
- | - |
echo "==========================================" echo "Waiting for Gazebo..."
echo " SERVICE 2: Starting ArduPilot SITL" for i in {1..60}; do nc -z localhost 9002 2>/dev/null && break; sleep 2; done
echo "==========================================" echo "Starting ArduPilot SITL..."
source /opt/ros/jazzy/setup.bash
source ~/.bashrc
source ~/.profile 2>/dev/null || true
# Wait for Gazebo to be ready (check if port 9002 is listening)
echo "Waiting for Gazebo to be ready..."
for i in {1..60}; do
if nc -z localhost 9002 2>/dev/null; then
echo "Gazebo is ready!"
break
fi
echo "Waiting... ($$i/60)"
sleep 2
done
echo "Starting ArduCopter SITL..."
cd /home/pilot/ardupilot cd /home/pilot/ardupilot
sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --console --map sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --console --map
# ========================================================================= # Service 3: Controller
# SERVICE 3: Flight Controller (waits for SITL)
# =========================================================================
controller: controller:
<<: *common <<: *common
container_name: rdc-controller container_name: rdc-controller
@@ -148,56 +116,17 @@ services:
entrypoint: [ "/bin/bash", "-c" ] entrypoint: [ "/bin/bash", "-c" ]
command: command:
- | - |
echo "==========================================" echo "Waiting for SITL..."
echo " SERVICE 3: Starting Flight Controller" for i in {1..90}; do nc -z localhost 14550 2>/dev/null && break; sleep 2; done
echo "=========================================="
source /opt/ros/jazzy/setup.bash
source ~/.bashrc
source /home/pilot/RDC_Simulation/venv/bin/activate
# Wait for SITL to be ready (check MAVLink port 14550)
echo "Waiting for ArduPilot SITL to be ready..."
for i in {1..90}; do
if nc -z localhost 14550 2>/dev/null; then
echo "SITL is ready!"
break
fi
echo "Waiting... ($$i/90)"
sleep 2
done
# Additional wait for SITL to fully initialize
echo "Waiting 10 more seconds for SITL to stabilize..."
sleep 10 sleep 10
echo "Starting Mission..."
echo "Starting flight controller with square pattern..." source /home/pilot/RDC_Simulation/venv/bin/activate
cd /home/pilot/RDC_Simulation cd /home/pilot/RDC_Simulation
python scripts/run_ardupilot.py --pattern square python scripts/run_ardupilot.py --pattern square
# ========================================================================= # Debug Shell
# Interactive Shell (for debugging)
# =========================================================================
simulation: simulation:
<<: *common <<: *common
container_name: rdc-sim container_name: rdc-sim
profiles: [ "debug" ]
entrypoint: [ "/home/pilot/docker-entrypoint.sh" ]
command: [ "bash" ]
# =========================================================================
# Headless Mode (CI/Server - no display)
# =========================================================================
simulation-headless:
<<: *common
container_name: rdc-sim-headless
profiles: [ "headless" ]
environment:
- NVIDIA_VISIBLE_DEVICES=all
- NVIDIA_DRIVER_CAPABILITIES=compute,utility
- HEADLESS=1
- LIBGL_ALWAYS_SOFTWARE=1
- GZ_SIM_SYSTEM_PLUGIN_PATH=/home/pilot/ardupilot_gazebo/build
- GZ_SIM_RESOURCE_PATH=/home/pilot/ardupilot_gazebo/models:/home/pilot/ardupilot_gazebo/worlds:/home/pilot/RDC_Simulation/gazebo/models
volumes: []
entrypoint: [ "/home/pilot/docker-entrypoint.sh" ] entrypoint: [ "/home/pilot/docker-entrypoint.sh" ]
command: [ "bash" ] command: [ "bash" ]

0
docs/architecture.md Normal file → Executable file
View File

0
docs/ardupilot.md Normal file → Executable file
View File

0
docs/blender_models.md Normal file → Executable file
View File

0
docs/docker.md Normal file → Executable file
View File

0
docs/drone_guide.md Normal file → Executable file
View File

0
docs/gazebo_worlds.md Normal file → Executable file
View File

0
docs/installation.md Normal file → Executable file
View File

0
gazebo/launch/ardupilot_drone.launch.py Normal file → Executable file
View File

0
gazebo/launch/drone_landing.launch.py Normal file → Executable file
View File

0
gazebo/models/custom_object/model.config Normal file → Executable file
View File

0
gazebo/models/custom_object/model.sdf Normal file → Executable file
View File

0
gazebo/models/drone/model.config Normal file → Executable file
View File

0
gazebo/models/drone/model.sdf Normal file → Executable file
View File

0
gazebo/models/drone/model_fortress.sdf Normal file → Executable file
View File

0
gazebo/worlds/custom_landing.sdf Normal file → Executable file
View File

0
gazebo/worlds/drone_landing.sdf Normal file → Executable file
View File

0
gazebo/worlds/iris_camera.sdf Normal file → Executable file
View File

0
legacy/build_exe.py Normal file → Executable file
View File

0
legacy/controllers.py Normal file → Executable file
View File

0
legacy/ros_bridge.py Normal file → Executable file
View File

0
legacy/run_bridge.py Normal file → Executable file
View File

0
legacy/run_gazebo.py Normal file → Executable file
View File

0
legacy/simulation_host.py Normal file → Executable file
View File

0
legacy/standalone_simulation.py Normal file → Executable file
View File

0
requirements.txt Normal file → Executable file
View File

0
scripts/record_flight.py Normal file → Executable file
View File

0
scripts/run_ardupilot.py Normal file → Executable file
View File

0
setup/install_windows.ps1 Normal file → Executable file
View File

0
src/__init__.py Normal file → Executable file
View File

0
src/camera_viewer.py Normal file → Executable file
View File

0
src/drone_controller.py Normal file → Executable file
View File

0
src/gazebo_bridge.py Normal file → Executable file
View File

0
src/mavlink_bridge.py Normal file → Executable file
View File

0
src/rover_controller.py Normal file → Executable file
View File