-
Notifications
You must be signed in to change notification settings - Fork 20.6k
Convert apm.pdef.json format to match COMPONENT_METADATA spec #32596
Description
Summary
ArduPilot provides parameter metadata via apm.pdef.json (generated by
Tools/autotest/param_metadata/param_parse.py). The MAVLink spec defines its own
parameter metadata schema via COMPONENT_METADATA (parameter.schema.json).
These two schemas differ in structure and supported fields, which creates friction
for GCS developers who need to support both.
Schema Comparison
| Field | ArduPilot apm.pdef.json |
MAVLink parameter.schema.json |
|---|---|---|
| Structure | Flat dict keyed by param name | Array of param objects |
| Param name | Dict key | name field |
| Type | Not included | type (Float, Int32, Uint8, etc.) |
| Short description | DisplayName |
shortDesc |
| Long description | Description |
longDesc |
| Range | Range: {low, high} |
min / max (flat fields) |
| Default value | Not present | default |
| Decimal places | Not present | decimalPlaces |
| Increment | Increment |
increment |
| Units | Units + UnitText |
units (single field) |
| Enum values | Values: {"0": "label"} dict |
values array of {value, description} objects |
| Bitmask | Bitmask: {"0": "label"} dict |
bitmask array of {index, description} objects |
| Grouping | User: "Standard"/"Advanced" |
group + category (two separate fields) |
| Read-only | ReadOnly: true |
Not in spec |
| Volatile | Volatile: true |
volatile: true |
| Reboot required | RebootRequired: true |
rebootRequired: true |
Impact
GCS developers must maintain two separate parsers/code paths to consume ArduPilot
parameter metadata, depending on whether they are using the offline apm.pdef.json
or the live COMPONENT_METADATA protocol. Field naming differences, structural
differences, and missing fields (notably ReadOnly and parameter type) mean the
two cannot be trivially mapped to each other.
Proposed Solution
Consider aligning ArduPilot's apm.pdef.json output more closely with the MAVLink
parameter.schema.json spec, and/or propose upstream additions to the MAVLink spec
to cover fields present in ArduPilot's format but absent from the spec (e.g. readOnly).
References
- MAVLink parameter schema: https://github.com/mavlink/mavlink/blob/master/component_metadata/parameter.schema.json
- MAVLink COMPONENT_METADATA protocol: https://mavlink.io/en/services/component_metadata.html
- ArduPilot param metadata generator:
Tools/autotest/param_metadata/param_parse.py - ArduPilot GCS resources: https://ardupilot.org/dev/docs/gcs-resources.html