Skip to content

Commit 0c99800

Browse files
committed
feat(configuration steps): Add vehicle project migration to format version 1 before filesystem init
- Introduce backend_filesystem_migration.py - Adds format-version migration support for legacy vehicle projects - Handles parameter extraction from old files into new step files - Creates new fixed-content parameter files - Removes obsolete legacy files - Updates vehicle_components.json format version after migration - Integrate migration into startup in __main__.py - Run migrate_vehicle_project_if_needed(state.args.vehicle_dir) before LocalFilesystem creation - Ensures renamed/split parameter files exist before local filesystem initialization Update step metadata in JSON: - configuration_steps_ArduCopter.json - Add new step entries for migrated files (04_imu_temperature_calibration_finish.param, 07_remote_controller_controller.param, 10_battery_monitor.param, 17_safety_setup.param, 14_logging.param, 26_pid_notch_filter_logging.param, 45_autotune_finish.param, 49_windspeed_estimation_finish.param, plus others) - Adjust derived/forced/delete parameter logic for new step placement Testing / validation notes: - backend_filesystem_migration.py compiles successfully - Updated JSON files parse correctly This commit makes legacy vehicle project upgrades automatic and consistent with the new parameter file layout and step metadata.
1 parent 6a00a80 commit 0c99800

688 files changed

Lines changed: 5644 additions & 4384 deletions

File tree

Some content is hidden

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

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ venv/
2020
test.txt
2121
test.xml
2222

23+
**/apm.pdef.xml
24+
2325
sitl/arducopter
2426
sitl/firmware-version.txt
2527
sitl/git-version.txt

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,13 @@ And continue with the [*ArduPilot Methodic configurator* software GUI](https://a
185185

186186
- [13_general_configuration.param](https://ardupilot.github.io/MethodicConfigurator/TUNING_GUIDE_ArduCopter#610-general-configuration) general misc configuration
187187
- [Test if the hardware diagnostics are OK](https://ardupilot.github.io/MethodicConfigurator/TUNING_GUIDE_ArduCopter#611-ardupilot-hardware-report)
188-
- [14_logging.param](https://ardupilot.github.io/MethodicConfigurator/TUNING_GUIDE_ArduCopter#612-configure-logging) configure Dataflash/SDCard logging (black box data)
188+
- [17_remote_id.param](https://ardupilot.github.io/MethodicConfigurator/TUNING_GUIDE_ArduCopter#615-remote-id-aka-drone-id) required by law in many countries
189189
- [15_motor.param](https://ardupilot.github.io/MethodicConfigurator/TUNING_GUIDE_ArduCopter#613-motorpropeller-order-and-direction-test) motor order and direction tests.
190190
ESC linearization.
191-
- [16_pid_adjustment.parm](https://ardupilot.github.io/MethodicConfigurator/TUNING_GUIDE_ArduCopter#614-optional-pid-adjustment) attitude PID gains (vehicle size dependent)
192-
- [17_remote_id.param](https://ardupilot.github.io/MethodicConfigurator/TUNING_GUIDE_ArduCopter#615-remote-id-aka-drone-id) required by law in many countries
193191
- [18_notch_filter_setup.param](https://ardupilot.github.io/MethodicConfigurator/TUNING_GUIDE_ArduCopter#616-notch-filters-setup) to remove motor noise,
194192
reduce power consumption and increase flight stability
193+
- [14_logging.param](https://ardupilot.github.io/MethodicConfigurator/TUNING_GUIDE_ArduCopter#612-configure-logging) configure Dataflash/SDCard logging (black box data)
194+
- [16_pid_adjustment.param](https://ardupilot.github.io/MethodicConfigurator/TUNING_GUIDE_ArduCopter#614-optional-pid-adjustment) attitude PID gains (vehicle size dependent)
195195

196196
### 1.7 Assemble propellers and perform the first flight
197197

@@ -203,10 +203,10 @@ These are the very [minimum tuning steps](https://ardupilot.github.io/MethodicCo
203203
required for a stable flight:
204204

205205
- Load the `.bin` log file from the first flight into [Notch filter webtool](https://firmware.ardupilot.org/Tools/WebTools/FilterReview/)
206-
- [19_notch_filter_results.param](https://ardupilot.github.io/MethodicConfigurator/TUNING_GUIDE_ArduCopter#81-notch-filter-calibration) use the webtool information to
207-
configure the notch filter(s)
208206
- [20_throttle_controller.param](https://ardupilot.github.io/MethodicConfigurator/TUNING_GUIDE_ArduCopter#82-configure-the-throttle-controller) the altitude controller
209207
depends on the power-to-thrust ratio found in the first flight
208+
- [19_notch_filter_results.param](https://ardupilot.github.io/MethodicConfigurator/TUNING_GUIDE_ArduCopter#81-notch-filter-calibration) use the webtool information to
209+
configure the notch filter(s)
210210
- [21_ekf_config.param](https://ardupilot.github.io/MethodicConfigurator/TUNING_GUIDE_ArduCopter#83-configure-the-ekf-altitude-source-weights) sometimes
211211
the EKF3 needs a tune to maintain altitude
212212
- [22_quick_tune_setup.param](https://ardupilot.github.io/MethodicConfigurator/TUNING_GUIDE_ArduCopter#84-second-flight-pid-vtol-quiktune-lua-script-or-manual-pid-tune) and
@@ -223,9 +223,6 @@ These are the [standard tuning steps](https://ardupilot.github.io/MethodicConfig
223223
flight path or fly manually, store the results using
224224
[25_inflight_magnetometer_fit_results.param](https://ardupilot.github.io/MethodicConfigurator/TUNING_GUIDE_ArduCopter#912-calculate-inflight-magfit-calibration), use the
225225
[magfit webtool](https://firmware.ardupilot.org/Tools/WebTools/MAGFit/) to calculate a file that the ardupilot methodic configurator can use
226-
- [26_quick_tune_setup.param](https://ardupilot.github.io/MethodicConfigurator/TUNING_GUIDE_ArduCopter#921-setup-quicktune) and
227-
[27_quick_tune_results.param](https://ardupilot.github.io/MethodicConfigurator/TUNING_GUIDE_ArduCopter#922-store-quicktune-results-to-file) Redo quick-tune now that
228-
the compass magnetic interference is fully calibrated
229226
- [28_evaluate_the_aircraft_tune_ff_disable.param](https://ardupilot.github.io/MethodicConfigurator/TUNING_GUIDE_ArduCopter#93-fifth-flight-evaluate-the-aircraft-tune---part-1)
230227
and
231228
[29_evaluate_the_aircraft_tune_ff_enable.param](https://ardupilot.github.io/MethodicConfigurator/TUNING_GUIDE_ArduCopter#94-sixth-flight-evaluate-the-aircraft-tune---part-2)

ardupilot_methodic_configurator/__main__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from ardupilot_methodic_configurator import _, __version__
3737
from ardupilot_methodic_configurator.backend_filesystem import LocalFilesystem
3838
from ardupilot_methodic_configurator.backend_filesystem_freedesktop import FreeDesktop
39+
from ardupilot_methodic_configurator.backend_filesystem_migration import migrate_vehicle_project_if_needed
3940
from ardupilot_methodic_configurator.backend_filesystem_program_settings import ProgramSettings
4041
from ardupilot_methodic_configurator.backend_flightcontroller import DEVICE_FC_PARAM_FROM_FILE, FlightController
4142
from ardupilot_methodic_configurator.backend_internet import verify_and_open_url, webbrowser_open_url
@@ -356,6 +357,11 @@ def initialize_filesystem(state: ApplicationState) -> None:
356357
SystemExit: If there's a fatal error reading parameter files
357358
358359
"""
360+
# Migrate the vehicle project to the latest format version if needed.
361+
# This must run before LocalFilesystem is created so that parameter files are
362+
# in their new locations when rename_parameter_files() runs inside re_init().
363+
migrate_vehicle_project_if_needed(state.args.vehicle_dir)
364+
359365
# Initialize local filesystem
360366
try:
361367
state.local_filesystem = LocalFilesystem(

0 commit comments

Comments
 (0)