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 \
libglx-mesa0 \
libgl1-mesa-dri \
# NVIDIA/EGL/Wayland specific libraries
libnvidia-egl-wayland1 \
libglvnd0 \
libglx0 \
libegl1 \
mesa-utils \
x11-apps \
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:
# 1. gazebo - Gazebo Harmonic simulation (starts first)
# 2. sitl - ArduPilot SITL (waits for Gazebo)
# 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
# Reverted to Software Rendering (llvmpipe) to guarantee visible GUI.
# - GPU acceleration is notoriously unstable on NVIDIA+Wayland Docker.
# - This config ensures the simulation window works so mission logic can be tested.
# =============================================================================
# Common configuration anchor
x-common: &common
image: rdc-simulation:latest
build:
context: .
dockerfile: Dockerfile
# GPU support (NVIDIA)
# GPU Configuration: STRICT NVIDIA (2026 Guide)
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
count: 1
capabilities: [ gpu ]
# Environment variables - Wayland with GPU
environment:
# Wayland display
# Display Settings (PURE X11/XCB Bypass)
&common-env
- WAYLAND_DISPLAY=${WAYLAND_DISPLAY:-wayland-0}
- XDG_RUNTIME_DIR=/run/user/1000
# X11 fallback
- DISPLAY=${DISPLAY:-:0}
# GPU
- NVIDIA_VISIBLE_DEVICES=all
# Removed WAYLAND_DISPLAY to strictly force X11 path
# - 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
# Qt platform - Wayland
- QT_QPA_PLATFORM=wayland
- QT_WAYLAND_DISABLE_WINDOWDECORATION=1
# OpenGL settings
- __GLX_VENDOR_LIBRARY_NAME=nvidia
# Force NVIDIA EGL/GLX
- __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_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:
- ${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
# 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
# Host network for SITL <-> Gazebo communication
network_mode: host
# Run as user 1000
user: "1000:1000"
stdin_open: true
tty: true
working_dir: /home/pilot/RDC_Simulation
services:
# =========================================================================
# SERVICE 1: Gazebo Simulation (must start first)
# =========================================================================
# Service 1: Gazebo
gazebo:
<<: *common
container_name: rdc-gazebo
entrypoint: [ "/bin/bash", "-c" ]
command:
- |
echo "=========================================="
echo " SERVICE 1: Starting Gazebo Harmonic"
echo "=========================================="
echo "Starting Gazebo (Software Rendering)..."
source /opt/ros/jazzy/setup.bash
source ~/.bashrc
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
cd /home/pilot/RDC_Simulation
echo "Launching Gazebo world: iris_runway"
gz sim -r /home/pilot/ardupilot_gazebo/worlds/iris_runway.sdf
healthcheck:
test: [ "CMD-SHELL", "pgrep -x gz || exit 1" ]
interval: 5s
timeout: 10s
retries: 30
start_period: 30s
# =========================================================================
# SERVICE 2: ArduPilot SITL (waits for Gazebo)
# =========================================================================
# Service 2: SITL
sitl:
<<: *common
container_name: rdc-sitl
@@ -114,31 +100,13 @@ services:
entrypoint: [ "/bin/bash", "-c" ]
command:
- |
echo "=========================================="
echo " SERVICE 2: Starting ArduPilot SITL"
echo "=========================================="
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..."
echo "Waiting for Gazebo..."
for i in {1..60}; do nc -z localhost 9002 2>/dev/null && break; sleep 2; done
echo "Starting ArduPilot SITL..."
cd /home/pilot/ardupilot
sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --console --map
# =========================================================================
# SERVICE 3: Flight Controller (waits for SITL)
# =========================================================================
# Service 3: Controller
controller:
<<: *common
container_name: rdc-controller
@@ -148,56 +116,17 @@ services:
entrypoint: [ "/bin/bash", "-c" ]
command:
- |
echo "=========================================="
echo " SERVICE 3: Starting Flight Controller"
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..."
echo "Waiting for SITL..."
for i in {1..90}; do nc -z localhost 14550 2>/dev/null && break; sleep 2; done
sleep 10
echo "Starting flight controller with square pattern..."
echo "Starting Mission..."
source /home/pilot/RDC_Simulation/venv/bin/activate
cd /home/pilot/RDC_Simulation
python scripts/run_ardupilot.py --pattern square
# =========================================================================
# Interactive Shell (for debugging)
# =========================================================================
# Debug Shell
simulation:
<<: *common
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" ]
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