-
Notifications
You must be signed in to change notification settings - Fork 39
Motor test frontend #865
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Motor test frontend #865
Conversation
It now raises exceptions that the frontend should catch and display to the user. The motor diagrams are all png now, I've given up on svg. They're to hard to render correctly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a comprehensive motor test frontend for the ArduPilot Methodic Configurator project. The implementation provides a complete GUI solution for testing motor functionality, validating motor order and direction, and managing critical safety parameters.
Key changes:
- Complete motor test data model with 30+ methods and comprehensive exception handling using custom exception classes
- Full Tkinter GUI implementation with real-time feedback, safety warnings, and keyboard shortcuts
- Enhanced motor diagram download and conversion scripts with improved error handling and automatic PNG conversion
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
tests/test_data_model_motor_test.py |
Updated tests to handle new exception-based API with proper exception assertions and improved error handling |
scripts/download_motor_diagrams.py |
Enhanced with automatic PNG conversion integration and improved logging/error handling |
scripts/batch_convert_motor_diagrams.py |
Improved Firefox service setup with Windows path handling and enhanced debugging |
ardupilot_methodic_configurator/frontend_tkinter_motor_test.py |
New comprehensive motor test GUI with safety features, real-time feedback, and keyboard shortcuts |
ardupilot_methodic_configurator/data_model_motor_test.py |
Complete data model implementation with exception-based API and comprehensive parameter validation |
ardupilot_methodic_configurator/backend_flightcontroller.py |
Added fetch_param method for real-time parameter verification |
ardupilot_methodic_configurator/backend_filesystem_program_settings.py |
Updated to support PNG diagrams and hierarchical motor test settings |
ARCHITECTURE_motor_test.md |
Comprehensive documentation update reflecting implemented features and architecture decisions |
.vscode/launch.json |
Added debug configuration for motor test frontend development |
if os.name == "nt": # Windows | ||
# Replace backslashes with forward slashes and handle drive letter | ||
svg_abs_path = svg_abs_path.replace("\\", "/") | ||
svg_abs_path = f"file:///{svg_abs_path}" if svg_abs_path[1] == ":" else f"file://{svg_abs_path}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code assumes Windows paths have a drive letter at position 1, but this could cause an IndexError if svg_abs_path
is less than 2 characters long. Add a length check: if len(svg_abs_path) > 1 and svg_abs_path[1] == \":\":
svg_abs_path = f"file:///{svg_abs_path}" if svg_abs_path[1] == ":" else f"file://{svg_abs_path}" | |
svg_abs_path = f"file:///{svg_abs_path}" if len(svg_abs_path) > 1 and svg_abs_path[1] == ":" else f"file://{svg_abs_path}" |
Copilot uses AI. Check for mistakes.
raise ValidationError( | ||
_("Invalid throttle percentage %(throttle)d (valid range: %(min)d-%(max)d") | ||
% { | ||
"throttle": throttle_percent, | ||
"min": THROTTLE_PCT_MIN, | ||
"max": THROTTLE_PCT_MAX, | ||
} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message format string is missing the closing parenthesis. It should be \"Invalid throttle percentage %(throttle)d (valid range: %(min)d-%(max)d)\"
Copilot uses AI. Check for mistakes.
% {"duration": timeout_seconds, "min": DURATION_S_MIN, "max": DURATION_S_MAX} | ||
) | ||
if timeout_seconds > DURATION_S_MAX: | ||
raise ValidationError( | ||
_("Invalid test duration %(duration)d (valid range: %(min)d-%(max)d)") | ||
% {"duration": timeout_seconds, "min": DURATION_S_MIN, "max": DURATION_S_MAX} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar issue - using %(duration)d
format specifier for timeout_seconds
parameter, but timeout_seconds
might be a float. Either change the format to %(duration)g
or ensure the parameter is cast to int.
% {"duration": timeout_seconds, "min": DURATION_S_MIN, "max": DURATION_S_MAX} | |
) | |
if timeout_seconds > DURATION_S_MAX: | |
raise ValidationError( | |
_("Invalid test duration %(duration)d (valid range: %(min)d-%(max)d)") | |
% {"duration": timeout_seconds, "min": DURATION_S_MIN, "max": DURATION_S_MAX} | |
% {"duration": int(timeout_seconds), "min": DURATION_S_MIN, "max": DURATION_S_MAX} | |
) | |
if timeout_seconds > DURATION_S_MAX: | |
raise ValidationError( | |
_("Invalid test duration %(duration)d (valid range: %(min)d-%(max)d)") | |
% {"duration": int(timeout_seconds), "min": DURATION_S_MIN, "max": DURATION_S_MAX} |
Copilot uses AI. Check for mistakes.
_("Invalid test duration %(duration)d (valid range: %(min)d-%(max)d)") | ||
% {"duration": timeout_seconds, "min": DURATION_S_MIN, "max": DURATION_S_MAX} | ||
) | ||
if timeout_seconds > DURATION_S_MAX: | ||
raise ValidationError( | ||
_("Invalid test duration %(duration)d (valid range: %(min)d-%(max)d)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as above - using %(duration)d
format specifier but constants DURATION_S_MIN
and DURATION_S_MAX
are defined as floats (1.0, 60.0). Use %(duration)g
and %(min)g
, %(max)g
format specifiers instead.
_("Invalid test duration %(duration)d (valid range: %(min)d-%(max)d)") | |
% {"duration": timeout_seconds, "min": DURATION_S_MIN, "max": DURATION_S_MAX} | |
) | |
if timeout_seconds > DURATION_S_MAX: | |
raise ValidationError( | |
_("Invalid test duration %(duration)d (valid range: %(min)d-%(max)d)") | |
_("Invalid test duration %(duration)g (valid range: %(min)g-%(max)g)") | |
% {"duration": timeout_seconds, "min": DURATION_S_MIN, "max": DURATION_S_MAX} | |
) | |
if timeout_seconds > DURATION_S_MAX: | |
raise ValidationError( | |
_("Invalid test duration %(duration)g (valid range: %(min)g-%(max)g)") |
Copilot uses AI. Check for mistakes.
☂️ Python Coverage
Overall Coverage
New Files
Modified Files
|
Test Results 2 files 2 suites 1m 42s ⏱️ For more details on these failures, see this check. Results for commit 7bad852. |
No description provided.