MethodicConfigurator

Flight-Controller Parameter Export Architecture

Overview

The flight-controller parameter export feature creates a standalone .param snapshot of the current ArduPilot flight-controller (FC) values. It is launched from the Parameter Editor and uses a modal Tkinter window to let the user select parameter categories before choosing an output filename.

The export workflow is deliberately separate from the sequential configuration-step workflow:

Requirements and Implementation Status

Functional Requirements

  1. FC-connected entry point: the Parameter Editor enables the export action only when current FC values are available and passes an independent FC snapshot to the modal.
  2. Category filtering: the modal exposes four filter pairs, applies the selected pairs with AND semantics, and updates the matching count as selections change. User explanations and selection guidance are documented in USERMANUAL_fc_parameter_export.md.
  3. Value classification: the data model classifies calibration, read-only, default, and limit state using ArduPilot metadata and current FC values.
  4. Descriptive filename: the save dialog receives a vehicle- and filter-derived .param filename suggestion.
  5. Parameter serialization: selected values are converted to ParDict and written using the standard Mission Planner serializer. MAVProxy and QGroundControl formats are not implemented.
  6. Optional annotation: the selected output file may be annotated with cached ArduPilot documentation.
  7. Standalone FC-backed entry point: the module connects to a real FC, downloads values/defaults, opens the same modal, and disconnects after the GUI closes.

Non-Functional Requirements

Architecture

Component Relationships

flowchart TD
    FC[Flight Controller]
    FCB[FlightController]
    PE[ParameterEditor]
    PEW[ParameterEditorWindow]
    EXP[ParameterExportWindow]
    PAR[ArduPilotParameter objects]
    FIL[ParameterExportFilters]
    PD[ParDict]
    DOC[update_parameter_documentation]
    OUT[User-selected .param file]

    FC --> FCB
    FCB --> PE
    PEW -->|Export parameters| PE
    PE -->|get_fc_parameters_for_export| PAR
    PEW --> EXP
    EXP -->|checkbox state| FIL
    EXP -->|filter_parameters_for_export| PE
    PE -->|selected objects| PAR
    PAR -->|parameters_as_par_dict| PD
    PD --> OUT
    EXP -->|optional annotation| PE
    PE --> DOC
    DOC --> OUT

Components

Parameter Editor Entry Point

Export Window

The window uses a small parent interface containing root, parameter_editor, and ui. The standalone harness supplies that interface with a typed cast because it intentionally does not construct the full Parameter Editor window.

Export Filter Model

Parameter Editor Export Operations

ParameterEditor exposes thin compatibility facades for the snapshot, filtering, export, and conversion functions so existing editor workflows retain one data-model entry point. The Tkinter frontend contains no export policy or serialization logic.

Parameter and Metadata Models

External Adapters

Filter Semantics

filter_parameters_for_export() evaluates each selector pair and intersects the four row results. Both selections in a pair accept every value for that property; neither selection accepts none. The limit predicate is implemented as inside-or-undocumented limits = not outside limits, where outside limits means that the FC value is above an available documented maximum or below an available documented minimum. Missing bounds therefore do not classify a parameter as outside; user-facing explanations and examples are maintained in USERMANUAL_fc_parameter_export.md.

Data Flow

In-Application Export

  1. The FC connection and parameter cache are established by the normal application flow.
  2. The user presses Export parameters in the Parameter Editor.
  3. get_fc_parameters_for_export() creates independent parameter objects from the FC cache and available metadata/defaults.
  4. ParameterExportWindow initializes its default selector state and calculates the initial count.
  5. The user changes selectors; each change re-runs filter_parameters_for_export() and updates the count.
  6. The user presses Export.
  7. The window builds the suggested filename and opens the .param save dialog.
  8. The selected objects are filtered again using the current checkbox state.
  9. export_parameters() converts the objects to ParDict and writes the selected file.
  10. If annotation is enabled, documentation comments are added to the chosen file.
  11. The modal closes without changing the active configuration step.

Standalone Export

  1. The module parses FC connection, vehicle, filesystem, and common logging arguments.
  2. FlightController.connect() establishes a real FC connection.
  3. ParameterEditor.download_flight_controller_parameters() downloads FC values and available defaults.
  4. The standalone host creates the same ParameterExportWindow used by the main application.
  5. The user performs the same filtering and export workflow.
  6. Closing the host exits the Tk event loop.
  7. A finally block disconnects the FC.

Integration Points

Error Handling

Testing Strategy

Implemented Tests

Coverage Gaps

Security and Safety Considerations

Known Limitations and Recommendations

  1. Format support ⚠️: add explicit format selection only when the supported output formats and their semantics are agreed upon.
  2. Filter test coverage ⚠️: add focused data-model tests for pair truth tables, especially the neither-selected case and partial-bound classification.
  3. Export progress ⚠️: add a progress callback if export or standalone download needs to support very large parameter sets or slower links.
  4. Portability guidance ⚠️: consider a stronger warning or separate action when calibration or outside-limit values are selected for export.
  5. Architecture integration ✅: keep this workflow as a child of the Parameter Editor rather than duplicating FC connection, metadata loading, or parameter serialization logic.