inav-toolkit 2.15.0__py3-none-any.whl

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.
@@ -0,0 +1,375 @@
1
+ Metadata-Version: 2.4
2
+ Name: inav-toolkit
3
+ Version: 2.15.0
4
+ Summary: Blackbox analyzer, parameter checker, and tuning wizard for INAV flight controllers
5
+ License: MIT
6
+ Project-URL: Homepage, https://github.com/agoliveira/INAV-Toolkit
7
+ Project-URL: Issues, https://github.com/agoliveira/INAV-Toolkit/issues
8
+ Keywords: inav,drone,blackbox,pid,tuning,flight-controller,multirotor
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Environment :: Console
11
+ Classifier: Intended Audience :: End Users/Desktop
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Scientific/Engineering
22
+ Requires-Python: >=3.8
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: numpy>=1.21.0
26
+ Requires-Dist: scipy>=1.7.0
27
+ Requires-Dist: matplotlib>=3.5.0
28
+ Requires-Dist: pyserial>=3.5
29
+ Provides-Extra: test
30
+ Requires-Dist: pytest>=7.0; extra == "test"
31
+ Dynamic: license-file
32
+
33
+ # INAV Toolkit
34
+
35
+ [![CI](https://github.com/agoliveira/INAV-Toolkit/actions/workflows/ci.yml/badge.svg)](https://github.com/agoliveira/INAV-Toolkit/actions/workflows/ci.yml)
36
+
37
+ A suite of Python tools for analyzing, validating, and tuning INAV flight controller configurations. Built for the INAV long-range community - 7" to 15" multirotors with GPS navigation.
38
+
39
+ ## Tools
40
+
41
+ | Tool | Purpose |
42
+ |------|---------|
43
+ | **Blackbox Analyzer** | Decode blackbox logs, analyze PID performance, detect oscillation, recommend tuning changes |
44
+ | **Guided Wizard** | Interactive session manager - connects to FC, backs up config, runs analysis, applies changes |
45
+ | **Parameter Analyzer** | Validate `diff all` configs for safety, filter, PID, and navigation issues |
46
+ | **VTOL Configurator** | Validate VTOL mixer profiles, motor/servo mixing, and transition setup |
47
+ | **Flight Database** | SQLite storage for flight history, progression tracking across tuning sessions |
48
+ | **MSP Communication** | Direct FC communication - download blackbox, pull config, identify hardware |
49
+
50
+ ## Quick Start
51
+
52
+ ### Install
53
+
54
+ ```bash
55
+ pip install inav-toolkit
56
+ ```
57
+
58
+ That's it. All dependencies (numpy, scipy, matplotlib, pyserial) are installed automatically.
59
+
60
+ **Alternative install methods:**
61
+
62
+ ```bash
63
+ # In a virtual environment
64
+ python3 -m venv inav
65
+ source inav/bin/activate
66
+ pip install inav-toolkit
67
+
68
+ # With pipx (auto-isolates CLI tools)
69
+ pipx install inav-toolkit
70
+
71
+ # From source (development)
72
+ git clone https://github.com/agoliveira/INAV-Toolkit
73
+ cd INAV-Toolkit
74
+ pip install -e .
75
+ ```
76
+
77
+ Python 3.8+ required.
78
+
79
+ ### Blackbox Analyzer
80
+
81
+ Analyzes binary blackbox logs (`.bbl` / `.bfl`) from INAV. Decodes natively in Python - no `blackbox_decode` needed.
82
+
83
+ ```bash
84
+ # Full pipeline: connect to FC, download blackbox, analyze (diff pulled automatically)
85
+ inav-analyze --device auto
86
+
87
+ # Download, analyze, and erase flash for next session
88
+ inav-analyze --device auto --erase
89
+
90
+ # Download only (saves to ./blackbox/, no analysis)
91
+ inav-analyze --device auto --download-only
92
+
93
+ # Analyze from file (auto-detects frame size, cells, platform)
94
+ inav-analyze flight.bbl
95
+
96
+ # Multi-log files are automatically split and analyzed individually
97
+ inav-analyze dataflash_dump.bbl
98
+
99
+ # Show flight history and progression for a craft
100
+ inav-analyze flight.bbl --history
101
+
102
+ # Override frame size if auto-detection doesn't apply
103
+ inav-analyze flight.bbl --frame 10
104
+
105
+ # Add motor KV for RPM noise prediction (cells auto-detected from vbatref)
106
+ inav-analyze flight.bbl --kv 980
107
+
108
+ # Navigation health analysis mode
109
+ inav-analyze flight.bbl --nav
110
+
111
+ # Compare two flights side-by-side
112
+ inav-analyze flight_before.bbl --compare flight_after.bbl
113
+
114
+ # Interactive replay with Plotly.js (spectrogram, synced zoom, flight modes)
115
+ inav-analyze flight.bbl --replay
116
+
117
+ # Quick log quality check (exit code 1 if unusable)
118
+ inav-analyze flight.bbl --check-log
119
+
120
+ # Generate Markdown report for forum/Discord
121
+ inav-analyze flight.bbl --report md
122
+
123
+ # Skip database storage for one-off analysis
124
+ inav-analyze flight.bbl --no-db
125
+
126
+ # Custom database path
127
+ inav-analyze flight.bbl --db-path ~/my_flights.db
128
+ ```
129
+
130
+ **What it measures:**
131
+ - **Hover oscillation:** Detects oscillation during hover from gyro variance, classifies severity, identifies dominant frequency, diagnoses cause (P too high / PD interaction / D-term noise / filter gap)
132
+ - **PID step response:** Overshoot percentage, settling time, delay
133
+ - **Noise spectrum:** Identifies peak frequencies per axis
134
+ - **Motor balance:** Detects thrust asymmetry
135
+ - **Filter phase lag:** Total delay through the filter chain
136
+ - **Tracking error:** RMS deviation between setpoint and gyro
137
+ - **Navigation health** (`--nav`): Compass interference, GPS quality, barometer noise, position hold drift, altitude hold accuracy
138
+
139
+ **Comparative analysis** (`--compare`): Side-by-side analysis of two flights with overlay noise spectra, PID response deltas, motor balance comparison, and overall score improvement/degradation arrow. Warns on craft/frame mismatches.
140
+
141
+ **Interactive replay** (`--replay`): Standalone HTML with Plotly.js WebGL rendering. Panels: gyro vs setpoint (3 axes), motor outputs, noise spectrogram waterfall (sliding FFT heatmap), throttle. Synced zoom/pan across all panels. Flight mode overlay bar decoded from S-frame bitmask.
142
+
143
+ **Log quality scoring** (`--check-log`): Pre-analysis validation that grades logs as GOOD/MARGINAL/UNUSABLE. Checks: duration, sample rate, field completeness, stick activity, all-zeros sensors, corrupt frames, NaN gaps. Also runs automatically during normal analysis.
144
+
145
+ **Markdown reports** (`--report md`): Generates a forum/Discord-pasteable report with scores, findings, noise sources, PID metrics, and CLI commands in a fenced code block.
146
+
147
+ **Multi-log splitting:** Dataflash dumps containing multiple arm/disarm cycles are automatically detected and split. Each flight is analyzed individually with per-flight progression tracking.
148
+
149
+ **CLI diff merge:** When connected to the FC via `--device`, the analyzer automatically pulls the full `diff all` configuration. Settings not present in blackbox headers (motor_poles, nav PIDs, rates, level mode, antigravity) are enriched from the diff. Mismatches between what was flying and the current FC config are detected and displayed.
150
+
151
+ **Flight database:** Every analysis is stored in a SQLite database (`inav_flights.db`). Scores, per-axis oscillation data, PID values, filter config, motor balance, and recommended actions are tracked per flight. The `--history` flag shows a progression table.
152
+
153
+ **Auto-detection:** Frame size from craft name, battery cells from vbatref, platform type (quad/hex/tri) from motor count. Warns on conflicts between detected and user-specified values.
154
+
155
+ **Oscillation-first enforcement:** When hover oscillation is detected, the analyzer generates aggressive P/D reductions as top-priority actions and defers regular PID recommendations on oscillating axes - you can't tune what you can't stabilize.
156
+
157
+ **Filter-first enforcement:** When filter changes are needed, PID recommendations are deferred until after filters are fixed and a re-fly, preventing the common death spiral of raising D-term gains into wide-open filters.
158
+
159
+ **Output:** Terminal report with actionable CLI commands, HTML report with plots, state JSON for cross-referencing, and SQLite database for history.
160
+
161
+ ### Guided Wizard
162
+
163
+ Interactive session that orchestrates the full workflow: connect to FC, backup config, download blackbox, analyze, review changes, and apply.
164
+
165
+ ```bash
166
+ # Start guided session (auto-detects FC)
167
+ inav-toolkit
168
+
169
+ # Specify serial port
170
+ inav-toolkit --device /dev/ttyACM0
171
+ ```
172
+
173
+ The wizard creates a timestamped backup before any changes and walks you through each step with safety gates.
174
+
175
+ ### Parameter Analyzer
176
+
177
+ Validates an INAV `diff all` export for configuration issues.
178
+
179
+ ```bash
180
+ # Analyze existing config
181
+ inav-params my_diff.txt --frame 10
182
+
183
+ # Generate starting PIDs for a new build
184
+ inav-params --setup 10 --voltage 6S
185
+
186
+ # Compare starting PIDs with current config
187
+ inav-params --setup 10 --voltage 6S my_diff.txt
188
+
189
+ # Cross-reference with blackbox results
190
+ inav-params my_diff.txt --blackbox state.json
191
+ ```
192
+
193
+ **What it checks:**
194
+ - **Safety:** Beeper configuration, failsafe procedure, battery limits
195
+ - **Motors:** Protocol validation, RPM filter + ESC telemetry consistency
196
+ - **Filters:** Frame-appropriate gyro LPF, dynamic notch configuration
197
+ - **PIDs:** Cross-profile consistency, iterm_relax, D-boost, antigravity
198
+ - **Navigation:** RTH altitude, hover throttle, position PIDs, safehome
199
+ - **GPS:** Multi-constellation, compass calibration quality (mag gain spread)
200
+ - **Blackbox:** Logging rate, essential fields for analysis
201
+ - **Battery:** Li-ion vs LiPo detection, voltage limits
202
+
203
+ **Setup mode** generates conservative starting PIDs for 5/7/10/12/15" frames at 4S/6S/8S/12S.
204
+
205
+ ### VTOL Configurator
206
+
207
+ Validates INAV VTOL configurations using mixer_profile switching.
208
+
209
+ ```bash
210
+ # Validate VTOL config
211
+ python3 -m inav_toolkit.vtol_configurator vtol_diff.txt
212
+
213
+ # JSON output
214
+ python3 -m inav_toolkit.vtol_configurator vtol_diff.txt --json
215
+ ```
216
+
217
+ **What it checks:**
218
+ - MC and FW mixer profiles present with correct `platform_type`
219
+ - Motor role inference: tilt / lift-only / pusher by cross-referencing profiles
220
+ - Tilt servo rules (smix source 38) for transition
221
+ - Yaw authority: motor yaw mixing or tilt servo yaw
222
+ - FW control surfaces: roll + pitch servo mixing
223
+ - Mode assignments: MIXER PROFILE 2 (mode 62) and MIXER TRANSITION (mode 63)
224
+ - Automated RTH transition: `mixer_automated_switch` in both profiles
225
+ - Safety: `airmode_type` conflict with transition motors, compass for MC nav
226
+ - Control profile linking between mixer profiles
227
+
228
+ ### MSP Communication
229
+
230
+ Direct serial communication with INAV flight controllers over USB.
231
+
232
+ ```bash
233
+ # Identify connected FC
234
+ inav-msp --info-only
235
+
236
+ # Download blackbox data
237
+ inav-msp --device auto
238
+
239
+ # Specify serial port
240
+ inav-msp --device /dev/ttyACM0
241
+ ```
242
+
243
+ **Capabilities:**
244
+ - MSP v2 protocol with CRC-8 validation
245
+ - FC identification (craft name, firmware, board, build date)
246
+ - Dataflash summary, read, and erase
247
+ - SD card blackbox detection with guidance
248
+ - CLI mode for `diff all` config retrieval
249
+ - Auto-detection of serial ports (Linux/macOS)
250
+ - Binary blackbox download with progress bar and retry logic
251
+
252
+ ## Tuning Workflow
253
+
254
+ The tools are designed to work together in a tuning pipeline:
255
+
256
+ ```
257
+ 1. NEW BUILD
258
+ └─ inav-params --setup 10 --voltage 6S
259
+ → Conservative starting PIDs, filters, settings
260
+ → Paste CLI commands into INAV Configurator
261
+
262
+ 2. FIRST FLIGHTS
263
+ └─ inav-params my_diff.txt --frame 10
264
+ → Catches safety issues, missing settings, profile inconsistencies
265
+ → Fix before flying
266
+
267
+ 3. BLACKBOX LOGGING
268
+ └─ Fly with blackbox enabled (GYRO_RAW, MOTORS, RC_COMMAND)
269
+ → Hover segment for oscillation detection
270
+ → Manual/acro segment for PID step response data
271
+ → Nav segment for position hold / RTH data
272
+
273
+ 4. PID TUNING (one-step with FC connected)
274
+ └─ inav-analyze --device auto --erase
275
+ → Downloads blackbox, pulls current config
276
+ → Splits multi-log files automatically
277
+ → Detects hover oscillation first
278
+ → Recommends filter fixes before PID changes
279
+ → Stores results in flight database
280
+ → Shows progression from previous flights
281
+
282
+ 5. GUIDED SESSION (interactive)
283
+ └─ inav-toolkit
284
+ → Connects, backs up, downloads, analyzes, applies
285
+ → Safety gates at every step
286
+
287
+ 6. ITERATE
288
+ └─ Apply CLI commands → fly → analyze → repeat
289
+ → Database tracks score progression across sessions
290
+ → --history shows the full tuning journey
291
+ → Mismatch detection catches config drift
292
+ ```
293
+
294
+ ## Frame Size Profiles
295
+
296
+ The `--setup` mode provides conservative starting configurations:
297
+
298
+ | Frame | P Roll | P Pitch | D | Gyro LPF | Dyn Notch Min |
299
+ |-------|--------|---------|---|----------|---------------|
300
+ | 5" 4S | 44 | 46 | 30 | 120Hz | 100Hz |
301
+ | 7" 4S | 35 | 38 | 23 | 90Hz | 60Hz |
302
+ | 10" 4S | 25 | 28 | 18 | 65Hz | 50Hz |
303
+ | 12" 4S | 20 | 22 | 14 | 50Hz | 35Hz |
304
+ | 15" 4S | 15 | 16 | 10 | 40Hz | 25Hz |
305
+
306
+ Higher voltage (6S/8S/12S) scales P and D down proportionally.
307
+
308
+ ## INAV Version Support
309
+
310
+ Developed and tested against **INAV 9.0.x**. The blackbox binary decoder handles the shared Cleanflight/INAV encoding format. MSP v2 protocol for FC communication. Parameter names are INAV-specific - this toolkit does not support Betaflight.
311
+
312
+ ## Project Structure
313
+
314
+ ```
315
+ inav-toolkit/
316
+ ├── pyproject.toml # Package configuration (pip install)
317
+ ├── requirements.txt # Python dependencies
318
+ ├── README.md
319
+ ├── CHANGELOG.md
320
+ ├── LICENSE
321
+ ├── inav_toolkit/ # Python package
322
+ │ ├── __init__.py # Version: 2.14.1
323
+ │ ├── blackbox_analyzer.py # Blackbox log analyzer
324
+ │ ├── param_analyzer.py # Config validator + setup generator
325
+ │ ├── msp.py # MSP v2 serial communication
326
+ │ ├── wizard.py # Guided session manager
327
+ │ ├── flight_db.py # SQLite flight history database
328
+ │ ├── autotune.py # Experimental auto-tuning
329
+ │ └── vtol_configurator.py # VTOL mixer profile validator
330
+ ├── docs/
331
+ │ ├── BLACKBOX_ANALYZER.md # Detailed blackbox analyzer docs
332
+ │ ├── NAV_ANALYZER.md # Navigation health analysis docs
333
+ │ ├── PARAM_ANALYZER.md # Detailed parameter analyzer docs
334
+ │ ├── VTOL_CONFIGURATOR.md # Detailed VTOL configurator docs
335
+ │ └── TUNING_WORKFLOW.md # Step-by-step tuning guide
336
+ ├── tests/
337
+ │ ├── test_smoke.py # 50 tests across 11 test classes
338
+ │ ├── conftest.py # Shared pytest fixtures
339
+ │ ├── generate_fixtures.py # Synthetic blackbox CSV generator
340
+ │ ├── test_basic_diff.txt # Sample diff for param_analyzer tests
341
+ │ └── test_vtol_diff.txt # Sample diff for VTOL tests
342
+ └── .github/workflows/ci.yml # CI: Python 3.8-3.13 test matrix
343
+ ```
344
+
345
+ ## Development
346
+
347
+ ```bash
348
+ git clone https://github.com/agoliveira/INAV-Toolkit
349
+ cd INAV-Toolkit
350
+ python3 -m venv .venv
351
+ source .venv/bin/activate
352
+ pip install -e ".[test]"
353
+
354
+ # Generate synthetic test fixtures
355
+ python3 tests/generate_fixtures.py
356
+
357
+ # Run tests
358
+ python3 -m pytest tests/ -v
359
+ ```
360
+
361
+ CI runs automatically on every push and PR across Python 3.8-3.13.
362
+
363
+ ## Contributing
364
+
365
+ This is an active project. Contributions welcome.
366
+
367
+ ## License
368
+
369
+ GPL-3.0 License. See [LICENSE](LICENSE).
370
+
371
+ ## Acknowledgments
372
+
373
+ - The INAV development team and community
374
+ - QuadMeUp (Paweł Spychalski) for filter and RPM analysis research
375
+ - The INAV Fixed Wing Group for modes documentation
@@ -0,0 +1,14 @@
1
+ inav_toolkit/__init__.py,sha256=xYBSE3hrzhfSQDdVTmcbe3iMspkJEm3Pn8co-QeFcFg,130
2
+ inav_toolkit/autotune.py,sha256=LemxctIJvuaudsDKz3y9QwATgTmJeMU9-GhoeYZ7K9g,20514
3
+ inav_toolkit/blackbox_analyzer.py,sha256=5aEKf7H5lYSv1bhohzeZty20mu0X73IQgzVJ8HoaHDI,351093
4
+ inav_toolkit/flight_db.py,sha256=QC8zUXgfmuGaa8K8M-SpykGGn9FO_6xCZFGkNaljDJ4,16807
5
+ inav_toolkit/msp.py,sha256=pmRyVeO7QnkMNwe-dXfnMBDsx0uj46WBGWsbFkmNeiI,40996
6
+ inav_toolkit/param_analyzer.py,sha256=XOuQAOWOutG0Pra_YLpqj0YcxF4LNLHiHOHc3BdNUSY,122983
7
+ inav_toolkit/vtol_configurator.py,sha256=el5SMjO1QkS2FZaWc3H-s034Yt_8Tt8TZZBJgwwcep8,35813
8
+ inav_toolkit/wizard.py,sha256=x0KQRE7t6Cn3Jwhy7H4z8G444gDs_sMBkXbWLjFLQ7k,38154
9
+ inav_toolkit-2.15.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
10
+ inav_toolkit-2.15.0.dist-info/METADATA,sha256=tKrhXLNwZs5I7wb5Cfa8n3zOc2LOn5FpL8JpEkL4MxM,15156
11
+ inav_toolkit-2.15.0.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
12
+ inav_toolkit-2.15.0.dist-info/entry_points.txt,sha256=izJpHekrM3ENH1p27jNiKfmgdrAc9sOkH7N8AtGnXjg,189
13
+ inav_toolkit-2.15.0.dist-info/top_level.txt,sha256=AkBMhOHRUgjHwR2VnYp4RcxB6NWeZtGYRdLgtzOUpH0,13
14
+ inav_toolkit-2.15.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,5 @@
1
+ [console_scripts]
2
+ inav-analyze = inav_toolkit.blackbox_analyzer:main
3
+ inav-msp = inav_toolkit.msp:main
4
+ inav-params = inav_toolkit.param_analyzer:main
5
+ inav-toolkit = inav_toolkit.wizard:main