Skip to content

Extend FRAME_CLASS support to ArduPlane VTOL and Heli variants#1584

Merged
amilcarlucas merged 1 commit into
masterfrom
frame_class_combobox
May 3, 2026
Merged

Extend FRAME_CLASS support to ArduPlane VTOL and Heli variants#1584
amilcarlucas merged 1 commit into
masterfrom
frame_class_combobox

Conversation

@amilcarlucas
Copy link
Copy Markdown
Collaborator

Description

  • Fall back to Q_FRAME_CLASS/Q_FRAME_TYPE in get_frame_info() for ArduPlane VTOL support
  • Populate ArduPlane entry in FRAME_CLASS_DICT (mirrors Q_FRAME_CLASS values)
  • Add missing Heli frame classes (Undefined, SingleCopter, CoaxCopter, BiCopter)
  • Rename get_frame_class_sub_dict to get_frame_class_as_protocol_dict and change return type to dict[str, dict[str, str]] for _verify_dict_is_uptodate() compatibility
  • Add get_frame_class_valid_tuple() to exclude "Undefined" from GUI choices
  • Add ArduPlane to ESC_CONNECTION_DICT (Q_M_PWM_TYPE protocol mapping)
  • Validate FRAME_CLASS against allowed values in component editor
  • Update tests and bump verify call count from 5 to 6

Checklist

  • Run pre-commit checks locally
  • Verified by a human programmer
  • All commits are signed off (use git commit --signoff)
  • Code follows our coding standards
  • Documentation updated if needed
  • No breaking changes or properly documented

Testing

Describe how you tested these changes:

  • Unit tests pass
  • Integration tests pass
  • Manual testing performed
  • Tested on flight controller hardware

Copilot AI review requested due to automatic review settings May 3, 2026 18:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extends frame-class handling across vehicle types to better support ArduPlane VTOL (QuadPlane) and additional Heli variants, and wires frame-class choices/validation into the vehicle components data model and import flow.

Changes:

  • Add ArduPlane + additional Heli frame-class entries, plus helpers to present frame-class data in “protocol dict” shape and to generate GUI-valid frame-class choice tuples.
  • Update FC-parameter import and business-logic frame parsing to fall back to Q_FRAME_CLASS / Q_FRAME_TYPE when FRAME_CLASS / FRAME_TYPE are absent.
  • Expand ESC connection constants/tests to include an ArduPlane entry and adjust verification/test expectations.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
ardupilot_methodic_configurator/backend_flightcontroller_business_logic.py Adds Q_FRAME_* fallbacks in get_frame_info().
ardupilot_methodic_configurator/data_model_vehicle_components_import.py Uses the new frame-class helpers during import and adds a new dictionary verification call.
ardupilot_methodic_configurator/data_model_vehicle_components_validation.py Adds ArduPlane ESC/frame-class mappings, new frame-class helper functions, and updates GUI choice initialization/side-effects.
tests/test_backend_flightcontroller_business_logic.py Adds unit tests for Q_FRAME_* fallback and precedence behavior.
tests/test_data_model_vehicle_components_import.py Adds import tests for ArduPlane Q_FRAME_CLASS and bumps dict verification call-count expectation.
tests/test_data_model_vehicle_components_validation.py Adds validation and side-effect tests ensuring “Undefined” frame class is rejected and that firmware type updates frame choices.
tests/unit_data_model_vehicle_components_validation_constants.py Updates constant-structure tests and adds coverage for new frame-class + ArduPlane ESC constants.

Comment on lines +187 to +194
self._verify_dict_is_uptodate(doc, get_frame_class_as_protocol_dict(fw_type), "FRAME_CLASS", "values")

# Process frame information if FRAME_CLASS is present in FC parameters
if "FRAME_CLASS" in fc_parameters:
# Process frame information if FRAME_CLASS or Q_FRAME_CLASS is present in FC parameters
if "FRAME_CLASS" in fc_parameters or "Q_FRAME_CLASS" in fc_parameters:
frame_class, _ = get_frame_info(fc_parameters)
self.set_component_value(
("Frame", "Specifications", "Frame class"),
get_frame_class_sub_dict(fw_type).get(frame_class, "Undefined"),
)
frame_class_entry = get_frame_class_as_protocol_dict(fw_type).get(str(frame_class))
frame_class_label = frame_class_entry.get("protocol") if isinstance(frame_class_entry, dict) else "Undefined"
self.set_component_value(("Frame", "Specifications", "Frame class"), frame_class_label)
Comment on lines +404 to 406
return tuple(v for v in FRAME_CLASS_DICT.get(vehicle_type, FRAME_CLASS_DICT["ArduCopter"]).values() if v != "Undefined")


"6": {"type": PWM_OUT_PORTS, "protocol": "DShot600", "ESC_to_FC": ESC_TO_FC_TELEMETRY_DSHOT},
"7": {"type": PWM_OUT_PORTS, "protocol": "DShot1200", "ESC_to_FC": ESC_TO_FC_TELEMETRY_DSHOT},
"8": {"type": PWM_OUT_PORTS, "protocol": "PWMRange", "ESC_to_FC": ESC_TO_FC_TELEMETRY_NONE},
"9": {"type": PWM_OUT_PORTS, "protocol": "PWMAngle", "ESC_to_FC": ESC_TO_FC_TELEMETRY_NONE},
Comment on lines +184 to +187
fw_type = str(self.get_component_value(("Flight Controller", "Firmware", "Type")) or "")
self._verify_dict_is_uptodate(doc, get_esc_connection_sub_dict(fw_type), "MOT_PWM_TYPE", "values")
self._verify_dict_is_uptodate(doc, RC_PROTOCOLS_DICT, "RC_PROTOCOLS", "Bitmask")
self._verify_dict_is_uptodate(doc, get_frame_class_as_protocol_dict(fw_type), "FRAME_CLASS", "values")
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 3, 2026

☂️ Code Coverage

current status: ✅

Overall Coverage

Statements Covered Coverage Threshold Status
12578 11859 94% 89% 🟢

New Files

No new covered files...

Modified Files

No covered modified files...

updated for commit: 7e3b5cc by action🐍

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 3, 2026

Test Results

     4 files  ± 0       4 suites  ±0   40m 47s ⏱️ -41s
 3 675 tests +23   3 673 ✅ +23   2 💤 ±0  0 ❌ ±0 
14 492 runs  +92  14 468 ✅ +91  24 💤 +1  0 ❌ ±0 

Results for commit 7e3b5cc. ± Comparison against base commit 4f29eba.

This pull request removes 4 and adds 27 tests. Note that renamed tests count towards both.
tests.unit_data_model_vehicle_components_validation_constants.TestFrameClassDict ‑ test_arduplane_frame_class_is_empty
tests.unit_data_model_vehicle_components_validation_constants.TestFrameClassDict ‑ test_get_frame_class_sub_dict_empty_string_falls_back_to_arducopter
tests.unit_data_model_vehicle_components_validation_constants.TestFrameClassDict ‑ test_get_frame_class_sub_dict_known_vehicle_types
tests.unit_data_model_vehicle_components_validation_constants.TestFrameClassDict ‑ test_get_frame_class_sub_dict_unknown_type_falls_back_to_arducopter
tests.test_backend_flightcontroller_business_logic.TestFrameInfo ‑ test_defaults_to_1_when_all_frame_params_absent
tests.test_backend_flightcontroller_business_logic.TestFrameInfo ‑ test_frame_class_takes_priority_over_q_frame_class_when_both_present
tests.test_backend_flightcontroller_business_logic.TestFrameInfo ‑ test_frame_type_takes_priority_over_q_frame_type_when_both_present
tests.test_backend_flightcontroller_business_logic.TestFrameInfo ‑ test_vtol_plane_uses_q_frame_class_when_frame_class_absent
tests.test_backend_flightcontroller_business_logic.TestFrameInfo ‑ test_vtol_plane_uses_q_frame_type_when_frame_type_absent
tests.test_data_model_vehicle_components_import.TestComponentDataModelImport ‑ test_frame_class_set_to_undefined_when_code_not_in_dict
tests.test_data_model_vehicle_components_import.TestComponentDataModelImport ‑ test_frame_class_takes_priority_over_q_frame_class_during_import
tests.test_data_model_vehicle_components_import.TestComponentDataModelImport ‑ test_user_can_import_frame_class_from_q_frame_class_for_vtol_plane
tests.test_data_model_vehicle_components_validation.TestComponentDataModelValidation ‑ test_validate_all_data_rejects_undefined_frame_class
tests.test_data_model_vehicle_components_validation.TestComponentDataModelValidationUncoveredBranches ‑ test_init_possible_choices_frame_class_reflects_stored_firmware_type
…

♻️ This comment has been updated with latest results.

…L and Heli variants

- Fall back to Q_FRAME_CLASS/Q_FRAME_TYPE in get_frame_info() for ArduPlane VTOL support
- Populate ArduPlane entry in FRAME_CLASS_DICT (mirrors Q_FRAME_CLASS values)
- Add missing Heli frame classes (Undefined, SingleCopter, CoaxCopter, BiCopter)
- Rename get_frame_class_sub_dict to get_frame_class_as_protocol_dict and change
  return type to dict[str, dict[str, str]] for _verify_dict_is_uptodate() compatibility
- Add get_frame_class_valid_tuple() to exclude "Undefined" from GUI choices
- Add ArduPlane to ESC_CONNECTION_DICT (Q_M_PWM_TYPE protocol mapping)
- Validate FRAME_CLASS against allowed values in component editor
- Update tests and bump verify call count from 5 to 6
@amilcarlucas amilcarlucas force-pushed the frame_class_combobox branch from e9443de to 7e3b5cc Compare May 3, 2026 20:18
@amilcarlucas amilcarlucas merged commit 4e9c2da into master May 3, 2026
29 of 31 checks passed
@amilcarlucas amilcarlucas deleted the frame_class_combobox branch May 3, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants