Commit Graph

122 Commits

Author SHA1 Message Date
Oleksandr Bezdieniezhnykh 1c993d86b3 [AZ-641] [AZ-642] [AZ-644] autodev state: batch 2 in testing, batch 3 pending
ci/woodpecker/push/build-arm Pipeline failed
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-19 12:31:54 +03:00
Oleksandr Bezdieniezhnykh 740bf37d76 [AZ-641] [AZ-642] [AZ-644] mavlink transport + codec + mission pull
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>
2026-05-19 12:29:49 +03:00
Oleksandr Bezdieniezhnykh a1ce3a6903 [AZ-640] Bootstrap Rust workspace, CI/Docker, observability scaffold
ci/woodpecker/push/build-arm Pipeline failed
Lands the first task of the implementation epic AZ-626: a cargo workspace
with 14 crates (shared + autopilot binary + 12 component crates), a
multi-stage Dockerfile + dev/test compose stacks, a Woodpecker CI pipeline,
the on-airframe systemd unit with flight-gate wiring, three environment
TOML configs, and the canonical entity catalogue from data_model.md as
`shared::models`.

Per-AC verification (full detail in
_docs/03_implementation/batch_01_cycle1_report.md):

- AC-1 cargo check --workspace clean
- AC-2 cargo test --workspace passes; per-crate it_compiles() <0.01 s
- AC-6 cargo build/test --no-default-features clean; VlmClient default
       impl returns VlmAssessment::disabled()
- AC-9 tracing-subscriber emits JSON logs with ts/level/target/fields
- AC-10 runtime::ensure_state_directories creates mapobjects/, audit/,
        pending_pushes/ under storage.state_dir

Deferred to external infra (artifacts written, verification re-runs in CI
and in downstream tasks):
- AC-3 Woodpecker runner; CI yml in place
- AC-4 docker-compose mocks land with AZ-660/AZ-644/AZ-675
- AC-5 SITL conformance lands with AZ-641/AZ-648/AZ-652
- AC-7 aarch64 cross-compile via cargo-zigbuild stage
- AC-8 systemd unit (Linux + systemd host)

Layering invariants from module-layout.md hold: shared (L1) imports
nothing; Layer 2 actor crates import only shared; Layer 3 coordinators
(operator_bridge, mission_executor) import only their documented Layer 2
deps; Layer 4 (scan_controller) imports its documented Layer 2 + Layer 3
deps; the autopilot binary (L5) is the only consumer of every component.

cargo fmt --all --check + cargo clippy --all-targets -- -D warnings both
clean. Jira AZ-640 transitioned to In Progress at the start of this batch;
the matching In Testing transition follows this commit.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-19 11:52:40 +03:00
Oleksandr Bezdieniezhnykh bc40ea7300 [AZ-626] Decompose complete: 47 tasks + docs + module layout
Greenfield Steps 1-6 baseline for the autopilot rewrite from legacy
Qt/C++ to a Rust workspace.

- Remove legacy Qt/C++ tree (ai_controller, drone_controller,
  misc/camera, python_scaffold, root Dockerfile, autopilot.pro,
  legacy main.py / requirements.txt).
- Add _docs/00_problem (problem, restrictions, acceptance criteria,
  security approach, input data + fixtures).
- Add _docs/01_solution/solution_draft01.
- Add _docs/02_document (architecture, system-flows, data_model,
  glossary, decision-rationale, deployment, 13 component descriptions,
  tests/ specs, FINAL_report, module-layout).
- Add _docs/02_tasks/todo with 47 task specs (AZ-640..AZ-686, one
  bootstrap + 46 component tasks) and _dependencies_table.md.
- Add .cursor/rules/artifact-srp.mdc (single-responsibility rule for
  canonical _docs artifacts).
- Track autodev state in _docs/_autodev_state.md (Step 6 completed,
  ready for Step 7 Implement).

Jira: bootstrap AZ-626; component epics AZ-627..AZ-639; tasks
AZ-640..AZ-686. Total complexity 173 points across 12 epics.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-19 11:02:01 +03:00
Oleksandr Bezdieniezhnykh f7d6cb4a3a [no-ticket] Sync .cursor with suite root
ci/woodpecker/push/build-arm Pipeline was successful
Bring this repo's .cursor/ in line with the suite monorepo root .cursor/
so rules, skills, and autodev artifacts stay consistent across
submodules and sibling repos.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-17 13:11:01 +03:00
Oleksandr Bezdieniezhnykh 87535984bf chore: sync .cursor from suite
ci/woodpecker/push/build-arm Pipeline was successful
2026-05-09 05:18:08 +03:00
Oleksandr Bezdieniezhnykh a6408de5dd chore: sync .cursor from suite
ci/woodpecker/push/build-arm Pipeline was successful
2026-05-05 01:08:46 +03:00
Oleksandr Bezdieniezhnykh 0137c98853 chore: sync .cursor skills from suite
ci/woodpecker/push/build-arm Pipeline was successful
2026-05-03 17:43:24 +03:00
Oleksandr Bezdieniezhnykh 8c43c39064 chore: sync .cursor skills from suite
ci/woodpecker/push/build-arm Pipeline was successful
2026-04-29 17:03:55 +03:00
Oleksandr Bezdieniezhnykh 83aa00282f chore: sync .cursor from suite
ci/woodpecker/push/build-arm Pipeline was successful
Made-with: Cursor
2026-04-25 19:44:53 +03:00
Oleksandr Bezdieniezhnykh 0196d61c7b Update Woodpecker CI configuration for Docker login and image tagging
ci/woodpecker/manual/build-arm Pipeline was successful
Replaced HARBOR_USER and HARBOR_TOKEN with REGISTRY_USER and REGISTRY_TOKEN for improved clarity and consistency. Adjusted the Docker login command and updated the image tagging to reflect the new registry path. This change enhances the pipeline's flexibility for different environments.
2026-04-21 20:37:45 +03:00
Oleksandr Bezdieniezhnykh 9586447cf4 [AZ-205] Authenticate to Harbor before pushing build images
Add HARBOR_USER/HARBOR_TOKEN from Woodpecker secrets and a docker login
step before the existing build/push, so pipelines can push to the new
TLS-authenticated Harbor registry.
2026-04-20 04:10:42 +03:00
Oleksandr Bezdieniezhnykh b59cf2dac3 [AZ-204] OCI revision labels + AZAION_REVISION env
Made-with: Cursor
2026-04-20 03:58:46 +03:00
Oleksandr Bezdieniezhnykh d11b105496 [AZ-203] Parameterize registry host via REGISTRY_HOST secret
Pipeline reads $REGISTRY_HOST from the Woodpecker global secret
'registry_host' instead of hardcoding 'localhost:5000'. The full
host:port lives in the secret, so Harbor migration (AZ-205) becomes
one secret edit rather than editing every submodule pipeline.

Made-with: Cursor
2026-04-20 03:49:20 +03:00
Oleksandr Bezdieniezhnykh 02d4490f00 Sync .cursor from suite (autodev orchestrator + monorepo skills) 2026-04-18 22:04:00 +03:00
Oleksandr Bezdieniezhnykh 7af0df4f44 Refine coding standards and testing rules
- Updated coding rules to emphasize readability, meaningful comments, and maintainability.
- Adjusted test coverage thresholds to 75% for business logic and clarified expectations for test scenarios.
- Enhanced guidelines for handling skipped tests, emphasizing the need for investigation and resolution.
- Introduced a completeness audit for decomposition in research steps to ensure thoroughness in addressing problem dimensions.

Made-with: Cursor
2026-04-17 20:28:26 +03:00
Oleksandr Bezdieniezhnykh 2e296310f9 Allow manual CI builds
ci/woodpecker/manual/build-arm Pipeline failed
Made-with: Cursor
2026-04-12 05:41:32 +03:00
Oleksandr Bezdieniezhnykh 686fcf81b3 Update Woodpecker CI configuration to trigger builds on push events 2026-04-12 05:10:40 +03:00
Oleksandr Bezdieniezhnykh 0e264abae9 Sync .cursor from detections 2026-04-12 05:05:09 +03:00
Oleksandr Bezdieniezhnykh 7216d07e4d CI: main tag without prefix
Made-with: Cursor
2026-04-12 04:12:03 +03:00
Oleksandr Bezdieniezhnykh 07b4a68ad3 update woodpecker add dev branch
Made-with: Cursor
2026-04-11 20:40:29 +03:00
Oleksandr Bezdieniezhnykh a59fd390d7 Switch to Woodpecker CI
Made-with: Cursor
2026-04-10 01:28:53 +03:00
Oleksandr Bezdieniezhnykh c77284209e Comment out amd64 matrix
Made-with: Cursor
2026-04-09 23:33:24 +03:00
Oleksandr Bezdieniezhnykh 74f84aaee7 Remove Woodpecker CI configuration file to simplify build process and eliminate unused settings. 2026-04-09 19:18:02 +03:00
Oleksandr Bezdieniezhnykh f1c116c343 Add support for multi-platform builds in Woodpecker CI configuration
- Introduced a matrix for building on both linux/arm64 and linux/amd64 platforms.
- Updated image tags to include platform-specific identifiers for better versioning.
- Enhanced the labels section to dynamically set the platform label based on the build matrix.
2026-04-09 13:27:47 +03:00
Oleksandr Bezdieniezhnykh af31ddb34c Remove 3rd/rapidjson submodule to streamline project dependencies. 2026-04-08 06:33:02 +03:00
Oleksandr Bezdieniezhnykh 71c1da45b6 rm 3rd/rapidjson submodule
Made-with: Cursor
2026-04-06 06:12:12 +03:00
Oleksandr Bezdieniezhnykh af8ef51bea Enhance coding guidelines in .cursor/rules/coderule.mdc and .cursor/rules/python.mdc
- Added a guideline to place all source code under the `src/` directory in `coderule.mdc`.
- Removed the outdated guideline regarding the `src/` layout in `python.mdc` to streamline project structure.

These updates improve project organization and maintainability by clarifying the structure for source code and project files.
2026-03-28 16:18:07 +02:00
Oleksandr Bezdieniezhnykh 15ca9868d5 Update README.md to reflect project renaming and simplify installation instructions for Azaion.Autopilot 2026-03-26 00:39:40 +02:00
Oleksandr Bezdieniezhnykh d8f91ef6a9 add python scaffold folder and autodevelopment system 2026-03-25 21:57:26 +02:00
Ubuntu 1009af4a32 Fixed camera control related issues and 2025-04-01 15:38:31 +00:00
Nffj84 1a189f1f1c Added missing variable declaration. 2025-03-28 20:42:21 +02:00
Nffj84 5ab076368d Prevent GimbalServer from being set available
Added check to not allow GimbalServer to become available after setting allow camera commands to false.
2025-03-24 18:24:11 +02:00
Nffj84 deb607237e Set camera ready for lift and drop
Added functionality to set camera ready for bringing it down or up.
Camera will be made available for AI after bringCameraDown command is given via UDPSocket.
Camera will be made unavailable for AI after bringCameraUp command is given via UDPSocket.
2025-03-24 18:01:47 +02:00
Nffj84 f1023788e5 Added simple tool for offline use.
Tool has three inputs map_tile_folder, current_latitude and current_longitude.
With these tool will got through map tiles in given folder and list tiles in order based on their distance from given location.
2025-01-06 13:01:59 +02:00
Tuomas Järvinen 38953d0ba6 Use MAVSDK::RawMission in AzMissionController
TODO!!
- send mission indexes from AzMissionController to AzDroneController
- handle finishing of the mission
2024-12-01 21:51:02 +01:00
Tuomas Järvinen 37e8cfd3fe Use raw missions in AutoPilot
- uses MAVSDK::MissionRaw objects for missions
- added new state AZ_DRONE_STATE_MISSION_UPLOADED
- new state is used in AzDroneControllerPlane before waiting for AUTO switch

TODO!!
- move to AzMissionController
- use JSON file instead of hard coded mission items
2024-11-30 17:09:00 +01:00
Tuomas Järvinen be36fc5c50 Added logging for altitude and compass 2024-11-27 17:43:11 +01:00
Tuomas Järvinen de63892725 Minor fixes to NCNN inference
- reduced logging
- emit also empty inference results to AiEngine
2024-10-24 18:57:49 +02:00
Tuomas Järvinen e3643ea622 Small fixes to AI Controller
- removed QtSerialPort from the Qt CONFIG parameters
- remove compiler warnings
- reduced logging
- fixed FPS to show what AI really analyzed
- RTSP reader tries to connect to the stream once per second until it succeeds
2024-10-24 18:36:12 +02:00
Tuomas Järvinen 45c19baa45 Changed directory structure and renamed applications
- autopilot -> drone_controller
- rtsp_ai_player -> ai_controller
- added top level qmake project file
- updated documentation
- moved small demo applications from tmp/ to misc/
2024-10-19 14:44:34 +02:00
Tuomas Järvinen 54b7dc41ca Reduced and improved logging
- removed unnecessary logging
- print start date and time when application starts
- use std::cout instead of qDebug()
- better logging in DroneController classes
- renamed Controller states for better readability
2024-10-18 21:45:20 +02:00
Tuomas Järvinen 91257d0ce7 Added support for switching to AUTO mode in Autopilot.
When the application is started with the command parameter "plane", the
application uses the AzDroneControllerPlane class to control
initialisation. It doesn't arm or takeoff the drone. Instead, it waits
for the user to mode to AUTO (in Ardupilot, Mission in MAVSDK) with the
RC controller. When AUTO mode has been detected, the application will
start a normal mission handling.
2024-10-17 20:56:42 +02:00
Tuomas Järvinen 0975532635 Use constant font size for OPI5 inference results. 2024-10-17 20:56:38 +02:00
Alex Bezdieniezhnykh 7f333ba990 ai_player: show all frames, regardless of inference results 2024-10-17 09:14:15 +03:00
Nffj84 a3d9137b77 Changed serial connection to UDP connection.
Added ZR10 support.
Added automation to choose configuration.
2024-10-14 21:18:27 +03:00
Tuomas Järvinen 2b2af3044e Added /usr/local/lib to rpath in rstp_player OPI5 build 2024-10-11 00:34:04 +03:00
Alex B. 9d0b3bc7a9 Add ARM specfic install of mediamtx 2024-10-03 21:00:56 +03:00
Tuomas Järvinen c2bda448c6 Updated build instructions of rtsp_ai_player for OPI5 2024-10-02 19:40:10 +02:00
Tuomas Järvinen d4779b1bb0 - addedd NCNN model support to rtsp_ai_player
- added printing of inference FPS
- simple AI test bench which can be used to compare models
2024-10-02 19:15:49 +02:00