mirror of
https://github.com/azaion/autopilot.git
synced 2026-06-21 09:41:11 +00:00
740bf37d76
Lands the second batch under epic AZ-626's implementation plan.
mavlink_layer (AZ-641 + AZ-642):
- Hand-rolled MAVLink v2 codec covering the §7.7 surface: HEARTBEAT,
SYS_STATUS, SET_MODE, ATTITUDE, GLOBAL_POSITION_INT, MISSION_* (7),
COMMAND_LONG, COMMAND_ACK, EXTENDED_SYS_STATE, STATUSTEXT (17 total).
- Streaming decoder demuxes arbitrary-sized byte arrivals, drops malformed
frames with typed parse-error counters (crc/truncated/unknown_id/seq_gap),
and surfaces sequence gaps without hard-failing the link.
- Encoder tracks the per-link tx_seq counter and applies the MAVLink v2
trailing-zero payload truncation rule.
- UDP and POSIX-serial transports behind a single async Transport trait;
the run loop owns transport open with bounded exponential backoff
(2 s serial / 5 s UDP cap) and a tokio::select! per-link read+write
loop.
- 1 Hz outbound HEARTBEAT scheduler + inbound-heartbeat watchdog that
fires LinkUp / LinkLost on a broadcast channel and feeds health detail
(connected, last_heartbeat_age_ms, signing_enabled, parse_errors).
mission_client (AZ-644):
- HTTPS GET /missions/{id} over rustls (no OpenSSL on the airframe).
- Bundled JSON Schema (crates/shared/contracts/mission-schema.json,
draft-07, additionalProperties:false) validates every response;
schema-invalid bodies surface as FetchError::SchemaInvalid with a
1 KiB sample of the raw body for offline analysis.
- Transient failures (timeout, 5xx, 429) retry with bounded exponential
backoff up to MissionClientOptions.max_attempts (default 5); permanent
failures (4xx, malformed URL) abort immediately.
- Health surface mirrors AC-1's contract: last_fetch_ts,
fetch_errors_total, schema_version, connection_state.
Caught and fixed before commit (NOT a code-review finding — caught by
the unit test that hand-computed CRC("123456789")): the hand-rolled
X.25 CRC accumulator was operating in u16 throughout. The MAVLink C
reference declares `tmp` as uint8_t, which silently truncates the
shifted-in bits. Round-trip tests passed (encoder and decoder shared
the bug); a real MAVLink peer would have rejected every frame. Fixed
by mirroring the C reference: `let mut tmp: u8 = …; tmp ^= tmp.wrapping_shl(4);`.
Added a regression test asserting CRC("123456789") == 0x6F91 against
pymavlink's reference value (NOT the textbook 0x29B1 — MAVLink uses a
byte-wise variant, not the bit-reflected CCITT).
AC verification (full detail in
_docs/03_implementation/batch_02_cycle1_report.md):
AZ-641: AC-1 + AC-3 + AC-4 verified via UDP loopback integration tests;
AC-2 (serial) requires a socat pty pair and runs in the SITL/CI
tier (test exists as #[ignore]-marked stub).
AZ-642: AC-1 + AC-2 + AC-3 verified via exhaustive codec round-trip and
decoder negative-path tests; AC-4 (SITL round-trip) requires
ArduPilot SITL — the CRC fix above means the codec is now
wire-correct, ready for the sitl-conformance Woodpecker stage.
AZ-644: all four ACs verified via wiremock-driven integration tests.
Workspace gates green:
- cargo check --workspace clean
- cargo check --workspace --no-default-features clean
- cargo fmt --all -- --check clean
- cargo clippy --workspace --all-targets -- -D warnings clean
- cargo test --workspace pass (1 expected ignore)
Layering invariants from module-layout.md hold: mavlink_layer and
mission_client are Layer 2 actors importing only `shared`; no sibling
Layer-2 imports; MavlinkHandle implements shared::contracts::MavlinkSink.
Jira: AZ-641, AZ-642, AZ-644 transitioned To Do → In Progress at batch
start; the matching In Testing transitions follow this commit.
Co-authored-by: Cursor <cursoragent@cursor.com>
93 lines
2.5 KiB
TOML
93 lines
2.5 KiB
TOML
[workspace]
|
|
resolver = "2"
|
|
members = [
|
|
"crates/shared",
|
|
"crates/autopilot",
|
|
"crates/mavlink_layer",
|
|
"crates/mission_client",
|
|
"crates/frame_ingest",
|
|
"crates/detection_client",
|
|
"crates/movement_detector",
|
|
"crates/semantic_analyzer",
|
|
"crates/vlm_client",
|
|
"crates/scan_controller",
|
|
"crates/mapobjects_store",
|
|
"crates/gimbal_controller",
|
|
"crates/operator_bridge",
|
|
"crates/mission_executor",
|
|
"crates/telemetry_stream",
|
|
]
|
|
|
|
[workspace.package]
|
|
edition = "2021"
|
|
rust-version = "1.82"
|
|
license = "Proprietary"
|
|
publish = false
|
|
authors = ["AZAION autopilot team"]
|
|
|
|
[workspace.dependencies]
|
|
# Async runtime
|
|
tokio = { version = "1", features = ["rt-multi-thread", "macros", "sync", "time", "io-util", "net", "signal"] }
|
|
|
|
# Foundational
|
|
bytes = "1"
|
|
anyhow = "1"
|
|
thiserror = "1"
|
|
async-trait = "0.1"
|
|
once_cell = "1"
|
|
|
|
# Serialisation
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = "1"
|
|
toml = "0.8"
|
|
|
|
# IDs and time
|
|
uuid = { version = "1", features = ["v4", "serde"] }
|
|
chrono = { version = "0.4", default-features = false, features = ["clock", "serde"] }
|
|
|
|
# Observability
|
|
tracing = "0.1"
|
|
tracing-subscriber = { version = "0.3", features = ["env-filter", "json", "fmt"] }
|
|
|
|
# CLI
|
|
clap = { version = "4", features = ["derive", "env"] }
|
|
|
|
# Health server
|
|
axum = { version = "0.7", default-features = false, features = ["http1", "json", "tokio"] }
|
|
tower = "0.5"
|
|
hyper = { version = "1", features = ["server", "http1"] }
|
|
|
|
# Networking / transports / schema
|
|
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls", "gzip"] }
|
|
jsonschema = { version = "0.18", default-features = false }
|
|
tokio-serial = "5"
|
|
|
|
# Test scaffolding
|
|
wiremock = "0.6"
|
|
|
|
# Workspace-internal
|
|
shared = { path = "crates/shared" }
|
|
mavlink_layer = { path = "crates/mavlink_layer" }
|
|
mission_client = { path = "crates/mission_client" }
|
|
frame_ingest = { path = "crates/frame_ingest" }
|
|
detection_client = { path = "crates/detection_client" }
|
|
movement_detector = { path = "crates/movement_detector" }
|
|
semantic_analyzer = { path = "crates/semantic_analyzer" }
|
|
vlm_client = { path = "crates/vlm_client" }
|
|
scan_controller = { path = "crates/scan_controller" }
|
|
mapobjects_store = { path = "crates/mapobjects_store" }
|
|
gimbal_controller = { path = "crates/gimbal_controller" }
|
|
operator_bridge = { path = "crates/operator_bridge" }
|
|
mission_executor = { path = "crates/mission_executor" }
|
|
telemetry_stream = { path = "crates/telemetry_stream" }
|
|
|
|
[profile.release]
|
|
lto = "thin"
|
|
codegen-units = 1
|
|
strip = "symbols"
|
|
opt-level = 3
|
|
|
|
[profile.dev]
|
|
opt-level = 0
|
|
debug = true
|