Skip to content

Commit 1d095e2

Browse files
phase 29: add px4 sitl integration
1 parent 7a0b6f3 commit 1d095e2

50 files changed

Lines changed: 2195 additions & 113 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ summary.md
1919
.aegis/last.tmp
2020
.aegis/last.tmp.*
2121
.aegis/sessions/
22+
.aegis/edge/

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ Aegis is not a SaaS product, hosted dashboard, monetization layer, or telemetry
1212

1313
## Product Split
1414

15-
Phase 23 introduced the monorepo product contract. Phase 24 hardened Aegis Core as the shared engine facade used by CLI and Edge. Phase 25 keeps the CLI as the stable desktop and CI product while hardening the post-split command surface. Phase 26 added Edge domain and safety schema contracts. Phase 27 added local Edge policy evaluation. Phase 28 adds a MAVLink gateway foundation for fake/in-memory protocol mediation:
15+
Phase 23 introduced the monorepo product contract. Phase 24 hardened Aegis Core as the shared engine facade used by CLI and Edge. Phase 25 keeps the CLI as the stable desktop and CI product while hardening the post-split command surface. Phase 26 added Edge domain and safety schema contracts. Phase 27 added local Edge policy evaluation. Phase 28 added a MAVLink gateway foundation for fake/in-memory protocol mediation. Phase 29 adds PX4 SITL integration for opt-in local simulation evidence:
1616

1717
- **Aegis Core** (`packages/core/`): shared policy, decision, audit, event, schema, replay, redaction, fixture, red-team, capability, experimental ABI skeleton, and platform-independent utility contracts.
1818
- **Aegis CLI** (`packages/cli/`): the existing desktop and CI AI-agent runtime firewall exposed as the `aegis` binary.
19-
- **Aegis Edge** (`packages/edge/`): a drone and robotics safety-policy and audit runtime with local policy decisions and Phase 28 fake MAVLink gateway scenarios.
19+
- **Aegis Edge** (`packages/edge/`): a drone and robotics safety-policy and audit runtime with local policy decisions, fake MAVLink gateway scenarios, deterministic fake-PX4 scenarios, and opt-in PX4 SITL checks.
2020

21-
Aegis Edge policy evaluation is active for local decisions, and MAVLink support is limited to fake-transport simulation/protocol mediation. It can validate Edge policies, evaluate command requests against fake vehicle state, inspect/classify MAVLink frames, run deterministic fake MAVLink scenarios, prepare Core audit events, and explain safety findings. It does not open real serial, UDP, PX4, ArduPilot, ROS2, SITL, or hardware endpoints. It is not a flight controller, not an autopilot replacement, not detect-and-avoid, and not regulatory approval or certification. It must not be used for real flight.
21+
Aegis Edge policy evaluation is active for local decisions. MAVLink fake transport remains deterministic, and PX4 SITL is opt-in local simulation only. Edge can validate policies, evaluate command requests against simulated vehicle state, inspect/classify MAVLink frames, run deterministic fake MAVLink and fake-PX4 scenarios, prepare Core audit events, and explain safety findings. It does not support ArduPilot SITL, ROS2 control, real hardware integration, or real-flight deployment. It is not a flight controller, not an autopilot replacement, not detect-and-avoid, and not regulatory approval or certification. It must not be used for real flight.
2222

2323
## Install
2424

build.zig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,18 @@ pub fn build(b: *std.Build) void {
215215
});
216216
const run_phase28_mavlink_gateway_tests = b.addRunArtifact(phase28_mavlink_gateway_tests);
217217

218+
const phase29_px4_sitl_tests = b.addTest(.{
219+
.root_module = b.createModule(.{
220+
.root_source_file = b.path("tests/phase29_px4_sitl.zig"),
221+
.target = target,
222+
.optimize = optimize,
223+
.imports = &.{
224+
.{ .name = "aegis_edge", .module = aegis_edge_mod },
225+
},
226+
}),
227+
});
228+
const run_phase29_px4_sitl_tests = b.addRunArtifact(phase29_px4_sitl_tests);
229+
218230
const test_step = b.step("test", "Run unit tests");
219231
test_step.dependOn(&run_lib_tests.step);
220232
test_step.dependOn(&run_exe_tests.step);
@@ -230,6 +242,7 @@ pub fn build(b: *std.Build) void {
230242
test_step.dependOn(&run_phase26_edge_domain_tests.step);
231243
test_step.dependOn(&run_phase27_edge_policy_engine_tests.step);
232244
test_step.dependOn(&run_phase28_mavlink_gateway_tests.step);
245+
test_step.dependOn(&run_phase29_px4_sitl_tests.step);
233246

234247
const fuzz_tests = b.addTest(.{
235248
.root_module = b.createModule(.{

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Product package docs:
44

55
- `../packages/core/README.md`: Aegis Core shared policy, decision, audit, replay, redaction, fixture, schema registry, experimental ABI skeleton, and capability contract.
66
- `../packages/cli/README.md`: Aegis CLI desktop and CI AI-agent runtime firewall contract.
7-
- `../packages/edge/README.md`: Aegis Edge scaffold plus Phase 26 domain/schema contract for future drone and robotics policy/audit work. Aegis Edge is not a flight controller, not an autopilot replacement, not detect-and-avoid, not regulatory approval or certification, and must not be used for real flight.
7+
- `../packages/edge/README.md`: Aegis Edge domain, policy, MAVLink, and PX4 SITL simulation contract. Aegis Edge is not a flight controller, not an autopilot replacement, not detect-and-avoid, not regulatory approval or certification, and must not be used for real flight.
88
- `edge/`: Edge domain model, coordinate frames, safety policy, and safety schema notes.
99

1010
Launch docs:

docs/edge/domain-model.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Vehicle identity and platform fields are explicit:
1212
- `AdapterKind`: fake, MAVLink, ROS2, custom, or unknown.
1313
- `VehicleMode`, `ArmState`, and `ControlAuthority`.
1414

15-
These are domain values. Phase 28 maps a supported subset of MAVLink messages into Edge command requests for fake/in-memory protocol mediation only. PX4, ArduPilot, ROS2, SITL, and hardware numeric integration remain unimplemented.
15+
These are domain values. Phase 28 maps a supported subset of MAVLink messages into Edge command requests for fake/in-memory protocol mediation. Phase 29 maps deterministic fake-PX4 and opt-in PX4 SITL simulation records into Edge state and command decisions. ArduPilot, ROS2, and hardware numeric integration remain unimplemented.
1616

1717
## Vehicle State
1818

docs/edge/limitations.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# Edge Limitations
22

3-
Aegis Edge Phase 28 implements policy evaluation and a MAVLink gateway foundation for fake/in-memory protocol mediation. It is not command forwarding to a real flight controller.
3+
Aegis Edge Phase 29 implements policy evaluation, a MAVLink gateway foundation for fake/in-memory protocol mediation, deterministic fake-PX4 scenarios, and opt-in PX4 SITL simulation checks. It is not command forwarding to a real flight controller.
44

55
Not implemented:
66

7-
- PX4 integration.
87
- ArduPilot integration.
98
- ROS2 integration.
10-
- PX4 SITL or ArduPilot SITL control.
11-
- Real serial or UDP MAVLink endpoints.
9+
- ArduPilot SITL control.
10+
- Real serial or hardware MAVLink endpoints.
1211
- Real hardware integration.
1312
- Real-flight deployment.
1413
- Customer hardware bench procedure.
@@ -17,6 +16,6 @@ Not implemented:
1716
- MAVLink signing key management or signing verification.
1817
- SaaS, monetization, telemetry, certification, or regulatory claims.
1918

20-
Coordinate frames and altitude references must be explicit. Unsupported geospatial conversions fail clearly. Polygon geofences and dialect-specific fence messages are reserved but not enforced in Phase 28.
19+
Coordinate frames and altitude references must be explicit. Unsupported geospatial conversions fail clearly. Polygon geofences and dialect-specific fence messages are reserved but not enforced in Phase 29.
2120

22-
Fake and simulation examples are deterministic policy/protocol fixtures. They are not flight validation and must not be used as real-flight readiness evidence.
21+
Fake, fake-PX4, and PX4 SITL examples are simulation fixtures. They are not flight validation and must not be used as real-flight readiness evidence.

docs/edge/mavlink-gateway.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# MAVLink Gateway
22

3-
Phase 28 implements the Aegis Edge MAVLink gateway foundation for fake/in-memory protocol mediation. It parses MAVLink frames, classifies supported messages, maps supported commands into Edge `CommandRequest` values, evaluates those requests through the Phase 27 policy engine, and records bounded audit events.
3+
Phase 28 implements the Aegis Edge MAVLink gateway foundation for fake/in-memory protocol mediation. Phase 29 reuses this gateway for PX4 SITL simulation scenarios. It parses MAVLink frames, classifies supported messages, maps supported commands into Edge `CommandRequest` values, evaluates those requests through the Phase 27 policy engine, and records bounded audit events.
44

5-
This is not real-flight readiness. The gateway does not open serial ports, UDP sockets, PX4 SITL, ArduPilot SITL, ROS2 endpoints, or customer hardware. It is for deterministic simulation, bench-oriented protocol review, and local tests.
5+
This is not real-flight readiness. The gateway does not open serial ports, ArduPilot SITL, ROS2 endpoints, or customer hardware. PX4 SITL use is opt-in local simulation only. The default path is deterministic fake transport for simulation, bench-oriented protocol review, and local tests.
66

77
## Gateway Modes
88

99
- `observe`: parse, classify, audit, and forward valid messages in fake transport. Denied policy results are logged but not blocked.
1010
- `enforce`: evaluate mapped commands and block denied or approval-required messages because no operator approval runtime exists in Phase 28.
1111
- `ci` / `redteam`: non-interactive. `ask` becomes deny and unknown command sources fail closed.
12-
- `simulation`: reserved for fake transport scenarios. Provenance is labeled `fake_transport/simulation`.
12+
- `simulation`: fake transport or fake-PX4 scenarios. Provenance is labeled `fake_transport/simulation` for MAVLink fixtures or `fake_adapter` for fake-PX4 state.
1313
- `bench`: reserved for later non-flight bench work. It is not a real hardware procedure.
1414
- `disabled`: no forwarding.
1515

docs/edge/mavlink-limitations.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# MAVLink Limitations
22

3-
Phase 28 is a gateway foundation, not a deployment package.
3+
Phase 28 is a gateway foundation, not a deployment package. Phase 29 adds PX4 SITL simulation through the `aegis-edge px4` command surface.
44

55
Not implemented:
66

77
- Real serial MAVLink endpoints.
88
- Real UDP MAVLink endpoints.
9-
- PX4 integration.
109
- ArduPilot integration.
11-
- PX4 SITL or ArduPilot SITL.
10+
- ArduPilot SITL.
1211
- ROS2 integration.
1312
- Real-flight deployment.
1413
- Customer hardware bench procedure.
@@ -20,6 +19,6 @@ Not implemented:
2019
- Autopilot replacement behavior.
2120
- Regulatory approval, certification, or airworthiness claims.
2221

23-
MAVLink2 signing detection records whether a signing block is present. Verification is reported as unavailable because Phase 28 does not manage keys or verify signatures.
22+
MAVLink2 signing detection records whether a signing block is present. Verification is reported as unavailable because Aegis Edge does not manage keys or verify signatures in Phase 29.
2423

2524
Mission handling is generic MAVLink transaction tracking only. It tracks count, sequence, duplicates, partial uploads, ACK, clear, set-current, completion, and denial state. It does not emulate PX4 or ArduPilot mission semantics.

docs/edge/px4-limitations.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# PX4 Limitations
2+
3+
PX4 support in Phase 29 is simulation-only.
4+
5+
Supported:
6+
7+
- Deterministic fake-PX4 telemetry and command fixtures.
8+
- PX4 SITL configuration and honest doctor output.
9+
- MAVLink command mediation through existing Edge policy.
10+
- Redacted scenario audit/replay artifacts.
11+
- Opt-in PX4 SITL integration-test gating.
12+
13+
Not supported:
14+
15+
- Real drone hardware.
16+
- Real-flight deployment.
17+
- Customer hardware bench procedures.
18+
- ArduPilot SITL.
19+
- ROS2 control.
20+
- Detect-and-avoid.
21+
- Autopilot replacement behavior.
22+
- Regulatory approval, certification, or airworthiness claims.
23+
24+
Fake-PX4 artifacts use `fake_adapter` provenance. PX4 SITL artifacts must use `sitl_px4` provenance. A fake adapter pass must never be presented as PX4 SITL success.

docs/edge/px4-scenarios.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# PX4 Scenarios
2+
3+
PX4 scenarios are run with:
4+
5+
```bash
6+
./zig-out/bin/aegis-edge px4 scenario run --policy <policy> --scenario <scenario> [--artifacts <dir>]
7+
```
8+
9+
Checked-in deterministic scenarios live under `examples/edge/px4/scenarios/`:
10+
11+
- `waypoint-outside-geofence-deny.yaml`
12+
- `land-allow.yaml`
13+
- `disable-failsafe-deny.yaml`
14+
- `mission-outside-geofence-deny.yaml`
15+
- `raw-actuator-deny.yaml`
16+
- `takeoff-low-battery-deny.yaml`
17+
18+
Artifacts include scenario id, environment, endpoint metadata, command requests, policy decisions, forwarded/blocked status, safety findings, limitations, and redacted notes. `events.jsonl` and `replay.json` are written through the redaction path before persistence.
19+
20+
Missing PX4 SITL produces a skip/unavailable result for SITL scenarios. It must not silently fall back to fake-PX4 and claim SITL success.

0 commit comments

Comments
 (0)