Project from bin#1549
Conversation
530c76c to
baa0c52
Compare
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds an end-to-end “create project from ArduPilot .bin log” workflow, including backend helpers, manager orchestration, a Tkinter UI entry point, and unit tests to validate the behavior.
Changes:
- Introduces
.binlog import helpers onVehicleProjectCreatorand an orchestration method onVehicleProjectManager. - Adds a Tkinter widget/button flow to select a
.binfile and trigger project creation. - Adds unit tests for helper methods and manager orchestration paths (success, missing params export, error propagation, FC sync).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_data_model_vehicle_project_creator.py | Adds unit tests for new .bin import helper methods (template path, naming, slot selection, extraction errors). |
| tests/test_data_model_vehicle_project.py | Adds unit tests covering create_new_vehicle_from_bin_log orchestration and side-effects. |
| ardupilot_methodic_configurator/frontend_tkinter_project_opener.py | Surfaces the new .bin import option in the project opener UI. |
| ardupilot_methodic_configurator/frontend_tkinter_directory_selection.py | Adds BinLogSelectionWidgets to select a .bin file and handle import errors. |
| ardupilot_methodic_configurator/data_model_vehicle_project_creator.py | Implements static helpers for .bin imports (template dir, stem, filename slotting, param extraction). |
| ardupilot_methodic_configurator/data_model_vehicle_project.py | Implements create_new_vehicle_from_bin_log workflow and missing-param export logic. |
baa0c52 to
d87e4e7
Compare
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified FilesNo covered modified files...
|
Test Results 4 files 4 suites 41m 22s ⏱️ Results for commit 0d21426. ♻️ This comment has been updated with latest results. |
cf18c07 to
05c293d
Compare
29afbcd to
7919c22
Compare
| def next_import_filename(vehicle_dir: str) -> str: | ||
| """Return the next available numbered parameter filename for imported log parameters.""" | ||
| highest_prefix = 0 | ||
| for file_path in Path(vehicle_dir).iterdir(): | ||
| if not file_path.is_file() or file_path.suffix != ".param": | ||
| continue | ||
| prefix = file_path.name[:2] | ||
| if prefix.isdigit(): | ||
| highest_prefix = max(highest_prefix, int(prefix)) | ||
|
|
||
| next_prefix = highest_prefix + 1 | ||
| if next_prefix > 99: | ||
| msg = _("Could not create an import parameter file because no numbered slot is available in {vehicle_dir}") | ||
| raise VehicleProjectCreationError(_("Parameter import"), msg.format(vehicle_dir=vehicle_dir)) | ||
| return f"{next_prefix:02d}_imported_bin_log_parameters.param" |
There was a problem hiding this comment.
Path(vehicle_dir).iterdir()can raiseOSError(e.g., permission issues, missing directory, broken symlink). Right now that would bypass the intendedVehicleProjectCreationError("Parameter import", ...)path and surface as a raw exception. Consider catchingOSErroraround the directory iteration and re-raising asVehicleProjectCreationErrorwith the"Parameter import"title and a message that includesvehicle_dir` and the underlying error text.
f5fc551 to
d88ac45
Compare
…file Add a "Create a vehicle project from a .bin log file" button to the New Vehicle panel in the project-opener window. Orchestration in data_model_vehicle_project.py (create_new_vehicle_from_bin_log): - Scaffolds the project from empty_4.6.x with current FC params used for template substitution - Replaces the template's 00_default.param with the .bin-extracted defaults snapshot (key deviation from normal template-based creation) - Exports remaining current parameters into a numbered *_imported_bin_log_parameters.param file GUI additions: - BinLogSelectionWidgets reusable widget added to frontend_tkinter_directory_selection.py - Widget wired into VehicleProjectOpenerWindow.create_option1_widgets() Address Copilot PR review comments for bin log import feature - Move open_vehicle_directory() to end of create_new_vehicle_from_bin_log() to ensure UI/session operates on authoritative filesystem state after all file modifications (fixes stale state issue) - Add exception handler for VehicleProjectOpenError in BinLogSelectionWidgets UI to display friendly error dialog instead of crashing - Extract template directory name to BIN_IMPORT_TEMPLATE_DIR class constant to reduce duplication and ease future maintenance when template version changes - Add clarifying multi-line comment explaining why infer_comp_specs_and_conn_from_fc_params and use_fc_params flags are reused for log-derived parameters All 100 tests pass, all code quality checks pass.
d88ac45 to
88bc6be
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Amilcar Lucas <amilcar.lucas@iav.de>
Description
Add a "Create a vehicle project from a .bin log file" button to the
New Vehicle panel in the project-opener window.
Business logic additions in data_model_vehicle_project_creator.py:
for both "defaults" and "values" snapshots; wraps results as ParDict
.bin file stem
imported parameter file
Orchestration in data_model_vehicle_project.py
(create_new_vehicle_from_bin_log):
template substitution
defaults snapshot (key deviation from normal template-based creation)
*_imported_bin_log_parameters.param file
GUI additions:
frontend_tkinter_directory_selection.py
Checklist
git commit --signoff)Testing
Describe how you tested these changes: