-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature/flight structure #29
Conversation
Make sure there's proper docstrings and type hinting everywhere, also I'd like you to put a single-line comment on all constants for their usage and purpose. Also make sure all the xml files have comment headers at the beginning of the files after the xml version documenting the purpose and usage of the file. |
flight/states/state.py
Outdated
""" | ||
raise Exception("Run not implemented for state") | ||
|
||
async def _check_arm_or_arm(self, drone: System): |
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.
Missing return type hint
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.
Still missing return type hint
flight/states/takeoff.py
Outdated
|
||
|
||
class Takeoff(State): | ||
async def run(self, drone): |
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.
Missing docstring's params & returns and all function header type hints
flight/states/waypoints.py
Outdated
|
||
|
||
class Waypoints(State): | ||
async def run(self, drone): |
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.
Missing function header type hints and function docstring
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.
Make sure you run black on your code manually until I get the pre-commit set up
flight/state_settings.py
Outdated
__run_description: Description for Competition | ||
""" | ||
def __init__(self, takeoff_bool: bool = False, num_waypoints: int = DEFAULT_WAYPOINTS, | ||
title: str = DEFAULT_RUN_TITLE, description: str = DEFAULT_RUN_DESCRIPTION): |
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.
Missing type annotation for None return type
flight/states/final_state.py
Outdated
Member Variables: | ||
None | ||
""" | ||
async def run(self, drone: System): |
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.
Missing None return type annotation
flight/states/state.py
Outdated
drone (System): The drone object; used for flight. | ||
""" | ||
|
||
def __init__(self, state_settings: StateSettings): |
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.
Still missing docstring & return type hint
flight/states/state.py
Outdated
logging.info('State "%s" has begun', self.name) | ||
self.state_settings = state_settings | ||
|
||
async def run(self, drone: System): |
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.
Still missing return type hint
flight/states/state.py
Outdated
""" | ||
raise Exception("Run not implemented for state") | ||
|
||
async def _check_arm_or_arm(self, drone: System): |
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.
Still missing return type hint
flight/util/json_parsing.py
Outdated
f = open(filename, ) | ||
data_set = json.load(f) | ||
# print(data_set) | ||
f.close() |
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.
You should also definitely use a context manager whenever possible
It can avoid headaches when it comes to resource management
flight/util/json_parsing.py
Outdated
f = open(filename, ) | ||
data_set = json.load(f) | ||
# print(data_set) | ||
f.close() |
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 here, use a context manager
flight/util/json_parsing.py
Outdated
stationary_Obs = [] | ||
|
||
for i in range(0, len(data_set["stationaryObstacles"])): | ||
stationary_Obs.append(data_set["stationaryObstacles"][i]) | ||
|
||
return stationary_Obs |
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.
Also use a list comp here as well
flight/util/json_parsing.py
Outdated
return waypoint_Locs | ||
|
||
|
||
def stationary_obstacle_parsing(filename: str): |
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.
please annotate your return type and initialized variables :)
also you're missing a docstring here too
flight/state_settings.py
Outdated
self.__simple_takeoff = takeoff_bool | ||
self.__num_waypoints = num_waypoints | ||
self.__run_title = title | ||
self.__run_description = description |
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 know it may seem redundant, but since this is the first time we're referencing these variable names,
they should be typed as well
This reverts commit 17d9c3a.
Some basic repos for utility files and bare-bones states for state machine.