-
Notifications
You must be signed in to change notification settings - Fork 1
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
Read Mavlink from CSV file. Modules completed with tests #65
Conversation
Completed my task with tests written. My main concern is if the pilots make a mistake with the params. Like if a value that should be zero is not set to zero (e.g. param2 for waypoint). I wonder if there should be more safeguarding in that sense? |
Another thing I'm concerned about is whether the code should crash if they forget a command parameter. Say, a 0 is missed. I don't think they'd want a drone to accidentally skip a command without warning. Gonna actually make that a crash |
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.
Reviewed.
def generate_command_advanced( | ||
frame: str, | ||
command_type: str, | ||
param1: float, # I'm anxious about this because of do_jump which requires ints |
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 function can dispatch to more specialized functions to construct the various commands.
modules/advanced_csv_to_commands.py
Outdated
param5: float, | ||
param6: float, | ||
param7: float, | ||
) -> "tuple[bool,dronekit.Command]": |
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.
"tuple[bool, dronekit.Command | None]"
modules/advanced_csv_to_commands.py
Outdated
frame: The command's frame of reference. Frame should be one of the following two values. | ||
- global (usually used for landing or return to launch) | ||
- global_relative_alt (all other commands, such as waypoint, spline waypoint, etc.) | ||
|
||
command_type: The command type. Depending on this value, params 1 through 7 will take on different meanings. This should be one of the following enums: | ||
- land: | ||
- return_to_launch: Return to the home location where the vehicle was last armed. | ||
- takeoff | ||
- waypoint: Navigate to the specified waypoint | ||
- waypoint_spline | ||
- loiter_timed: Loiter at the specified location for an specified amount of time | ||
- loiter_unlimited: Loiter at the specified location for an unlimited amount of time | ||
- do_jump: Jump to the specified command in the mission list. |
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.
I think linking the Confluence document is sufficient, no need to repeat the information from the dictionary above or the information in the document.
modules/advanced_csv_to_commands.py
Outdated
- A list of dronekit commands that represent the mission | ||
|
||
""" | ||
# Does the file path exist? |
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.
Remove.
modules/advanced_csv_to_commands.py
Outdated
with open(mission_file_path, encoding="utf-8") as file: | ||
for line in file: | ||
# Skip header and empty lines | ||
parts = line.split(",") |
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.
Move below the conditional below.
modules/advanced_csv_to_commands.py
Outdated
return False, None | ||
|
||
frame, command_type, param1, param2, param3, param4, param5, param6, param7 = parts | ||
success, command = generate_command_advanced( |
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.
result, command =
modules/advanced_csv_to_commands.py
Outdated
float(param6), | ||
float(param7), | ||
) | ||
# Was the command successfully generated? |
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.
Remove.
modules/advanced_csv_to_commands.py
Outdated
if len(mission) > 0: | ||
return True, mission | ||
|
||
return False, None |
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.
Switch:
if len(mission) == 0:
return False, None
return True, mission
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.
lgtm, nice job!
1: Parameter should be a float | ||
2: Parameter should be an integer | ||
""" | ||
COMMAND_TO_PARAMETER_MATRIX = { |
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 could also be ENUMs
No description provided.