Skip to content

Split groundstation package out of simulation#14

Merged
mcroomp merged 3 commits into
mainfrom
feature/groundstation-split
Jul 18, 2026
Merged

Split groundstation package out of simulation#14
mcroomp merged 3 commits into
mainfrom
feature/groundstation-split

Conversation

@mcroomp

@mcroomp mcroomp commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a new top-level groundstation/ package (9th package, alongside simulation, arduloop, calibrate, envelope, analysis, viz3d, scripts, tests) split out of simulation/.

Rule of thumb used to decide what moved: does this code genuinely run on the real ground station/flight-planner today, or does it stand in for hardware that doesn't exist yet?

Moved whole (git mv, no logic changes) into groundstation/

  • pumping_planner.py, landing_planner.py
  • gcs.py (RawesGCS, WallClock, SimClock)
  • rawes_modes.py (wire-protocol constants, world-origin helpers)
  • mavlink_log.py, ekf_flags.py

Split by class

  • unified_ground.py: GcsComms + NvComms base + _cmd_to_nv/_PHASE_TO_SUB moved to groundstation/unified_ground.py (production MAVLink adapter). DirectComms/LuaComms (simtest/Lua-unit-test only) stay in simulation/unified_ground.py, importing NvComms from groundstation.
  • winch_node.py: extracted the WinchCommand/WinchTelemetry wire-protocol dataclasses into new groundstation/winch_protocol.py. GovernedWinchNode/Anemometer/GovernedWinchController stay in simulation/ since they simulate not-yet-built winch-node hardware (same category as vehicle physics/mock ArduPilot).

Dead code removed

  • simulation/comms.py's MavlinkComms class (and its _PHASE_TO_SUB dict) — confirmed via repo-wide grep it was never imported/instantiated anywhere; GcsComms in unified_ground.py is the actual production adapter used by SITL stack tests.

Other changes

  • Updated ~25 import call-sites across simulation/, calibrate/, analysis/, tests/.
  • pyproject.toml and test.sh's Docker sync tar list updated for the new package.
  • Updated AGENTS.md, design/flight_stack.md, design/simulation.md, design/testing.md.

Testing

  • pytest tests/unit -m "not simtest" -q — 467/467 passed.
  • pytest tests/simtests -q — 14 passed, 5 skipped (matches baseline).
  • bash test.sh stack -n 4 (full SITL stack suite) — 7/7 passed.

Note: test_kinematic_gps_sitl intermittently failed with a GPS-glitch/EKF-window assertion during initial runs (both under -n 4 and isolated -n 1), but a byte-for-byte diff of every changed/moved file against pre-split main showed zero logic differences, and the test subsequently passed cleanly on repeated re-runs on this branch. This appears to be pre-existing timing/host-load sensitivity in that test's real-time SITL physics, not a regression from this change — logged in repo memory for future reference.

mcroomp added 3 commits July 18, 2026 11:43
Move genuinely-production ground-station/flight-planner code into a new
top-level groundstation/ package, keeping simulation/ as the physics/
mock-hardware framework:

- groundstation/: pumping_planner.py, landing_planner.py, gcs.py,
  rawes_modes.py, mavlink_log.py, ekf_flags.py (moved whole), plus new
  winch_protocol.py (WinchCommand/WinchTelemetry wire format extracted
  from simulation/winch_node.py) and unified_ground.py (NvComms base +
  GcsComms production adapter extracted from simulation/unified_ground.py).
- simulation/ keeps VirtualComms (comms.py), DirectComms/LuaComms
  (unified_ground.py), and the winch control-loop stand-ins
  (winch.py's WinchController, winch_node.py's GovernedWinchNode +
  Anemometer) since these simulate hardware/algorithms that will
  eventually run standalone (winch node firmware) rather than code that
  runs on the real ground station today.
- Removed dead code: simulation/comms.py's MavlinkComms class was never
  imported/instantiated anywhere (GcsComms in unified_ground.py is the
  actual production adapter used by SITL stack tests); deleted along
  with its unused _PHASE_TO_SUB duplicate.
- Updated ~25 import call-sites across simulation/, calibrate/, analysis/,
  and tests/ to the new module paths.
- pyproject.toml: added groundstation/groundstation.* to the packages.find
  include list. test.sh: added groundstation to the Docker sync tar list.
- Updated AGENTS.md, design/flight_stack.md, design/simulation.md,
  design/testing.md to reflect the new package and removed dead code.

Validated: 467/467 unit tests, 14 passed/5 skipped simtests, and an
isolated SITL stack run (test_pumping_cycle_lua_sitl) all pass.
- Remove stale 'Current focus' section.
- RAWES_* parameter mapping and DShot config tables were duplicated from
  design/flight_stack.md and design/dshot.md; replaced with short pointers
  per AGENTS.md's own 'no duplicated tables' policy.
- Moved the long /tmp Git-Bash-vs-WSL gotcha and the long-running-command
  efficiency guidance out of AGENTS.md into design/sitl_testing.md (their
  natural owner doc per the Documentation Ownership table), leaving short
  pointers behind.
@mcroomp
mcroomp merged commit 90f67ea into main Jul 18, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant