Extend FRAME_CLASS support to ArduPlane VTOL and Heli variants#1584
Merged
Conversation
Contributor
There was a problem hiding this comment.
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_TYPEwhenFRAME_CLASS/FRAME_TYPEare 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") |
Contributor
☂️ Code Coverage
Overall Coverage
New FilesNo new covered files... Modified FilesNo covered modified files...
|
Contributor
Test Results 4 files ± 0 4 suites ±0 40m 47s ⏱️ -41s 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.♻️ 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
e9443de to
7e3b5cc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Checklist
git commit --signoff)Testing
Describe how you tested these changes: