spectra-flight 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- spectra_flight-0.2.0/.gitignore +21 -0
- spectra_flight-0.2.0/CHANGELOG.md +124 -0
- spectra_flight-0.2.0/LICENSE +21 -0
- spectra_flight-0.2.0/PKG-INFO +186 -0
- spectra_flight-0.2.0/README.md +147 -0
- spectra_flight-0.2.0/docs/guide/checks-and-ci.md +112 -0
- spectra_flight-0.2.0/docs/guide/crash-investigation.md +124 -0
- spectra_flight-0.2.0/docs/guide/drag-and-model.md +245 -0
- spectra_flight-0.2.0/docs/guide/export-and-replay.md +198 -0
- spectra_flight-0.2.0/docs/guide/fixed-wing.md +139 -0
- spectra_flight-0.2.0/docs/guide/getting-started.md +159 -0
- spectra_flight-0.2.0/docs/guide/vtol.md +152 -0
- spectra_flight-0.2.0/examples/pipeline/README.md +45 -0
- spectra_flight-0.2.0/examples/pipeline/check_log.sh +13 -0
- spectra_flight-0.2.0/examples/pipeline/checks.yaml +30 -0
- spectra_flight-0.2.0/examples/pipeline/github-workflow.yml +45 -0
- spectra_flight-0.2.0/examples/sitl-gate/README.md +516 -0
- spectra_flight-0.2.0/examples/sitl-gate/check_params.py +84 -0
- spectra_flight-0.2.0/examples/sitl-gate/checks.yaml +50 -0
- spectra_flight-0.2.0/examples/sitl-gate/fly.py +822 -0
- spectra_flight-0.2.0/examples/sitl-gate/github-workflow.yml +33 -0
- spectra_flight-0.2.0/examples/sitl-gate/params/bad_rate_gain.params +4 -0
- spectra_flight-0.2.0/examples/sitl-gate/params/drag_kdv015.params +4 -0
- spectra_flight-0.2.0/examples/sitl-gate/params/drag_kdv030.params +4 -0
- spectra_flight-0.2.0/examples/sitl-gate/params/gz-truth.params +15 -0
- spectra_flight-0.2.0/examples/sitl-gate/params/inertia-changed.params +9 -0
- spectra_flight-0.2.0/examples/sitl-gate/params/model-changed.params +10 -0
- spectra_flight-0.2.0/examples/sitl-gate/params/stock.params +5 -0
- spectra_flight-0.2.0/examples/sitl-gate/params/weak_position_gain.params +4 -0
- spectra_flight-0.2.0/examples/sitl-gate/replay_lib.py +252 -0
- spectra_flight-0.2.0/examples/sitl-gate/requirements.txt +3 -0
- spectra_flight-0.2.0/examples/sitl-gate/run_sitl.sh +265 -0
- spectra_flight-0.2.0/examples/sitl-gate/vehicles/gz-x500.yaml +15 -0
- spectra_flight-0.2.0/examples/sitl-gate/vehicles/sih-changed.yaml +11 -0
- spectra_flight-0.2.0/examples/sitl-gate/vehicles/sih-stock.yaml +12 -0
- spectra_flight-0.2.0/pyproject.toml +106 -0
- spectra_flight-0.2.0/src/spectra_flight/__init__.py +3 -0
- spectra_flight-0.2.0/src/spectra_flight/app/__init__.py +1 -0
- spectra_flight-0.2.0/src/spectra_flight/app/__main__.py +43 -0
- spectra_flight-0.2.0/src/spectra_flight/app/findings_panel.py +259 -0
- spectra_flight-0.2.0/src/spectra_flight/app/main_window.py +361 -0
- spectra_flight-0.2.0/src/spectra_flight/app/plot_panel.py +298 -0
- spectra_flight-0.2.0/src/spectra_flight/app/px4_handoff.py +57 -0
- spectra_flight-0.2.0/src/spectra_flight/app/signal_browser.py +183 -0
- spectra_flight-0.2.0/src/spectra_flight/app/spectra_loader.py +83 -0
- spectra_flight-0.2.0/src/spectra_flight/app/timeline.py +376 -0
- spectra_flight-0.2.0/src/spectra_flight/app/vehicle_form.py +597 -0
- spectra_flight-0.2.0/src/spectra_flight/app/window_docks.py +85 -0
- spectra_flight-0.2.0/src/spectra_flight/app/window_model.py +56 -0
- spectra_flight-0.2.0/src/spectra_flight/app/window_tasks.py +141 -0
- spectra_flight-0.2.0/src/spectra_flight/app/window_vehicle.py +145 -0
- spectra_flight-0.2.0/src/spectra_flight/app/worker.py +383 -0
- spectra_flight-0.2.0/src/spectra_flight/cli.py +1006 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/__init__.py +1 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/__init__.py +41 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/_common.py +50 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/base.py +280 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/commands/__init__.py +13 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/commands/_shared.py +59 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/commands/acks.py +199 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/commands/limits.py +305 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/commands/modes.py +97 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/commands/offboard.py +112 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/commands/response.py +166 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/crash/__init__.py +348 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/crash/model_gap.py +493 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/crash/onset.py +553 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/crash/suspects.py +1615 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/crash/timeline.py +168 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/drag/__init__.py +549 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/drag/fit.py +494 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/drag/fixed_wing.py +596 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/drag/grade.py +144 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/drag/limits.py +54 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/drag/power.py +757 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/drag/samples.py +249 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/drag/tilt.py +91 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/drag/vertical.py +685 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/model/__init__.py +719 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/model/build.py +1288 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/model/fit.py +1143 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/model/fixed_wing.py +1393 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/model/grade.py +232 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/model/samples.py +330 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/summary/__init__.py +108 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/summary/events.py +85 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/summary/flight.py +363 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/summary/health.py +325 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/tuning/__init__.py +11 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/tuning/attitude.py +143 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/tuning/limits.py +297 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/tuning/loops.py +403 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/tuning/noise.py +298 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/tuning/oscillation.py +245 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/tuning/spectrum.py +203 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/tuning/step.py +307 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/tuning/step_response.py +898 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/tuning/tecs.py +186 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/tuning/tracking.py +211 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/validation/__init__.py +384 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/vtol/__init__.py +29 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/vtol/frames.py +202 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/vtol/runner.py +294 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/analyzers/vtol/transition.py +564 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/check_selection.py +323 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/checks.py +379 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/checks_default.yaml +148 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/checks_fixed_wing.yaml +134 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/checks_vtol.yaml +225 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/compare.py +830 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/diff.py +518 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/export/__init__.py +290 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/export/curve.py +70 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/export/fw_physical.py +282 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/export/gazebo.py +1309 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/export/gazebo_template.sdf +92 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/export/matlab.py +887 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/export/physical.py +236 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/export/sih.py +435 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/export/vtol_physical.py +330 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/fifo.py +85 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/filters.py +25 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/formatting.py +72 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/model_file.py +684 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/pipeline.py +228 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/reader.py +176 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/replay.py +690 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/report.py +954 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/results.py +320 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/rotors.py +153 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/segments.py +241 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/signals.py +101 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/topic_map.py +388 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/validation.py +1683 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/validation_file.py +198 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/vehicle.py +176 -0
- spectra_flight-0.2.0/src/spectra_flight/engine/vehicle_file.py +248 -0
- spectra_flight-0.2.0/tests/__init__.py +0 -0
- spectra_flight-0.2.0/tests/app/__init__.py +0 -0
- spectra_flight-0.2.0/tests/app/conftest.py +42 -0
- spectra_flight-0.2.0/tests/app/test_findings_panel.py +345 -0
- spectra_flight-0.2.0/tests/app/test_main.py +36 -0
- spectra_flight-0.2.0/tests/app/test_main_window.py +509 -0
- spectra_flight-0.2.0/tests/app/test_main_window_docks.py +181 -0
- spectra_flight-0.2.0/tests/app/test_main_window_model.py +129 -0
- spectra_flight-0.2.0/tests/app/test_main_window_vehicle.py +158 -0
- spectra_flight-0.2.0/tests/app/test_plot_panel.py +432 -0
- spectra_flight-0.2.0/tests/app/test_px4_handoff.py +75 -0
- spectra_flight-0.2.0/tests/app/test_signal_browser.py +146 -0
- spectra_flight-0.2.0/tests/app/test_spectra_loader.py +24 -0
- spectra_flight-0.2.0/tests/app/test_timeline.py +187 -0
- spectra_flight-0.2.0/tests/app/test_vehicle_form.py +308 -0
- spectra_flight-0.2.0/tests/app/test_vtol_ui.py +64 -0
- spectra_flight-0.2.0/tests/app/test_worker.py +449 -0
- spectra_flight-0.2.0/tests/conftest.py +96 -0
- spectra_flight-0.2.0/tests/engine/__init__.py +0 -0
- spectra_flight-0.2.0/tests/engine/data/levels_public_logs.json +426 -0
- spectra_flight-0.2.0/tests/engine/data/levels_synth.json +237 -0
- spectra_flight-0.2.0/tests/engine/data/roll_curve_reference.npy +0 -0
- spectra_flight-0.2.0/tests/engine/test_analyzer_base.py +148 -0
- spectra_flight-0.2.0/tests/engine/test_check_selection.py +474 -0
- spectra_flight-0.2.0/tests/engine/test_checks.py +341 -0
- spectra_flight-0.2.0/tests/engine/test_commands.py +526 -0
- spectra_flight-0.2.0/tests/engine/test_compare.py +684 -0
- spectra_flight-0.2.0/tests/engine/test_crash.py +106 -0
- spectra_flight-0.2.0/tests/engine/test_crash_model_gap.py +325 -0
- spectra_flight-0.2.0/tests/engine/test_crash_onset.py +221 -0
- spectra_flight-0.2.0/tests/engine/test_crash_suspects.py +418 -0
- spectra_flight-0.2.0/tests/engine/test_diff.py +217 -0
- spectra_flight-0.2.0/tests/engine/test_drag.py +555 -0
- spectra_flight-0.2.0/tests/engine/test_drag_fit.py +271 -0
- spectra_flight-0.2.0/tests/engine/test_drag_power.py +133 -0
- spectra_flight-0.2.0/tests/engine/test_drag_samples.py +159 -0
- spectra_flight-0.2.0/tests/engine/test_drag_vertical.py +153 -0
- spectra_flight-0.2.0/tests/engine/test_export.py +428 -0
- spectra_flight-0.2.0/tests/engine/test_export_gazebo.py +355 -0
- spectra_flight-0.2.0/tests/engine/test_export_matlab.py +320 -0
- spectra_flight-0.2.0/tests/engine/test_export_physical.py +214 -0
- spectra_flight-0.2.0/tests/engine/test_export_sih.py +234 -0
- spectra_flight-0.2.0/tests/engine/test_fifo.py +144 -0
- spectra_flight-0.2.0/tests/engine/test_formatting.py +76 -0
- spectra_flight-0.2.0/tests/engine/test_fw_crash.py +124 -0
- spectra_flight-0.2.0/tests/engine/test_fw_drag.py +147 -0
- spectra_flight-0.2.0/tests/engine/test_fw_export.py +144 -0
- spectra_flight-0.2.0/tests/engine/test_fw_model.py +268 -0
- spectra_flight-0.2.0/tests/engine/test_fw_tuning_commands.py +109 -0
- spectra_flight-0.2.0/tests/engine/test_fw_validation.py +141 -0
- spectra_flight-0.2.0/tests/engine/test_model.py +500 -0
- spectra_flight-0.2.0/tests/engine/test_model_file.py +905 -0
- spectra_flight-0.2.0/tests/engine/test_model_fit.py +530 -0
- spectra_flight-0.2.0/tests/engine/test_model_fit_calibration.py +86 -0
- spectra_flight-0.2.0/tests/engine/test_model_grade.py +302 -0
- spectra_flight-0.2.0/tests/engine/test_model_samples.py +330 -0
- spectra_flight-0.2.0/tests/engine/test_pipeline.py +234 -0
- spectra_flight-0.2.0/tests/engine/test_reader.py +218 -0
- spectra_flight-0.2.0/tests/engine/test_replay.py +651 -0
- spectra_flight-0.2.0/tests/engine/test_report.py +194 -0
- spectra_flight-0.2.0/tests/engine/test_results.py +413 -0
- spectra_flight-0.2.0/tests/engine/test_rotors.py +80 -0
- spectra_flight-0.2.0/tests/engine/test_segments.py +221 -0
- spectra_flight-0.2.0/tests/engine/test_signals.py +115 -0
- spectra_flight-0.2.0/tests/engine/test_sitl_logs.py +1395 -0
- spectra_flight-0.2.0/tests/engine/test_summary.py +592 -0
- spectra_flight-0.2.0/tests/engine/test_synth.py +698 -0
- spectra_flight-0.2.0/tests/engine/test_topic_map.py +272 -0
- spectra_flight-0.2.0/tests/engine/test_tuning_attitude.py +449 -0
- spectra_flight-0.2.0/tests/engine/test_tuning_limits.py +306 -0
- spectra_flight-0.2.0/tests/engine/test_tuning_loops.py +168 -0
- spectra_flight-0.2.0/tests/engine/test_tuning_noise.py +418 -0
- spectra_flight-0.2.0/tests/engine/test_tuning_oscillation.py +266 -0
- spectra_flight-0.2.0/tests/engine/test_tuning_spectrum.py +218 -0
- spectra_flight-0.2.0/tests/engine/test_tuning_step.py +906 -0
- spectra_flight-0.2.0/tests/engine/test_tuning_step_response.py +752 -0
- spectra_flight-0.2.0/tests/engine/test_tuning_tracking.py +480 -0
- spectra_flight-0.2.0/tests/engine/test_validation.py +946 -0
- spectra_flight-0.2.0/tests/engine/test_validation_job.py +371 -0
- spectra_flight-0.2.0/tests/engine/test_vehicle.py +139 -0
- spectra_flight-0.2.0/tests/engine/test_vehicle_file.py +173 -0
- spectra_flight-0.2.0/tests/engine/test_vtol_analysis.py +191 -0
- spectra_flight-0.2.0/tests/engine/test_vtol_crash.py +51 -0
- spectra_flight-0.2.0/tests/engine/test_vtol_export.py +167 -0
- spectra_flight-0.2.0/tests/engine/test_vtol_model.py +308 -0
- spectra_flight-0.2.0/tests/engine/test_vtol_segments.py +144 -0
- spectra_flight-0.2.0/tests/engine/test_vtol_validation.py +144 -0
- spectra_flight-0.2.0/tests/synth.py +1972 -0
- spectra_flight-0.2.0/tests/synth_fw.py +602 -0
- spectra_flight-0.2.0/tests/synth_vtol.py +1099 -0
- spectra_flight-0.2.0/tests/test_cli.py +1370 -0
- spectra_flight-0.2.0/tests/test_packaging.py +128 -0
- spectra_flight-0.2.0/tests/test_sitl_gate_scripts.py +466 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.venv/
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.pyc
|
|
4
|
+
*.egg-info/
|
|
5
|
+
dist/
|
|
6
|
+
build/
|
|
7
|
+
.pytest_cache/
|
|
8
|
+
.ruff_cache/
|
|
9
|
+
.superpowers/
|
|
10
|
+
|
|
11
|
+
# Flight logs are never committed (private or large). Public test logs are fetched, not stored.
|
|
12
|
+
*.ulg
|
|
13
|
+
spike/logs/
|
|
14
|
+
spike/sitl-logs/
|
|
15
|
+
spike/*.png
|
|
16
|
+
|
|
17
|
+
# Engine output written next to a log
|
|
18
|
+
*.results.json
|
|
19
|
+
*.derived.npz
|
|
20
|
+
|
|
21
|
+
graphify-out/
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `spectra-flight` are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
|
|
6
|
+
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.2.0] - 2026-11-30
|
|
9
|
+
|
|
10
|
+
Major expansion adding crash investigation, fixed-wing and VTOL flight analysis/model/export,
|
|
11
|
+
multicopter power curve and vertical drag, MATLAB/Simulink export, standalone HTML reports,
|
|
12
|
+
and general two-log comparison.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- **Crash investigation (`spectra-flight crash` & `analyze` job `crash`):**
|
|
16
|
+
- Two-stage onset detection with backtracking (`t_onset` vs `t_event`), pre-incident
|
|
17
|
+
timeline, and 9 evidence-backed suspects with temporal causality (`after_onset`
|
|
18
|
+
downgraded to `secondary`), including fixed-wing `stall_airspeed` and VTOL
|
|
19
|
+
`vtol_transition_failure` suspects.
|
|
20
|
+
- Unfiltered physical model residual and per-rotor failure counterfactuals (`--model`),
|
|
21
|
+
ranked `FindingsPanel` ordering, and SITL `--pattern crash` failure-injection harness.
|
|
22
|
+
- **Fixed-wing support (Phase 1 & 2):**
|
|
23
|
+
- PX4 fixed-wing canonicals (`airspeed_validated`, `tecs_status`, `actuator_servos`),
|
|
24
|
+
summary airspeed & stall margin, TECS tuning (`tecs_tuning`), `FW_*` configured limits,
|
|
25
|
+
built-in `checks_fixed_wing.yaml`, and energy-rate glide ratio & parabolic drag polar
|
|
26
|
+
(`C_D0`, `k`, Oswald `e`, `(L/D)_max`, `V_bg`, `V_ms`).
|
|
27
|
+
- Fixed-wing rotational aerodynamic derivative model ID (`type: fixed_wing`), hold-out
|
|
28
|
+
validation, and PX4 v1.15.4 Gazebo (`gz_advanced_plane` with 4 `AdvancedLiftDrag` +
|
|
29
|
+
`JointPositionController` surfaces) & SIH (`10041`) exporters.
|
|
30
|
+
- **VTOL support (Phase 1 & 2 — standard/quadplane, tiltrotor, tailsitter):**
|
|
31
|
+
- Subtype detection (`vtol_vehicle_status`, `tiltrotor_extra_controls`), hover /
|
|
32
|
+
transition / cruise phase segmentation, tailsitter $+90^\circ$ cruise body-frame
|
|
33
|
+
adapter, standard VTOL hover pusher masking, `vtol_transition` analyzer,
|
|
34
|
+
`when: phase == ...` check selection, built-in `checks_vtol.yaml`, and phase-colored
|
|
35
|
+
`TimelineWidget`.
|
|
36
|
+
- Unified hover + cruise `type: vtol` physical model with cross-phase inertia transfer
|
|
37
|
+
(including tailsitter $I_{xx} \leftrightarrow I_{zz}$ swap), per-phase hold-out
|
|
38
|
+
validation, and PX4 v1.15.4 Gazebo (`gz_standard_vtol 4004`) & SIH (`10042` tailsitter /
|
|
39
|
+
`10043` standard) exporters.
|
|
40
|
+
- **Multicopter power curve & vertical drag:**
|
|
41
|
+
- `power_curve` analyzer: multi-pack steady-level electric power binned by airspeed
|
|
42
|
+
(solved/autopilot wind or ground-speed fallback), momentum-theory fit with disk-loading
|
|
43
|
+
or variable-projection $v_h$, 95 % block-bootstrap intervals, hover power,
|
|
44
|
+
non-extrapolated best-endurance and best-range speeds, and `x="airspeed"` plots.
|
|
45
|
+
- `vertical_drag` analyzer: axial climb/descent body-$z$ drag with low-horizontal-speed
|
|
46
|
+
guard, three-tier thrust cascade (`--model` -> `vehicle.yaml` `thrust_curve` -> joint
|
|
47
|
+
self-fit fallback), honest `BCOEF_Z`/`mu_z` resolution, `CdA_z`/`Cd_z` via
|
|
48
|
+
`reference_area_m2.top`, and VTOL hover phase support.
|
|
49
|
+
- **MATLAB & Simulink exporter (`--to matlab`):**
|
|
50
|
+
- Exports multicopter, fixed-wing, and VTOL models to `<name>_params.m`, `%#codegen`
|
|
51
|
+
6-DOF `<name>_dynamics.m`, programmatic `build_<name>_simulink.m` (`.slx` builder),
|
|
52
|
+
standalone `simulate_<name>.m`, and `README.md` with full manifest provenance.
|
|
53
|
+
- **Standalone offline HTML report (`spectra-flight report` & `analyze --html`):**
|
|
54
|
+
- Single-file, zero-dependency HTML5 report built from `.results.json` + `.derived.npz`
|
|
55
|
+
(+ optional `.ulg` raw topics), featuring SVG flight timeline, level-filterable
|
|
56
|
+
findings, copyable `param set` proposals, checks/crash/model/validation sections, and
|
|
57
|
+
peak-preserving decimated vector SVG plots across all `PANEL_X` axes.
|
|
58
|
+
- **General two-log comparison (`spectra-flight diff`):**
|
|
59
|
+
- Compares any two `.ulg` or `.results.json` flights across PX4 parameter changes, check
|
|
60
|
+
regressions/improvements, finding level shifts, and every catalogue measure (`delta` &
|
|
61
|
+
`%`), with terminal tables, versioned JSON (`--out`), offline HTML diff (`--html`), and
|
|
62
|
+
CI regression gating (`--fail-on-regression`).
|
|
63
|
+
|
|
64
|
+
### Fixed
|
|
65
|
+
- Tailsitter VTOL cruise inertia override in `vtol_physical.py` now always applies the
|
|
66
|
+
$I_{xx} \leftrightarrow I_{zz}$ swap, and Gazebo VTOL export preserves rigid-body
|
|
67
|
+
triangle-inequality margins when sizing child links.
|
|
68
|
+
|
|
69
|
+
## [0.1.0] - 2026-11-27
|
|
70
|
+
|
|
71
|
+
First public multicopter release of `spectra-flight`.
|
|
72
|
+
|
|
73
|
+
### Added
|
|
74
|
+
- **Local Python engine & CLI (`spectra-flight`):**
|
|
75
|
+
- PX4 ULog reader (`pyulog`, PX4 v1.14+) with version-tolerant topic mapping, vehicle type
|
|
76
|
+
detection, flight segmentation (armed, in-air, modes, abnormal end), versioned JSON
|
|
77
|
+
results (`schema_version: 1`), and NumPy derived-signal storage (`.derived.npz`).
|
|
78
|
+
- **Flight summary** (all vehicles): duration, distance, max speed/altitude/tilt, battery
|
|
79
|
+
use across packs, vibration, accelerometer clipping, estimator resets, GPS quality,
|
|
80
|
+
RC/data-link losses, logging dropouts, changed parameters, and deduplicated log timeline.
|
|
81
|
+
- **PID tuning** (multicopters): rate, attitude, velocity, and position tracking error;
|
|
82
|
+
closed-loop step responses (rise time, overshoot, delay, spread, and stick-instrumented
|
|
83
|
+
rate response); gyro/motor oscillation peaks; motor, torque, and integrator saturation;
|
|
84
|
+
and pre-/post-filter gyro noise spectra.
|
|
85
|
+
- **Command checks & YAML check files:** command acknowledgements, mode mismatch / failsafe
|
|
86
|
+
detection, setpoint tracking per mode, offboard stream rate/gaps/jumps, `MPC_*` limit
|
|
87
|
+
checks, versioned YAML check files with `when` segment/sample filters and
|
|
88
|
+
`min_duration_s`, built-in default checks, and CI-friendly exit codes (`0`/`1`/`2`/`3`).
|
|
89
|
+
- **Drag & aerodynamics** (multicopters): PX4 EKF2 ballistic and momentum drag fit with
|
|
90
|
+
steady wind separation, quality grades (A–C), tilt cross-check, optional vehicle data
|
|
91
|
+
file (`--vehicle` / `--mass-kg`), and copy-paste `param set` proposals for
|
|
92
|
+
`EKF2_BCOEF_X`, `EKF2_BCOEF_Y`, `EKF2_MCOEF`, and `EKF2_DRAG_CTRL`.
|
|
93
|
+
- **Vehicle model & hold-out validation** (multicopters): reduced-form thrust, thrust curve
|
|
94
|
+
`a`, battery voltage exponent `c`, motor delay/lag, roll/pitch/yaw control effectiveness
|
|
95
|
+
and damping, inertia (with mass and κ), closed-loop instrumental-variables fitting on
|
|
96
|
+
rate setpoints, 90 % block-bootstrap intervals, multi-flight `spectra-flight model`
|
|
97
|
+
(model file `version: 2`), and hold-out validation (`--holdout-every`, `--holdout-log`,
|
|
98
|
+
`spectra-flight validate`, `analyze --model`).
|
|
99
|
+
- **Simulator export, closed-loop replay & compare** (multicopters): plug-in exporter
|
|
100
|
+
registry (`spectra_flight.exporters`), built-in PX4 v1.15.4 SIH (`--to sih`) and Gazebo
|
|
101
|
+
gz-garden (`--to gazebo`) exporters with provenance manifests (`manifest.json`,
|
|
102
|
+
`MANIFEST.md`), `spectra-flight replay-plan` (`version: 2` with yaw feed-forward), and
|
|
103
|
+
`spectra-flight compare` (pooled attitude/rate verdicts, thrust fit, tuning measures).
|
|
104
|
+
- **Desktop Qt 6 app (`spectra-flight-app`):**
|
|
105
|
+
- Embedded [Spectra](https://github.com/danlil240/Spectra) plots with linked time axes and
|
|
106
|
+
smooth zooming on high-rate logs, findings grouped by job, flight timeline dock, raw
|
|
107
|
+
signal browser, check/vehicle/model file pickers, vehicle data form editor, per-log mass
|
|
108
|
+
override, and per-user analysis cache.
|
|
109
|
+
- Out-of-the-box Linux install via `pip install "spectra-flight[app]"` (bundles
|
|
110
|
+
`spectra-plot>=0.4.2`).
|
|
111
|
+
- **Examples & CI workflows:**
|
|
112
|
+
- `examples/pipeline/` log-gating example and `examples/sitl-gate/` end-to-end PX4 v1.15.4
|
|
113
|
+
Docker SITL gate (SIH and Gazebo).
|
|
114
|
+
- GitHub Actions CI (`ci.yml`) and PyPI Trusted Publishing (`release.yml`).
|
|
115
|
+
|
|
116
|
+
### Known limitations
|
|
117
|
+
- Multicopters only for tuning, drag, vehicle model, validation, and export (fixed-wing and
|
|
118
|
+
VTOL logs currently receive flight summary and generic command checks).
|
|
119
|
+
- Closed-loop export + replay is proven on simulated vehicles (PX4 SIH and Gazebo `gz_x500`);
|
|
120
|
+
no real vehicle has yet been replayed on an identified model of itself.
|
|
121
|
+
- Desktop app wheel install is Linux-first (`spectra-plot` does not yet ship Windows/macOS
|
|
122
|
+
embed-library wheels; CLI works on Linux, Windows, and macOS).
|
|
123
|
+
- Drag power curve, vertical drag, crash investigation, HTML report export, and Sphera /
|
|
124
|
+
MATLAB-Simulink exporters are planned for later releases.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Daniel Lilintal
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: spectra-flight
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: PX4 flight log analysis: saved checks, findings with evidence, and an identified vehicle model
|
|
5
|
+
Project-URL: Homepage, https://github.com/danlil240/spectra-flight
|
|
6
|
+
Project-URL: Repository, https://github.com/danlil240/spectra-flight
|
|
7
|
+
Project-URL: Issues, https://github.com/danlil240/spectra-flight/issues
|
|
8
|
+
Project-URL: Documentation, https://github.com/danlil240/spectra-flight/blob/main/docs/guide/getting-started.md
|
|
9
|
+
Project-URL: Changelog, https://github.com/danlil240/spectra-flight/blob/main/CHANGELOG.md
|
|
10
|
+
Author: Daniel Lilintal
|
|
11
|
+
License: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: drone,fixed-wing,flight-analysis,gazebo,matlab,multicopter,pid-tuning,px4,simulink,system-identification,ulog,vtol
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Requires-Dist: numpy>=1.24
|
|
26
|
+
Requires-Dist: pyulog<2,>=1.3
|
|
27
|
+
Requires-Dist: pyyaml>=6.0
|
|
28
|
+
Requires-Dist: scipy>=1.10
|
|
29
|
+
Provides-Extra: app
|
|
30
|
+
Requires-Dist: flatbuffers; extra == 'app'
|
|
31
|
+
Requires-Dist: pyside6>=6.6; extra == 'app'
|
|
32
|
+
Requires-Dist: spectra-plot>=0.4.2; (sys_platform == 'linux') and extra == 'app'
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest-qt>=4; extra == 'dev'
|
|
35
|
+
Requires-Dist: pytest>=7; extra == 'dev'
|
|
36
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
37
|
+
Requires-Dist: tomli>=2; (python_version < '3.11') and extra == 'dev'
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
# spectra-flight
|
|
41
|
+
|
|
42
|
+
[](https://github.com/danlil240/spectra-flight/actions/workflows/ci.yml)
|
|
43
|
+
[](https://www.python.org/downloads/)
|
|
44
|
+
[](https://github.com/danlil240/spectra-flight/blob/main/LICENSE)
|
|
45
|
+
|
|
46
|
+
**PX4 flight log analysis, saved YAML regression checks, and physical vehicle-model
|
|
47
|
+
identification—fully offline, from the command line or a Qt 6 desktop app powered by
|
|
48
|
+
[Spectra](https://github.com/danlil240/Spectra).**
|
|
49
|
+
|
|
50
|
+
Instead of dragging twenty signals into a viewer after every flight and judging by eye,
|
|
51
|
+
`spectra-flight` turns a PX4 ULog into graded findings with evidence plots, gates firmware or
|
|
52
|
+
parameter changes in CI with versioned check files, identifies a physical multicopter model
|
|
53
|
+
with honest uncertainty, validates it on held-out flight data, and exports it to PX4 SIH and
|
|
54
|
+
Gazebo.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## What it does (0.2.0 — multicopters, fixed-wing & VTOL)
|
|
59
|
+
|
|
60
|
+
- **Flight summary & health** *(all PX4 vehicles)*: duration, distance, max speed/altitude/
|
|
61
|
+
tilt, airspeed & stall margin, battery use across packs, vibration, accelerometer clipping,
|
|
62
|
+
estimator resets, GPS quality, RC/data-link losses, dropouts, and changed parameters.
|
|
63
|
+
- **PID & TECS tuning** *(multicopters, fixed-wing & VTOL)*: tracking error across rate,
|
|
64
|
+
attitude, velocity, position, and fixed-wing TECS loops; stick-instrumented closed-loop
|
|
65
|
+
step responses; gyro/motor oscillation peaks; saturation; pre-/post-filter gyro noise
|
|
66
|
+
spectra; and VTOL hover/transition/cruise phase splitting.
|
|
67
|
+
- **Crash investigation** *(all vehicles)*: two-stage onset backtracking, pre-incident
|
|
68
|
+
timeline, 9 ranked evidence-backed suspects (including fixed-wing stall/pitot and VTOL
|
|
69
|
+
transition failure), and `--model` per-rotor failure counterfactuals (`spectra-flight crash`).
|
|
70
|
+
- **Saved checks, CI gates & two-log diff**: versioned YAML check files (`checks.yaml`) with
|
|
71
|
+
`when` mode/phase/signal filters, built-in per-class defaults, pass/fail exit codes, and
|
|
72
|
+
check/parameter/measure diffing across any two flights (`spectra-flight diff`).
|
|
73
|
+
- **Drag, power curve & aerodynamics**: multicopter EKF2 drag (`EKF2_BCOEF_X/Y`,
|
|
74
|
+
`EKF2_MCOEF`) + tilt cross-check, steady-level electric power curve (best-endurance &
|
|
75
|
+
best-range speeds), axial vertical drag, and fixed-wing glide ratio & parabolic drag polar.
|
|
76
|
+
- **Physical vehicle model, validation & export**: identifies multicopter, fixed-wing, and
|
|
77
|
+
unified VTOL models with 90 % block-bootstrap intervals; scores hold-out flights
|
|
78
|
+
(`validate` / `analyze --model`); exports to **PX4 SIH**, **Gazebo**, and **MATLAB /
|
|
79
|
+
Simulink** (`--to matlab`) with provenance manifests; and renders standalone offline **HTML
|
|
80
|
+
reports** (`spectra-flight report` / `analyze --html`).
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Quick start
|
|
85
|
+
|
|
86
|
+
### Install
|
|
87
|
+
|
|
88
|
+
| Component | Linux (Ubuntu 22.04 / 24.04) | Windows / macOS |
|
|
89
|
+
|---|---|---|
|
|
90
|
+
| Engine & CLI (`spectra-flight`) | `pip install spectra-flight` | `pip install spectra-flight` |
|
|
91
|
+
| Desktop app (`spectra-flight-app`) | `pip install "spectra-flight[app]"` | `pip install "spectra-flight[app]"` + built Spectra checkout (`SPECTRA_ROOT`) |
|
|
92
|
+
|
|
93
|
+
Requires Python 3.10+ and PX4 v1.14+ ULogs. Everything runs locally; no data leaves your
|
|
94
|
+
machine.
|
|
95
|
+
|
|
96
|
+
### Analyze a log and check regressions
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Run built-in checks, write flight.results.json, and render a standalone HTML report
|
|
100
|
+
spectra-flight analyze flight.ulg --html
|
|
101
|
+
|
|
102
|
+
# Gate a flight against your vehicle's YAML check file (exit 1 on any fail)
|
|
103
|
+
spectra-flight analyze flight.ulg --checks checks.yaml
|
|
104
|
+
|
|
105
|
+
# Compare two flights across checks, measures, and changed PX4 parameters
|
|
106
|
+
spectra-flight diff baseline.ulg candidate.ulg --fail-on-regression --html diff.html
|
|
107
|
+
|
|
108
|
+
# Open the log in the Qt 6 + Spectra desktop app
|
|
109
|
+
spectra-flight-app flight.ulg
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Identify, validate, and export a multicopter model
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Fit across one or more high-rate logs (SDLOG_PROFILE bit 4), holding out every 5th block
|
|
116
|
+
spectra-flight model flight.ulg --vehicle quad.yaml --holdout-every 5 --out quad.model.yaml
|
|
117
|
+
|
|
118
|
+
# Score predictions on held-out spans or unseen flights
|
|
119
|
+
spectra-flight validate quad.model.yaml flight.ulg other_flight.ulg --vehicle quad.yaml
|
|
120
|
+
|
|
121
|
+
# Export to PX4 Gazebo, SIH, or MATLAB/Simulink with provenance manifest
|
|
122
|
+
spectra-flight export quad.model.yaml --to matlab --out export-quad-matlab/
|
|
123
|
+
|
|
124
|
+
# Investigate a crash or in-flight failsafe (optionally with per-rotor model counterfactuals)
|
|
125
|
+
spectra-flight crash flight.ulg --model quad.model.yaml
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
For tuning and model identification, set `SDLOG_PROFILE` to `17` (default + high rate) or
|
|
129
|
+
`273` (adds raw gyro FIFO for noise spectra) before flying.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Documentation
|
|
134
|
+
|
|
135
|
+
- [Getting started & logging](https://github.com/danlil240/spectra-flight/blob/main/docs/guide/getting-started.md) — install, `SDLOG_PROFILE`, CLI reference, exit codes, and desktop app walkthrough
|
|
136
|
+
- [Check files & CI gates](https://github.com/danlil240/spectra-flight/blob/main/docs/guide/checks-and-ci.md) — YAML format, `when` filters, `min_duration_s`, and CI gate examples
|
|
137
|
+
- [Crash investigation](https://github.com/danlil240/spectra-flight/blob/main/docs/guide/crash-investigation.md) — onset backtracking, pre-incident timeline, suspects (including fixed-wing stall/pitot), and `--model` per-rotor counterfactuals
|
|
138
|
+
- [Fixed-wing analysis, model & export](https://github.com/danlil240/spectra-flight/blob/main/docs/guide/fixed-wing.md) — airspeed & stall margin, TECS tuning, `FW_*` limits, glide & drag polar, rotational derivative ID, hold-out validation, and Gazebo/SIH export
|
|
139
|
+
- [VTOL flight analysis, model & export](https://github.com/danlil240/spectra-flight/blob/main/docs/guide/vtol.md) — hover/transition/cruise split across standard (quadplane), tiltrotor, and tailsitter frames, transition quality, `when: phase == ...` checks, VTOL crash investigation, unified hover+cruise physical model ID, hold-out validation, and Gazebo/SIH export
|
|
140
|
+
- [Drag, vehicle model & validation](https://github.com/danlil240/spectra-flight/blob/main/docs/guide/drag-and-model.md) — vehicle data file, EKF2 drag proposals, closed-loop model ID, and hold-out grades
|
|
141
|
+
- [Export, replay & compare](https://github.com/danlil240/spectra-flight/blob/main/docs/guide/export-and-replay.md) — SIH & Gazebo exports, manifests, nominal mass, closed-loop replay, and exporter plug-ins
|
|
142
|
+
- [Examples: CI pipeline](https://github.com/danlil240/spectra-flight/blob/main/examples/pipeline/README.md) & [PX4 SITL gate](https://github.com/danlil240/spectra-flight/blob/main/examples/sitl-gate/README.md)
|
|
143
|
+
- [Design doc](https://github.com/danlil240/spectra-flight/blob/main/docs/design/design.md), [physics model](https://github.com/danlil240/spectra-flight/blob/main/docs/design/physics-model.md), and [Changelog](https://github.com/danlil240/spectra-flight/blob/main/CHANGELOG.md)
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Current status & known limits
|
|
148
|
+
|
|
149
|
+
`0.2.0` expands `spectra-flight` across multicopters, fixed-wing aircraft, and VTOLs:
|
|
150
|
+
|
|
151
|
+
- **Proven:** end-to-end model identification, hold-out validation, export, and closed-loop
|
|
152
|
+
replay are verified on simulated vehicles in PX4 v1.15.4 SIH and Gazebo (`gz_x500`); four
|
|
153
|
+
public quadrotor logs replay cleanly through the replay pipeline.
|
|
154
|
+
- **Not yet proven on a real vehicle's own model:** none of the seven public test logs
|
|
155
|
+
fits at grade B or better on all axes, so real-vehicle closed-loop round-trip validation is
|
|
156
|
+
still open. If you have a high-rate (`SDLOG_PROFILE=17`) multicopter flight with stick
|
|
157
|
+
doublets and climbs that you can share publicly, open an issue—it helps directly.
|
|
158
|
+
- **Not yet implemented:** VTOL transition fitting, Sphera exporter (private plug-in), and
|
|
159
|
+
ground/water/helicopter classes. Multicopters cover the full drag suite (horizontal EKF2
|
|
160
|
+
drag, power curve with best-endurance/best-range speeds, and axial vertical drag);
|
|
161
|
+
fixed-wing and VTOL logs (standard/quadplane, tiltrotor, tailsitter) support full analysis,
|
|
162
|
+
physical model ID, hold-out validation, and simulator export to **PX4 SIH**, **Gazebo**, and
|
|
163
|
+
**MATLAB / Simulink** (`--to matlab`); any `.results.json` exports to a standalone offline
|
|
164
|
+
**HTML report** (`spectra-flight report` / `analyze --html`), and any two flights can be
|
|
165
|
+
compared check-by-check and parameter-by-parameter with `spectra-flight diff`.
|
|
166
|
+
- **Desktop app platforms:** Linux wheels of `spectra-plot>=0.4.2` bundle `libspectra_embed.so`
|
|
167
|
+
out of the box. Windows and macOS GUI support follows Spectra's own wheel builds.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Development setup
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
python -m venv .venv
|
|
175
|
+
.venv/bin/python -m pip install -e ".[app,dev]" # Windows: .venv\Scripts\python
|
|
176
|
+
.venv/bin/python -m pytest
|
|
177
|
+
.venv/bin/python -m ruff check src tests
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
App tests (`-m gui`) run with `QT_QPA_PLATFORM=offscreen` and skip automatically if Spectra's
|
|
181
|
+
embed library is absent. `reallog` and `sitllog` tests skip when their log directories
|
|
182
|
+
(`SPECTRA_FLIGHT_TEST_LOGS`, `SPECTRA_FLIGHT_SITL_LOGS`) are not present.
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
[MIT](https://github.com/danlil240/spectra-flight/blob/main/LICENSE) © 2026 Daniel Lilintal.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# spectra-flight
|
|
2
|
+
|
|
3
|
+
[](https://github.com/danlil240/spectra-flight/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.python.org/downloads/)
|
|
5
|
+
[](https://github.com/danlil240/spectra-flight/blob/main/LICENSE)
|
|
6
|
+
|
|
7
|
+
**PX4 flight log analysis, saved YAML regression checks, and physical vehicle-model
|
|
8
|
+
identification—fully offline, from the command line or a Qt 6 desktop app powered by
|
|
9
|
+
[Spectra](https://github.com/danlil240/Spectra).**
|
|
10
|
+
|
|
11
|
+
Instead of dragging twenty signals into a viewer after every flight and judging by eye,
|
|
12
|
+
`spectra-flight` turns a PX4 ULog into graded findings with evidence plots, gates firmware or
|
|
13
|
+
parameter changes in CI with versioned check files, identifies a physical multicopter model
|
|
14
|
+
with honest uncertainty, validates it on held-out flight data, and exports it to PX4 SIH and
|
|
15
|
+
Gazebo.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## What it does (0.2.0 — multicopters, fixed-wing & VTOL)
|
|
20
|
+
|
|
21
|
+
- **Flight summary & health** *(all PX4 vehicles)*: duration, distance, max speed/altitude/
|
|
22
|
+
tilt, airspeed & stall margin, battery use across packs, vibration, accelerometer clipping,
|
|
23
|
+
estimator resets, GPS quality, RC/data-link losses, dropouts, and changed parameters.
|
|
24
|
+
- **PID & TECS tuning** *(multicopters, fixed-wing & VTOL)*: tracking error across rate,
|
|
25
|
+
attitude, velocity, position, and fixed-wing TECS loops; stick-instrumented closed-loop
|
|
26
|
+
step responses; gyro/motor oscillation peaks; saturation; pre-/post-filter gyro noise
|
|
27
|
+
spectra; and VTOL hover/transition/cruise phase splitting.
|
|
28
|
+
- **Crash investigation** *(all vehicles)*: two-stage onset backtracking, pre-incident
|
|
29
|
+
timeline, 9 ranked evidence-backed suspects (including fixed-wing stall/pitot and VTOL
|
|
30
|
+
transition failure), and `--model` per-rotor failure counterfactuals (`spectra-flight crash`).
|
|
31
|
+
- **Saved checks, CI gates & two-log diff**: versioned YAML check files (`checks.yaml`) with
|
|
32
|
+
`when` mode/phase/signal filters, built-in per-class defaults, pass/fail exit codes, and
|
|
33
|
+
check/parameter/measure diffing across any two flights (`spectra-flight diff`).
|
|
34
|
+
- **Drag, power curve & aerodynamics**: multicopter EKF2 drag (`EKF2_BCOEF_X/Y`,
|
|
35
|
+
`EKF2_MCOEF`) + tilt cross-check, steady-level electric power curve (best-endurance &
|
|
36
|
+
best-range speeds), axial vertical drag, and fixed-wing glide ratio & parabolic drag polar.
|
|
37
|
+
- **Physical vehicle model, validation & export**: identifies multicopter, fixed-wing, and
|
|
38
|
+
unified VTOL models with 90 % block-bootstrap intervals; scores hold-out flights
|
|
39
|
+
(`validate` / `analyze --model`); exports to **PX4 SIH**, **Gazebo**, and **MATLAB /
|
|
40
|
+
Simulink** (`--to matlab`) with provenance manifests; and renders standalone offline **HTML
|
|
41
|
+
reports** (`spectra-flight report` / `analyze --html`).
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Quick start
|
|
46
|
+
|
|
47
|
+
### Install
|
|
48
|
+
|
|
49
|
+
| Component | Linux (Ubuntu 22.04 / 24.04) | Windows / macOS |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| Engine & CLI (`spectra-flight`) | `pip install spectra-flight` | `pip install spectra-flight` |
|
|
52
|
+
| Desktop app (`spectra-flight-app`) | `pip install "spectra-flight[app]"` | `pip install "spectra-flight[app]"` + built Spectra checkout (`SPECTRA_ROOT`) |
|
|
53
|
+
|
|
54
|
+
Requires Python 3.10+ and PX4 v1.14+ ULogs. Everything runs locally; no data leaves your
|
|
55
|
+
machine.
|
|
56
|
+
|
|
57
|
+
### Analyze a log and check regressions
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Run built-in checks, write flight.results.json, and render a standalone HTML report
|
|
61
|
+
spectra-flight analyze flight.ulg --html
|
|
62
|
+
|
|
63
|
+
# Gate a flight against your vehicle's YAML check file (exit 1 on any fail)
|
|
64
|
+
spectra-flight analyze flight.ulg --checks checks.yaml
|
|
65
|
+
|
|
66
|
+
# Compare two flights across checks, measures, and changed PX4 parameters
|
|
67
|
+
spectra-flight diff baseline.ulg candidate.ulg --fail-on-regression --html diff.html
|
|
68
|
+
|
|
69
|
+
# Open the log in the Qt 6 + Spectra desktop app
|
|
70
|
+
spectra-flight-app flight.ulg
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Identify, validate, and export a multicopter model
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Fit across one or more high-rate logs (SDLOG_PROFILE bit 4), holding out every 5th block
|
|
77
|
+
spectra-flight model flight.ulg --vehicle quad.yaml --holdout-every 5 --out quad.model.yaml
|
|
78
|
+
|
|
79
|
+
# Score predictions on held-out spans or unseen flights
|
|
80
|
+
spectra-flight validate quad.model.yaml flight.ulg other_flight.ulg --vehicle quad.yaml
|
|
81
|
+
|
|
82
|
+
# Export to PX4 Gazebo, SIH, or MATLAB/Simulink with provenance manifest
|
|
83
|
+
spectra-flight export quad.model.yaml --to matlab --out export-quad-matlab/
|
|
84
|
+
|
|
85
|
+
# Investigate a crash or in-flight failsafe (optionally with per-rotor model counterfactuals)
|
|
86
|
+
spectra-flight crash flight.ulg --model quad.model.yaml
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
For tuning and model identification, set `SDLOG_PROFILE` to `17` (default + high rate) or
|
|
90
|
+
`273` (adds raw gyro FIFO for noise spectra) before flying.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Documentation
|
|
95
|
+
|
|
96
|
+
- [Getting started & logging](https://github.com/danlil240/spectra-flight/blob/main/docs/guide/getting-started.md) — install, `SDLOG_PROFILE`, CLI reference, exit codes, and desktop app walkthrough
|
|
97
|
+
- [Check files & CI gates](https://github.com/danlil240/spectra-flight/blob/main/docs/guide/checks-and-ci.md) — YAML format, `when` filters, `min_duration_s`, and CI gate examples
|
|
98
|
+
- [Crash investigation](https://github.com/danlil240/spectra-flight/blob/main/docs/guide/crash-investigation.md) — onset backtracking, pre-incident timeline, suspects (including fixed-wing stall/pitot), and `--model` per-rotor counterfactuals
|
|
99
|
+
- [Fixed-wing analysis, model & export](https://github.com/danlil240/spectra-flight/blob/main/docs/guide/fixed-wing.md) — airspeed & stall margin, TECS tuning, `FW_*` limits, glide & drag polar, rotational derivative ID, hold-out validation, and Gazebo/SIH export
|
|
100
|
+
- [VTOL flight analysis, model & export](https://github.com/danlil240/spectra-flight/blob/main/docs/guide/vtol.md) — hover/transition/cruise split across standard (quadplane), tiltrotor, and tailsitter frames, transition quality, `when: phase == ...` checks, VTOL crash investigation, unified hover+cruise physical model ID, hold-out validation, and Gazebo/SIH export
|
|
101
|
+
- [Drag, vehicle model & validation](https://github.com/danlil240/spectra-flight/blob/main/docs/guide/drag-and-model.md) — vehicle data file, EKF2 drag proposals, closed-loop model ID, and hold-out grades
|
|
102
|
+
- [Export, replay & compare](https://github.com/danlil240/spectra-flight/blob/main/docs/guide/export-and-replay.md) — SIH & Gazebo exports, manifests, nominal mass, closed-loop replay, and exporter plug-ins
|
|
103
|
+
- [Examples: CI pipeline](https://github.com/danlil240/spectra-flight/blob/main/examples/pipeline/README.md) & [PX4 SITL gate](https://github.com/danlil240/spectra-flight/blob/main/examples/sitl-gate/README.md)
|
|
104
|
+
- [Design doc](https://github.com/danlil240/spectra-flight/blob/main/docs/design/design.md), [physics model](https://github.com/danlil240/spectra-flight/blob/main/docs/design/physics-model.md), and [Changelog](https://github.com/danlil240/spectra-flight/blob/main/CHANGELOG.md)
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Current status & known limits
|
|
109
|
+
|
|
110
|
+
`0.2.0` expands `spectra-flight` across multicopters, fixed-wing aircraft, and VTOLs:
|
|
111
|
+
|
|
112
|
+
- **Proven:** end-to-end model identification, hold-out validation, export, and closed-loop
|
|
113
|
+
replay are verified on simulated vehicles in PX4 v1.15.4 SIH and Gazebo (`gz_x500`); four
|
|
114
|
+
public quadrotor logs replay cleanly through the replay pipeline.
|
|
115
|
+
- **Not yet proven on a real vehicle's own model:** none of the seven public test logs
|
|
116
|
+
fits at grade B or better on all axes, so real-vehicle closed-loop round-trip validation is
|
|
117
|
+
still open. If you have a high-rate (`SDLOG_PROFILE=17`) multicopter flight with stick
|
|
118
|
+
doublets and climbs that you can share publicly, open an issue—it helps directly.
|
|
119
|
+
- **Not yet implemented:** VTOL transition fitting, Sphera exporter (private plug-in), and
|
|
120
|
+
ground/water/helicopter classes. Multicopters cover the full drag suite (horizontal EKF2
|
|
121
|
+
drag, power curve with best-endurance/best-range speeds, and axial vertical drag);
|
|
122
|
+
fixed-wing and VTOL logs (standard/quadplane, tiltrotor, tailsitter) support full analysis,
|
|
123
|
+
physical model ID, hold-out validation, and simulator export to **PX4 SIH**, **Gazebo**, and
|
|
124
|
+
**MATLAB / Simulink** (`--to matlab`); any `.results.json` exports to a standalone offline
|
|
125
|
+
**HTML report** (`spectra-flight report` / `analyze --html`), and any two flights can be
|
|
126
|
+
compared check-by-check and parameter-by-parameter with `spectra-flight diff`.
|
|
127
|
+
- **Desktop app platforms:** Linux wheels of `spectra-plot>=0.4.2` bundle `libspectra_embed.so`
|
|
128
|
+
out of the box. Windows and macOS GUI support follows Spectra's own wheel builds.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Development setup
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
python -m venv .venv
|
|
136
|
+
.venv/bin/python -m pip install -e ".[app,dev]" # Windows: .venv\Scripts\python
|
|
137
|
+
.venv/bin/python -m pytest
|
|
138
|
+
.venv/bin/python -m ruff check src tests
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
App tests (`-m gui`) run with `QT_QPA_PLATFORM=offscreen` and skip automatically if Spectra's
|
|
142
|
+
embed library is absent. `reallog` and `sitllog` tests skip when their log directories
|
|
143
|
+
(`SPECTRA_FLIGHT_TEST_LOGS`, `SPECTRA_FLIGHT_SITL_LOGS`) are not present.
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
[MIT](https://github.com/danlil240/spectra-flight/blob/main/LICENSE) © 2026 Daniel Lilintal.
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Check files & CI gates
|
|
2
|
+
|
|
3
|
+
Every warning and failure threshold in `spectra-flight` lives in a YAML check file rather than
|
|
4
|
+
hard-coded constants. A built-in default set runs automatically; passing `--checks FILE`
|
|
5
|
+
tightens, relaxes, or adds vehicle-specific limits and gates CI pipelines through exit code `1`.
|
|
6
|
+
|
|
7
|
+
## Check file format
|
|
8
|
+
|
|
9
|
+
Keep a `checks.yaml` beside your airframe's parameters and run
|
|
10
|
+
`spectra-flight analyze flight.ulg --checks checks.yaml`:
|
|
11
|
+
|
|
12
|
+
```yaml
|
|
13
|
+
vehicle: quad_x500 # optional, shown in the report
|
|
14
|
+
defaults: extend # extend (default): run built-in checks too; replace: only these
|
|
15
|
+
checks:
|
|
16
|
+
- name: Roll rate overshoot
|
|
17
|
+
measure: rate.roll.overshoot
|
|
18
|
+
max: 0.20 # in the measure's unit; `min` works the same way
|
|
19
|
+
level: fail # fail (default) or warning
|
|
20
|
+
|
|
21
|
+
- name: Roll step response was measured
|
|
22
|
+
measure: rate.roll.overshoot
|
|
23
|
+
required: true # fail if the flight did not produce this measure
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Rules:
|
|
27
|
+
|
|
28
|
+
- `spectra-flight measures` lists every published measure, its unit, and its selection kind.
|
|
29
|
+
`spectra-flight measures LOG` adds the measured values on that log (or `not measured`).
|
|
30
|
+
- A whole-flight check (without `when`) on a measure that the built-in file already checks
|
|
31
|
+
replaces the built-in check, so you relax a default limit simply by restating it. Built-in
|
|
32
|
+
checks live in
|
|
33
|
+
[`src/spectra_flight/engine/checks_default.yaml`](../../src/spectra_flight/engine/checks_default.yaml).
|
|
34
|
+
- A measure the flight did not produce is `not measured` and breaks no check unless
|
|
35
|
+
`required: true` is set.
|
|
36
|
+
- Unknown keys, unknown measure names, or non-numeric limits exit `2` naming the file, check,
|
|
37
|
+
and reason.
|
|
38
|
+
- Only checks with `level: fail` return exit code `1`. Every built-in check is a `warning`
|
|
39
|
+
except vibration above 60 m/s².
|
|
40
|
+
- Limits on speed, tilt, climb rate, and descent rate are ratios against the log's own `MPC_*`
|
|
41
|
+
parameters (built-in warning at `1.1`, shown in the finding in the signal's own unit).
|
|
42
|
+
|
|
43
|
+
## Selecting parts of a flight: `when`
|
|
44
|
+
|
|
45
|
+
A check can restrict measurement to specific flight modes or conditions with `when` and
|
|
46
|
+
`min_duration_s`:
|
|
47
|
+
|
|
48
|
+
```yaml
|
|
49
|
+
checks:
|
|
50
|
+
- name: Roll overshoot while hovering in Position mode
|
|
51
|
+
measure: rate.roll.overshoot
|
|
52
|
+
max: 0.15
|
|
53
|
+
when: mode == POSITION
|
|
54
|
+
min_duration_s: 20 # fewer selected seconds than this -> not measured
|
|
55
|
+
|
|
56
|
+
- name: Hover position hold
|
|
57
|
+
measure: commands.position.horizontal_error_rms_m
|
|
58
|
+
max: 0.5
|
|
59
|
+
when: mode == POSITION and speed_setpoint < 0.2
|
|
60
|
+
min_duration_s: 15
|
|
61
|
+
|
|
62
|
+
- name: Commands sent on the ground
|
|
63
|
+
measure: commands.sent_count
|
|
64
|
+
max: 4
|
|
65
|
+
when: in_air == false
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
`when` joins one or more conditions with `and` (no `or`, `not`, or parentheses):
|
|
69
|
+
|
|
70
|
+
| Name | Kind | Meaning |
|
|
71
|
+
|---|---|---|
|
|
72
|
+
| `mode` | span | Flight mode flown: `==`, `!=`, or `in [MISSION, HOLD]` |
|
|
73
|
+
| `in_air` | span | `==` or `!=` with `true` or `false` (`false` allowed for `event` measures only) |
|
|
74
|
+
| `speed_setpoint` | sample | Horizontal speed demand (`trajectory_setpoint` velocity), m/s |
|
|
75
|
+
| `speed` | sample | Horizontal ground speed, m/s |
|
|
76
|
+
| `height_m` | sample | Height above the takeoff point, m |
|
|
77
|
+
| `climb_setpoint` | sample | Vertical speed demand (`trajectory_setpoint` velocity), m/s, up positive |
|
|
78
|
+
|
|
79
|
+
Details:
|
|
80
|
+
|
|
81
|
+
- `speed_setpoint` and `climb_setpoint` read the *demand* (`trajectory_setpoint`), not the
|
|
82
|
+
position controller's internal velocity setpoint (`vehicle_local_position_setpoint`), so a
|
|
83
|
+
hover check never hides position error corrections. Where PX4 leaves velocity unset (Hold or
|
|
84
|
+
position-only Offboard), those samples are not matched by `speed_setpoint`—select them with
|
|
85
|
+
`mode ==` alone.
|
|
86
|
+
- Sample fields compare with `==`, `!=`, `<`, `<=`, `>`, `>=` against a number. Modes accept
|
|
87
|
+
PX4 `nav_state` names (`POSCTL`, `ALTCTL`, `AUTO_MISSION`, `OFFBOARD`, ...) or aliases
|
|
88
|
+
(`POSITION`, `ALTITUDE`, `STABILIZED`, `MISSION`, `HOLD`, `LOITER`, `RTL`, `LAND`,
|
|
89
|
+
`TAKEOFF`).
|
|
90
|
+
- Each measure's allowed `when` conditions come from the `selection` column of
|
|
91
|
+
`spectra-flight measures`:
|
|
92
|
+
- `flight`: whole flight only (`summary.*`, `validation.*`).
|
|
93
|
+
- `mode`: span conditions inside in-air time (tuning measures, mode mismatch, offboard,
|
|
94
|
+
limits).
|
|
95
|
+
- `sample`: span and sample conditions (`commands.position.*`, `commands.altitude_*`,
|
|
96
|
+
`commands.velocity.*`).
|
|
97
|
+
- `event`: span conditions over the full log including `in_air == false` (`commands.*_count`).
|
|
98
|
+
- A `when` check re-runs the relevant analyzer on the selected time only and emits its own
|
|
99
|
+
finding named after the check (leaving whole-flight findings and built-in checks untouched).
|
|
100
|
+
Empty selections or durations under `min_duration_s` report `not measured` with the reason,
|
|
101
|
+
never pass; with `required: true` they take the check's level.
|
|
102
|
+
|
|
103
|
+
## Gating CI pipelines
|
|
104
|
+
|
|
105
|
+
Two ready-to-copy examples ship in the repository:
|
|
106
|
+
|
|
107
|
+
- [`examples/pipeline/`](../../examples/pipeline/README.md): gates an existing simulated ULog
|
|
108
|
+
with `checks.yaml`, `check_log.sh`, and a GitHub Actions workflow template.
|
|
109
|
+
- [`examples/sitl-gate/`](../../examples/sitl-gate/README.md): end-to-end PX4 v1.15.4 SITL
|
|
110
|
+
gate in Docker (SIH or Gazebo), applying a `.params` file, flying a scripted hover/mission/
|
|
111
|
+
offboard pattern, verifying parameter readback from the log, and gating on `checks.yaml`
|
|
112
|
+
(stock parameters exit `0`; tripled rate gains or a third of `MPC_XY_P` exit `1`).
|