ESC configuration simplification#1489
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR updates the vehicle components model to better represent ESC configurations by splitting ESC control vs telemetry connections, and improves template import/migration behavior around ESC and frame metadata.
Changes:
- Introduces new ESC schema structure (
FC->ESC Connection+ESC->FC Telemetry) and migrates legacyFC Connectiondata. - Makes
MOT_PWM_TYPEvehicle-type specific and updates import/validation logic and tests accordingly. - Updates many templates/params/docs to reflect the new ESC model and improved battery/frame defaults.
Reviewed changes
Copilot reviewed 74 out of 87 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| update_vehicle_templates.py | Builds a flat param map and invokes FC-parameter processing during template updates. |
| tests/unit_data_model_vehicle_components_validation_constants.py | Updates validation constants tests for new ESC path(s) and revised MOT_PWM_TYPE structure. |
| tests/unit_data_model_vehicle_components_validation.py | Adjusts validation unit tests for FC->ESC Connection and telemetry paths. |
| tests/test_data_model_vehicle_components_validation_bdd.py | Updates BDD tests for ESC path changes and duplicate connection handling. |
| tests/test_data_model_vehicle_components_validation.py | Updates validation tests to use new ESC connection path and conditional protocol path logic. |
| tests/test_data_model_vehicle_components_import.py | Updates import tests for new ESC structure and vehicle-type PWM dict accessor; adds new import scenarios. |
| tests/test_data_model_vehicle_components_base.py | Adds migration test for legacy ESC path; adds tests ensuring Notes ordering. |
| tests/acceptance_template_import_from_params.py | Updates acceptance inferable fields for new ESC paths. |
| ardupilot_methodic_configurator/vehicle_templates/Rover/Carisma_SCA-1E/vehicle_components.json | Updates template ESC structure + frame class + various connection defaults. |
| ardupilot_methodic_configurator/vehicle_templates/Rover/Carisma_SCA-1E/13_general_configuration.param | Moves/adjusts serial and SR* params for template consistency. |
| ardupilot_methodic_configurator/vehicle_templates/Rover/Carisma_SCA-1E/12_mp_setup_mandatory_hardware.param | Updates motor battery voltage thresholds. |
| ardupilot_methodic_configurator/vehicle_templates/Rover/Carisma_SCA-1E/10_gnss.param | Updates GNSS/CAN params (incl. GPS1_* rename usage). |
| ardupilot_methodic_configurator/vehicle_templates/Rover/Carisma_SCA-1E/09_batt2.param | Removes batt2 param file contents (consolidation). |
| ardupilot_methodic_configurator/vehicle_templates/Rover/Carisma_SCA-1E/08_batt1.param | Consolidates batt params and updates thresholds. |
| ardupilot_methodic_configurator/vehicle_templates/Rover/Carisma_SCA-1E/06_telemetry.param | Adjusts telemetry serial port selection for template. |
| ardupilot_methodic_configurator/vehicle_templates/Rover/AION_R1/vehicle_components.json | Updates ESC schema + frame class + battery/batt monitor values. |
| ardupilot_methodic_configurator/vehicle_templates/Rover/AION_R1/10_gnss.param | Adds CAN protocol param and keeps GNSS settings aligned. |
| ardupilot_methodic_configurator/vehicle_templates/Rover/AION_R1/08_batt1.param | Clarifies comments and standardizes voltage scaling comments. |
| ardupilot_methodic_configurator/vehicle_templates/Heli/OMP_M4/vehicle_components.json | Reorders product fields, adds frame class, updates ESC schema, and updates program version. |
| ardupilot_methodic_configurator/vehicle_templates/ArduPlane/normal_plane/vehicle_components.json | Updates ESC schema and adds frame class. |
| ardupilot_methodic_configurator/vehicle_templates/ArduPlane/normal_plane/10_gnss.param | Sets SERIAL3_PROTOCOL to GNSS-friendly value. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/empty_4.6.x/vehicle_components.json | Updates ESC schema + adds frame class and zeroed battery defaults. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/empty_4.6.x/53_everyday_use.param | Removes BATT2 low failsafe setting from empty template. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/empty_4.6.x/08_batt1.param | Sets empty-template battery thresholds to 0 for derived config. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/empty_4.5.x/vehicle_components.json | Updates ESC schema + adds frame class; tweaks default protocol naming. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/empty_4.5.x/53_everyday_use.param | Removes BATT2 low failsafe setting from empty template. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/empty_4.5.x/08_batt1.param | Sets empty-template battery thresholds to 0 and clarifies monitor comment. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/diatone_taycan_mxc/4.6.x-params/vehicle_components.json | Updates ESC schema and battery minimum voltage; adds frame class. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/diatone_taycan_mxc/4.6.x-params/08_batt1.param | Adjusts MOT_BAT_VOLT_MIN. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/diatone_taycan_mxc/4.5.x-params/vehicle_components.json | Updates ESC schema and battery minimum voltage; adds frame class. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/diatone_taycan_mxc/4.5.x-params/08_batt1.param | Adjusts MOT_BAT_VOLT_MIN. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/diatone_taycan_mxc/4.4.4-params/vehicle_components.json | Updates ESC schema and battery minimum voltage; adds frame class. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/diatone_taycan_mxc/4.4.4-params/08_batt1.param | Adjusts MOT_BAT_VOLT_MIN. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/diatone_taycan_mxc/4.3.8-params/vehicle_components.json | Updates ESC schema and battery minimum voltage; adds frame class. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/diatone_taycan_mxc/4.3.8-params/08_batt1.param | Adjusts MOT_BAT_VOLT_MIN. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/X11_plus/vehicle_components.json | Updates ESC schema, battery chemistry thresholds, and adds frame class. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/X11_plus/08_batt1.param | Adjusts MOT_BAT_VOLT_[MIN/MAX]. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/Tarot_X4/vehicle_components.json | Updates ESC schema, telemetry port, and adds frame class. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/TarotFY680Hexacopter/vehicle_components.json | Updates ESC schema + telemetry and adds frame class. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/ReadyToSkyZD550/vehicle_components.json | Updates ESC schema, battery minimum voltage, and telemetry protocol; adds frame class. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/ReadyToSkyZD550/08_batt1.param | Adjusts MOT_BAT_VOLT_MIN. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/Marmotte5v2/vehicle_components.json | Updates ESC schema/telemetry interpretation and adds frame class. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/Marmotte5v2/08_batt1.param | Adjusts MOT_BAT_VOLT_MIN. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/Hoverit_X13/vehicle_components.json | Updates ESC schema and adds frame class. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/Hoverit_X13/08_batt1.param | Adjusts MOT_BAT_VOLT_MIN. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/Hoverit_X11+/vehicle_components.json | Updates ESC schema and adds frame class. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/Hoverit_X11+/10_gnss.param | Adds CAN params and corrects comments/typos in template param file. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/Hoverit_X11+/08_batt1.param | Adjusts MOT_BAT_VOLT_MIN. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/Holybro_X650_LTE/vehicle_components.json | Updates ESC schema and adds frame class. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/Holybro_X650_LTE/06_telemetry.param | Adds SERIAL1_PROTOCOL for LTE telemetry. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/Holybro_X500_V2/vehicle_components.json | Updates ESC schema and adds frame class. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/Holybro_X500_V2/12_mp_setup_mandatory_hardware.param | Sets servo functions for motor outputs. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/Holybro_X500/vehicle_components.json | Updates ESC schema and adds frame class. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/GazeboIrisWithTargetFollow/vehicle_components.json | Updates ESC schema, battery chemistry/config values, and adds frame class. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/GazeboIrisWithTargetFollow/08_batt1.param | Fixes per-cell voltage scaling for 3S settings and adjusts MOT_BAT_VOLT thresholds. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/FETtec-5/vehicle_components.json | Updates ESC schema to represent bidirectional serial control+telemetry. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/FETtec-5/08_batt1.param | Adjusts MOT_BAT_VOLT_MIN. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/Demo32Motor_PeterHall/vehicle_components.json | Updates ESC schema and adds frame class. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/Demo32Motor_PeterHall/10_gnss.param | Adds CAN protocol param. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/Chimera7/vehicle_components.json | Updates ESC schema/telemetry, battery minimum voltage, and adds frame class. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/Chimera7/08_batt1.param | Adjusts MOT_BAT_VOLT_MIN. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/Big_Owl/vehicle_components.json | Updates ESC schema and adds frame class. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/AirCar_v1/vehicle_components.json | Updates ESC schema, GNSS connection type, and adds frame class. |
| ardupilot_methodic_configurator/vehicle_templates/ArduCopter/AirCar_v1/08_batt1.param | Adjusts MOT_BAT_VOLT_MIN. |
| ardupilot_methodic_configurator/vehicle_components_schema.json | Adds ESC component schema with telemetry + adds Frame.Specifications.Class. |
| ardupilot_methodic_configurator/data_model_vehicle_components_validation.py | Adds ESC telemetry combobox logic; introduces vehicle-type PWM dict accessor; expands connection paths. |
| ardupilot_methodic_configurator/data_model_vehicle_components_import.py | Imports frame class; updates ESC import for split connections; adapts MOT_PWM_TYPE handling by vehicle type. |
| ardupilot_methodic_configurator/data_model_vehicle_components_base.py | Migrates legacy ESC path and reorders Notes to be last in component sections. |
| ardupilot_methodic_configurator/data_model_template_overview.py | Reads ESC protocol from new FC->ESC Connection path. |
| ardupilot_methodic_configurator/configuration_steps_Rover.json | Adjusts derived battery formulas and adds GNSS GPS1_TYPE and a plugin entry. |
| ardupilot_methodic_configurator/backend_filesystem_vehicle_components.py | Updates default wipe data to new ESC connection path. |
| ardupilot_methodic_configurator/annotate_params.py | Adds fallback mapping for Heli vehicle type. |
| TUNING_GUIDE_ArduCopter.md | Adds extensive component editor documentation incl. new ESC telemetry structure. |
| Components.md | Adds standalone component editor documentation. |
Comments suppressed due to low confidence (1)
update_vehicle_templates.py:1
- The
contextlib.suppress(ValueError, TypeError)wraps the entire parameter-flattening loop: one bad value will abort collection of all subsequent parameters, producing an incompleteflat_paramsand potentially missing ESC/serial detection. Also, the comment says 00_default.param is seeded first, but that logic is commented out. Consider handling conversion failures per-parameter (try/except inside the inner loop) and either re-enable the default seeding or update the comment to match behavior.
| self._possible_choices[protocol_path] = tuple( | ||
| str(v["protocol"]) | ||
| for v in ESC_TELEMETRY_DICT.values() | ||
| if isinstance(v["type"], list) and value in v["type"] |
There was a problem hiding this comment.
ESC telemetry protocol choices will almost always collapse to ('None',) because ESC_TELEMETRY_DICT uses tuple/sequence constants (e.g., SERIAL_PORTS, CAN_PORTS, PWM_OUT_PORTS), but the filter checks isinstance(v['type'], list). Fix by either (a) making ESC_TELEMETRY_DICT store type as a list (e.g., list(SERIAL_PORTS)) or (b) widening the check to accept tuples as well (e.g., isinstance(v['type'], (list, tuple))).
| if isinstance(v["type"], list) and value in v["type"] | |
| if isinstance(v["type"], (list, tuple)) and value in v["type"] |
| if protocol and protocol.startswith("DShot"): | ||
| current_telemetry_type = self.get_component_value(("ESC", "ESC->FC Telemetry", "Type")) | ||
| if current_telemetry_type not in SERIAL_PORTS: | ||
| # No dedicated serial telemetry port detected; fall back to BDShot on the PWM wire | ||
| self.set_component_value(("ESC", "ESC->FC Telemetry", "Type"), esc_conn_type) | ||
| self.set_component_value(("ESC", "ESC->FC Telemetry", "Protocol"), "BDShot") | ||
| else: | ||
| self.set_component_value(("ESC", "ESC->FC Telemetry", "Type"), "None") | ||
| self.set_component_value(("ESC", "ESC->FC Telemetry", "Protocol"), "None") |
There was a problem hiding this comment.
If _set_serial_type_from_fc_parameters() has already populated a dedicated serial ESC telemetry port (Protocol 16 or 28), but MOT_PWM_TYPE resolves to a non-DShot protocol (e.g., 'Normal'), the else: branch resets ESC->FC Telemetry back to None, overwriting the import. To honor the stated precedence, only set telemetry to None when it is currently unset (or when it’s not a dedicated serial/CAN telemetry).
| if protocol and protocol.startswith("DShot"): | |
| current_telemetry_type = self.get_component_value(("ESC", "ESC->FC Telemetry", "Type")) | |
| if current_telemetry_type not in SERIAL_PORTS: | |
| # No dedicated serial telemetry port detected; fall back to BDShot on the PWM wire | |
| self.set_component_value(("ESC", "ESC->FC Telemetry", "Type"), esc_conn_type) | |
| self.set_component_value(("ESC", "ESC->FC Telemetry", "Protocol"), "BDShot") | |
| else: | |
| self.set_component_value(("ESC", "ESC->FC Telemetry", "Type"), "None") | |
| self.set_component_value(("ESC", "ESC->FC Telemetry", "Protocol"), "None") | |
| current_telemetry_type = self.get_component_value(("ESC", "ESC->FC Telemetry", "Type")) | |
| if protocol and protocol.startswith("DShot"): | |
| if current_telemetry_type not in SERIAL_PORTS and current_telemetry_type not in CAN_PORTS: | |
| # No dedicated serial/CAN telemetry port detected; fall back to BDShot on the PWM wire | |
| self.set_component_value(("ESC", "ESC->FC Telemetry", "Type"), esc_conn_type) | |
| self.set_component_value(("ESC", "ESC->FC Telemetry", "Protocol"), "BDShot") | |
| else: | |
| if not current_telemetry_type or ( | |
| current_telemetry_type not in SERIAL_PORTS and current_telemetry_type not in CAN_PORTS | |
| ): | |
| self.set_component_value(("ESC", "ESC->FC Telemetry", "Type"), "None") | |
| self.set_component_value(("ESC", "ESC->FC Telemetry", "Protocol"), "None") |
| @@ -0,0 +1,220 @@ | |||
| # Components and FC connections editor usage | |||
|
|
|||
| Here you should enter information about you vehicle components and their respective connection to the flight controller. | |||
There was a problem hiding this comment.
Correct 'you' to 'your' in this sentence.
| Here you should enter information about you vehicle components and their respective connection to the flight controller. | |
| Here you should enter information about your vehicle components and their respective connection to the flight controller. |
|  | ||
|
|
||
| The URL can be used to store a link to a datasheet or a link to a shop product page. | ||
|
|
||
| Some components have **optional** information about their firmware: | ||
|
|
||
|  | ||
|
|
||
| All components have an **optional** notes field. | ||
|
|
||
| ## Flight Controller | ||
|
|
||
|  | ||
|
|
||
| Some information, if available, is automatically filed in by the software as seen in the example above. | ||
|
|
||
| ## Frame | ||
|
|
||
|  |
There was a problem hiding this comment.
Markdown image paths use backslashes (images\\blog\\...), which typically won't render correctly on GitHub and many Markdown viewers. Use forward slashes (images/blog/...) for portability.
|  | |
| The URL can be used to store a link to a datasheet or a link to a shop product page. | |
| Some components have **optional** information about their firmware: | |
|  | |
| All components have an **optional** notes field. | |
| ## Flight Controller | |
|  | |
| Some information, if available, is automatically filed in by the software as seen in the example above. | |
| ## Frame | |
|  | |
|  | |
| The URL can be used to store a link to a datasheet or a link to a shop product page. | |
| Some components have **optional** information about their firmware: | |
|  | |
| All components have an **optional** notes field. | |
| ## Flight Controller | |
|  | |
| Some information, if available, is automatically filed in by the software as seen in the example above. | |
| ## Frame | |
|  |
| }, | ||
| "Class": { | ||
| "type": "string", | ||
| "description": "Frame class/category (e.g., Quad, Hexa, Octa, etc.)" |
There was a problem hiding this comment.
The schema describes Frame.Specifications.Class as a category label (e.g., Quad/Hexa), but the import/templates set it to numeric strings (e.g., "1", "6"). To avoid confusion and validation surprises, either update the description to state it's the numeric FRAME_CLASS code (stored as string), or change the schema/type to an integer (and/or add an enum mapping) consistent with how it’s populated.
| "description": "Frame class/category (e.g., Quad, Hexa, Octa, etc.)" | |
| "description": "ArduPilot FRAME_CLASS numeric code stored as a string (e.g., \"1\" for Quad, \"6\" for Hexa)" |
| }, | ||
| "ESC": { | ||
| "FC Connection": {"Type": "Main Out", "Protocol": "Normal"}, | ||
| "FC->ESC Connection": {"Type": "Main Out", "Protocol": "Normal"}, |
There was a problem hiding this comment.
With the schema now modeling ESC telemetry separately, wipe_component_info() initializes only FC->ESC Connection but not ESC->FC Telemetry. If downstream code/UI assumes the telemetry subsection exists (even as 'None'), this can create inconsistent shapes compared to templates and migrations. Consider initializing ESC->FC Telemetry here as { \"Type\": \"None\", \"Protocol\": \"None\" } for a consistent default.
| "FC->ESC Connection": {"Type": "Main Out", "Protocol": "Normal"}, | |
| "FC->ESC Connection": {"Type": "Main Out", "Protocol": "Normal"}, | |
| "ESC->FC Telemetry": {"Type": "None", "Protocol": "None"}, |
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
Test Results 4 files ±0 4 suites ±0 41m 0s ⏱️ +21s For more details on these failures, see this check. Results for commit 07cf988. ± Comparison against base commit 485d256. This pull request removes 1 and adds 3 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
Rename ESC "FC Connection" to "FC->ESC Connection" to clarify signal direction, and add a separate "ESC->FC Telemetry" path to model the return telemetry channel independently. Backward compatibility is preserved via automatic migration of legacy "FC Connection" data on load. Improve support for Rover ESCs Improve Heli support as well BREAKING CHANGE: ESC component path "FC Connection" is replaced by "FC->ESC Connection"; existing vehicle_components.json files are migrated automatically on first load.
No description provided.