feat: add drone (ArduPilot SITL + Gazebo) simulation - #77
Open
RadAlpaca11 wants to merge 2 commits into
Open
Conversation
Adds a `drone` option to `sim gazebo` for flying an S500-class quadcopter (ArduCopter SITL matching a Pixhawk 2.4.8) in Gazebo Harmonic via the ardupilot_gazebo plugin, flown through QGroundControl. - `sim gazebo setup-drone`: clones and builds ArduPilot SITL (pinned to Copter-4.3.7 to match real flight-controller firmware) and the ardupilot_gazebo plugin from source into .native/, separately from the Docker image. Handles several environment gaps along the way: Ubuntu 24.04 isn't supported by this ArduPilot release's own prereqs script, its vendored waf predates Python 3.12, and a couple of its C++ files need a missing standard header under GCC 13. - `gazebo/drone_description` / `gazebo/drone_bringup`: custom SDF world + launch file (not generated via the OnShape pipeline like arm/ chassis) that starts Gazebo and ArduCopter SITL together. The world needs the Imu/NavSat/Sensors system plugins and a <scene> element for the drone's IMU sensor to actually produce data, and the GUI runs in the same process as the server (`combined_gui`) since a split-process server has no render context for its Sensors system to use. - `robots.json` gains a `type` field to distinguish non-OnShape robots from the existing arm/chassis entries. - SITL's MAVLink output is pointed at the container's own default gateway (read from /proc/net/route at launch time) so QGroundControl, running on the host, can reach it - ArduPilot's serial-device parser has no listening/server UDP mode and can't resolve hostnames, so this has to be a real IP resolved on our side. - Also fixes two unrelated pre-existing bugs hit while getting this working: a stray backslash in docker-compose-gpu.yml's venv setup command that broke the NVIDIA devcontainer's `sim` install, and missing runtime dependencies (pypresence, trimesh, pyfqmr, requests) in pyproject.toml that only surfaced when installed into an isolated venv instead of system/pixi Python.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
droneoption to thesimCLI for flying an S500-class quadcopter(ArduCopter SITL simulating a Pixhawk 2.4.8) in Gazebo Harmonic via the
ardupilot_gazebo plugin,
flown through QGroundControl instead of RViz/Joint GUI.
(Documentation also added)
sim gazebo setup-drone— one-time build of ArduPilot SITL (pinned toCopter-4.3.7to match real flight-controller firmware) and theardupilot_gazeboplugin from source, kept separate from the Dockerimage build. Works around several environment gaps: Ubuntu 24.04 isn't
supported by this ArduPilot release's own prereqs script, its vendored
wafpredates Python 3.12, and a couple of its C++ files are missing astandard header under GCC 13.
gazebo/drone_description/gazebo/drone_bringup— hand-authored SDFworld + launch file (the drone isn't generated via the OnShape
pipeline like arm/chassis). Needs the
Imu/NavSat/Sensorssystemplugins plus a
<scene>element for the IMU sensor to actuallyproduce data, and runs Gazebo's server+GUI in a single process
(
combined_gui) since a split-process server has no render contextfor its Sensors system.
robots.jsongains atypefield to distinguish non-OnShape robots.(read from
/proc/net/routeat launch), since QGroundControl runs onthe host and ArduPilot's serial-device parser can't resolve hostnames
or listen for incoming connections.
stray backslash in
docker-compose-gpu.yml's venv setup command thatbroke the NVIDIA devcontainer's
simCLI install, and missing runtimedependencies (
pypresence,trimesh,pyfqmr,requests) inpyproject.tomlthat only surfaced in an isolated venv rather thansystem/pixi Python.
Setup required (documented in
docs/gazebo/drone.mdx)sim gazebo setup-droneonce before the drone sim workssudo ufw allow 14550/udp) -QGroundControl and SITL communicate directly over the host network
Test plan
sim gazebo setup-dronebuilds ArduCopter SITL + the pluginsim gazebo dronerenders the quadcopter in Gazebosim gazebo arm/sim gazebo chassisare unaffected (regression check)