Skip to content

#87 39b: MAVLink bridge — ARM intercept + AUT enforcement - #89

Merged
dvdthecoder merged 2 commits into
masterfrom
rb-87b-mavlink-arm-intercept
Mar 25, 2026
Merged

dvdthecoder merged 2 commits into
masterfrom
rb-87b-mavlink-arm-intercept

Conversation

@dvdthecoder

Copy link
Copy Markdown
Collaborator

Summary

Extends the MAVLink bridge with ARM enforcement: when --require-aut is set, ARM commands are checked against the flight-auth API and immediately reversed if no active AUT is found.

Changes

bridge.py:

  • _on_command_long() — intercepts MAV_CMD_COMPONENT_ARM_DISARM (arm only; disarm passes through)
  • _has_active_aut() — calls GET /airspaceUsageToken/find with PUSHPAKA_TOKEN; returns True if any AUT is CREATED or INUSE
  • _send_disarm() — sends MAV_CMD_COMPONENT_ARM_DISARM param1=0 + force-disarm magic number to SITL
  • --require-aut CLI flag; PUSHPAKA_TOKEN env var
  • HEARTBEAT handler extended to log armed/disarmed transitions
  • Fail-safe: ARM blocked if token absent or flight-auth unreachable

README.md: updated with --require-aut usage and enforcement behaviour table

Enforcement table

Condition Result
Active AUT (CREATED/INUSE) ARM passes through
No active AUT Immediate DISARM sent to SITL
Token missing ARM blocked (fail-safe)
flight-auth unreachable ARM blocked (fail-safe)

Test plan

  • python3 bridge.py --help shows --require-aut
  • Without --require-aut: ARM commands pass through unaffected
  • With --require-aut + valid token + active AUT: ARM passes
  • With --require-aut + valid token + no AUT: DISARM sent, logged
  • With --require-aut + no token: ARM blocked, warning logged

🤖 Generated with Claude Code

Abhishek Dwivedi and others added 2 commits March 25, 2026 14:48
On COMMAND_LONG MAV_CMD_COMPONENT_ARM_DISARM (param1=1):
- With --require-aut: calls GET /airspaceUsageToken/find with PUSHPAKA_TOKEN
- If any AUT in CREATED or INUSE state → ARM passes through
- Otherwise → sends immediate DISARM to SITL (reactive, same as QGC #76)
- Fail-safe: ARM blocked if token missing or flight-auth unreachable
- HEARTBEAT handler extended to log armed/disarmed state transitions

README updated with --require-aut usage and enforcement behaviour table.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- .github/workflows/python-ci.yml: triggers on sitl-bridge/** changes;
  runs ruff check + ruff format --check on Python 3.11
- sitl-bridge/pyproject.toml: ruff config (target py311, line-length 100,
  E/F/W/I rules)
- sitl-bridge/bridge.py: auto-formatted to pass ruff format --check

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dvdthecoder
dvdthecoder merged commit 6885c97 into master Mar 25, 2026
1 check 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