Skip to content
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

Closed
wants to merge 45 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
0a8c6f8
Prelim Interop Testing
cjhr95 Oct 27, 2021
ad080ff
JSON Parsing for Waypoints & St. Obstacles
cjhr95 Mar 2, 2022
4849718
Prelim Base Flight Structure
cjhr95 Mar 4, 2022
e2ad2f7
Flight Structure w/o Decorators
cjhr95 Mar 9, 2022
c90eaa2
Settings w/ Decorators
cjhr95 Mar 9, 2022
51e3348
Test
cjhr95 Mar 16, 2022
c007851
JSON Parsing Documentation
cjhr95 Mar 23, 2022
59ef20b
Single Line Docstring and Test File Removal
cjhr95 Mar 23, 2022
17d9c3a
Documentation updates
cjhr95 Apr 8, 2022
86e31b9
Redundant Task
mat-px Nov 4, 2021
4be6bfc
pre-commit config from IARC
mat-px Nov 4, 2021
5c2816e
gitignore from IARC
mat-px Nov 4, 2021
332a2c0
Update .pre-commit-config.yaml
mat-px Nov 4, 2021
1b80126
Update README.md
mat-px Nov 4, 2021
5fed42d
Update README.md
mat-px Nov 4, 2021
e1fa9f7
Add json, xml, yaml, and mixed line ending hooks
mrouie Nov 5, 2021
c283b6a
Resolved errors
mrouie Nov 5, 2021
e3f7cfe
Create object bounding box script.
ClayJay3 Nov 5, 2021
fdee5e9
Update object_bounding_box.py
ClayJay3 Nov 10, 2021
a68ed20
Test file. remove pls
mrouie Mar 2, 2022
c85e276
Auto-Formatting
fallscameron01 Feb 9, 2022
317d562
Initial text detection
fallscameron01 Feb 9, 2022
3664a47
notes on random ideas
fallscameron01 Feb 9, 2022
db2ed9b
Updated format, typing
fallscameron01 Feb 11, 2022
91a8e3f
Filtering detected text
fallscameron01 Feb 11, 2022
d1cf74b
Plan for getting text color
fallscameron01 Feb 11, 2022
b05b5f9
Update doc, fix char check
fallscameron01 Feb 11, 2022
5dee156
Image processing, fixed detection
fallscameron01 Feb 16, 2022
ebb5cf6
Draw line around detected characters
fallscameron01 Feb 16, 2022
79f6418
Autoformatting
fallscameron01 Feb 16, 2022
26b1d7b
New preprocessing, rotate images
fallscameron01 Feb 23, 2022
058fbe4
Put functions in class
fallscameron01 Feb 23, 2022
089acfd
Add check for full-image text
fallscameron01 Feb 23, 2022
970e16f
Fix crop/rotation, cleanup
fallscameron01 Mar 2, 2022
ee9b833
Add get_text_characteristics, cleanup
fallscameron01 Mar 2, 2022
322595d
Cleanup and documentation updates
fallscameron01 Mar 2, 2022
25f1927
Add command line args
fallscameron01 Mar 4, 2022
a1961b3
Initial obstacle avoidance code
cmspencer109 Mar 4, 2022
7240e91
Document and type all functions
cmspencer109 Mar 6, 2022
b21c2d2
Resolve documentation issues and dead code
cmspencer109 Mar 9, 2022
117921c
Add poetry python dependencies and dev dependencies
mrouie Mar 11, 2022
aeb9168
Reformat file.
mrouie Mar 11, 2022
bbe1e1c
AirDrop & ODLC States
cjhr95 Apr 15, 2022
5c5a33f
Revert "Documentation updates"
cjhr95 Apr 15, 2022
1a6f2e0
Documentation
cjhr95 Apr 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions flight/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions flight/.idea/flight.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions flight/.idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions flight/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions flight/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions flight/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions flight/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""Initialization file for state exporting"""
from states.state import State
from states.pre_processing import PreProcess
from states.takeoff import Takeoff
from states.waypoints import Waypoints

STATES = {
mrouie marked this conversation as resolved.
Show resolved Hide resolved
"Pre-Processing": PreProcess,
"Takeoff": Takeoff,
"Waypoints": Waypoints
}
35 changes: 35 additions & 0 deletions flight/state_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""Class to contain setters and getters for settings in various flight states"""

DEFAULT_WAYPOINTS: int = 14
DEFAULT_RUN_TITLE: str = "N/A"
DEFAULT_RUN_DESCRIPTION: str = "N/A"


class StateSettings:
mrouie marked this conversation as resolved.
Show resolved Hide resolved
def __init__(self):
"""Default constructor results in default settings"""

mrouie marked this conversation as resolved.
Show resolved Hide resolved
# ---- Takeoff settings ---- #

def enable_simple_takeoff(self, simple_takeoff: bool) -> None:
"""
Setter for whether to perform simple takeoff instead of regular takeoff
simple_takeoff(bool): True for drone to go straight up, False to behave normally
"""
self.simple_takeoff = simple_takeoff

# ---- Waypoint Settings ---- #

def set_number_waypoints(self, waypoints: int) -> None:
"""Set the number of waypoints given by Interop System"""
self.num_waypoints = waypoints

# ---- Other settings ---- #

def set_run_title(self, title: str) -> None:
"""Set a title for the run/test to be output in logging"""
self.run_title = title

def set_run_description(self, description: str) -> None:
"""Set a description for the run/test to be output in logging"""
self.run_description = description
mrouie marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions flight/states/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions flight/states/.idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions flight/states/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions flight/states/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions flight/states/.idea/states.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions flight/states/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file added flight/states/main.py
Empty file.
12 changes: 12 additions & 0 deletions flight/states/pre_processing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""State to receive data from interop system and perform preliminary calculations"""
import logging
from state import State
from ..state_settings import StateSettings
from takeoff import Takeoff


class PreProcess(State):
mrouie marked this conversation as resolved.
Show resolved Hide resolved
async def data_retrieval(self, drone):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing type hints on drone and return type

"""Prelim function to accept data"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function docstring needs to name parameters and returns

return Takeoff(self.state_settings)

55 changes: 55 additions & 0 deletions flight/states/state.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
"""Base State class which all other states inherit"""
import logging
from mavsdk import System
from ..state_settings import StateSettings


class State:
"""
Base State class
Attributes:
drone (System): The drone object; used for flight.
"""

def __init__(self, state_settings: StateSettings):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing function docstring and type hint for return type

Copy link
Member

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

logging.info('State "%s" has begun', self.name)
self.state_settings = state_settings

async def run(self, drone: System):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing return type hint

Copy link
Member

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

"""
Does all of the operations for the state
Parameters
----------
drone : System
The drone system; used for flight operations.
Returns
-------
State or None
Either the next State in the machine or None if the machine stops
Raises
------
Exception
If this function hasn't been overloaded.
"""
raise Exception("Run not implemented for state")

async def _check_arm_or_arm(self, drone: System):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing return type hint

Copy link
Member

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

"""
Verifies that the drone is armed, if not armed, arms the drone
Parameters
----------
drone : System
The drone system; used for flight operations.
"""
async for is_armed in drone.telemetry.armed():
if not is_armed:
logging.debug("Not armed. Attempting to arm")
await drone.action.arm()
else:
logging.warning("Drone armed")
break

@property
def name(self):
"""Returns the name of the class"""
return type(self).__name__
11 changes: 11 additions & 0 deletions flight/states/takeoff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""Run takeoff function to launch drone to minimum altitude"""
import logging
from state import State
from ..state_settings import StateSettings
from waypoints import Waypoints


class Takeoff(State):
mrouie marked this conversation as resolved.
Show resolved Hide resolved
async def run(self, drone):
Copy link
Member

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

"""Run offboard functions to have the drone takeoff"""
return Waypoints(self.state_settings)
10 changes: 10 additions & 0 deletions flight/states/waypoints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""Run flight plan assembled in pre-rpocessing to fly to all waypoints sequentially"""
import logging
from state import State
from ..state_settings import StateSettings


class Waypoints(State):
mrouie marked this conversation as resolved.
Show resolved Hide resolved
async def run(self, drone):
Copy link
Member

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

"""Run waypoint path plan with obstacle avoidance running throughout"""
return
File renamed without changes.
File renamed without changes.