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

Refactor mainline #242

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
42 changes: 21 additions & 21 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ignore=CVS

# Add files or directories matching the regex patterns to the blacklist. The
# regex matches against base names, not paths.
ignore-patterns=
# ignore-patterns=

# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
Expand Down Expand Up @@ -43,7 +43,7 @@ unsafe-load-any-extension=no

# Only show warnings with the listed confidence levels. Leave empty to show
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
confidence=
# confidence=

# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
Expand Down Expand Up @@ -186,13 +186,13 @@ max-spelling-suggestions=4

# Spelling dictionary name. Available dictionaries: none. To make it working
# install python-enchant package.
spelling-dict=
# spelling-dict=

# List of comma separated words that should not be checked.
spelling-ignore-words=
# spelling-ignore-words=

# A path to a file that contains private dictionary; one word per line.
spelling-private-dict-file=
# spelling-private-dict-file=

# Tells whether to store unknown words to indicated private dictionary in
# --spelling-private-dict-file option instead of raising a message.
Expand All @@ -216,7 +216,7 @@ contextmanager-decorators=contextlib.contextmanager
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E1101 when accessed. Python regular
# expressions are accepted.
generated-members=
# generated-members=

# Tells whether missing members accessed in mixin class should be ignored. A
# mixin class is detected if its name ends with "mixin" (case insensitive).
Expand All @@ -239,7 +239,7 @@ ignored-classes=optparse.Values,thread._local,_thread._local,str
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis. It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=
ignored-modules=numpy

# Show a hint with possible names when a member name was not found. The aspect
# of finding the hint is based on edit distance.
Expand All @@ -258,7 +258,7 @@ missing-member-max-choices=1

# List of additional names supposed to be defined in builtins. Remember that
# you should avoid to define new builtins when possible.
additional-builtins=
# additional-builtins=

# Tells whether unused global variables should be treated as a violation.
allow-global-unused-variables=yes
Expand Down Expand Up @@ -343,14 +343,14 @@ argument-naming-style=snake_case

# Regular expression matching correct argument names. Overrides argument-
# naming-style
#argument-rgx=
# argument-rgx=

# Naming style matching correct attribute names
attr-naming-style=snake_case

# Regular expression matching correct attribute names. Overrides attr-naming-
# style
#attr-rgx=
# attr-rgx=

# Bad variable names which should always be refused, separated by a comma
bad-names=foo,
Expand All @@ -371,14 +371,14 @@ class-attribute-naming-style=any
class-naming-style=PascalCase

# Regular expression matching correct class names. Overrides class-naming-style
#class-rgx=
# class-rgx=

# Naming style matching correct constant names
const-naming-style=UPPER_CASE

# Regular expression matching correct constant names. Overrides const-naming-
# style
#const-rgx=
# const-rgx=

# Minimum line length for functions/classes that require docstrings, shorter
# ones are exempt.
Expand All @@ -389,7 +389,7 @@ function-naming-style=snake_case

# Regular expression matching correct function names. Overrides function-
# naming-style
#function-rgx=
# function-rgx=

# Good variable names which should always be accepted, separated by a comma
good-names=i,
Expand All @@ -407,25 +407,25 @@ inlinevar-naming-style=any

# Regular expression matching correct inline iteration names. Overrides
# inlinevar-naming-style
#inlinevar-rgx=
# inlinevar-rgx=

# Naming style matching correct method names
method-naming-style=snake_case

# Regular expression matching correct method names. Overrides method-naming-
# style
#method-rgx=
# method-rgx=

# Naming style matching correct module names
module-naming-style=snake_case

# Regular expression matching correct module names. Overrides module-naming-
# style
#module-rgx=
# module-rgx=

# Colon-delimited sets of names that determine each other's naming style when
# the name regexes allow several styles.
name-group=
# name-group=

# Regular expression which should only match function or class names that do
# not require a docstring.
Expand All @@ -440,7 +440,7 @@ variable-naming-style=snake_case

# Regular expression matching correct variable names. Overrides variable-
# naming-style
#variable-rgx=
# variable-rgx=


[IMPORTS]
Expand All @@ -462,15 +462,15 @@ ext-import-graph=

# Create a graph of every (i.e. internal and external) dependencies in the
# given file (report RP0402 must not be disabled)
import-graph=
# import-graph=

# Create a graph of internal dependencies in the given file (report RP0402 must
# not be disabled)
int-import-graph=
# int-import-graph=

# Force import order to recognize a module as part of the standard
# compatibility libraries.
known-standard-library=
# known-standard-library=

# Force import order to recognize a module as part of a third party library.
known-third-party=enchant
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ install:
- pip3 install tox-travis

script:
- tox -e lint,vtol -c tox.ini
- tox -e lint,hex -c tox.ini
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[![Build Status](https://travis-ci.com/NGCP/VTOL.svg?token=pzpV4AQm2iKJkxHKKsEz&branch=master)](https://travis-ci.com/NGCP/VTOL)
[![Build Status](https://travis-ci.com/NGCP/HEX.svg?token=pzpV4AQm2iKJkxHKKsEz&branch=master)](https://travis-ci.com/NGCP/HEX)
36 changes: 18 additions & 18 deletions archives/detailed_search_autonomy.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,43 +80,43 @@ def orbit_poi(vehicle, poi, configs):
waypoints.append(LocationGlobalRelative(lat, lon, alt))

# Go to center of POI
if (configs["vehicle_type"] == "VTOL"):
if (configs["vehicle_type"] == "HEX"):
cmds.add(
Command(0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 0, 0,
0, waypoint_tolerance, 0, 0, poi.lat, poi.lon, poi_scan_altitude))

elif (configs["vehicle_type"] == "Quadcopter"):
elif (configs["vehicle_type"] == "Hexcopter"):
cmds.add(
Command(0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 0, 0,
0, 0, 0, 0, poi.lat, poi.lon, poi_scan_altitude))

# Transition to quadcopter if applicable
if (configs["vehicle_type"] == "VTOL"):
# Transition to hexcopter if applicable
if (configs["vehicle_type"] == "HEX"):
cmds.add(
Command(0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_DO_VTOL_TRANSITION,
Command(0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_DO_HEX_TRANSITION,
0, 0,
mavutil.mavlink.MAV_VTOL_STATE_MC, 0, 0, 0, 0, 0, 0))
mavutil.mavlink.MAV_HEX_STATE_MC, 0, 0, 0, 0, 0, 0))

# Circular waypoints
if (configs["vehicle_type"] == "VTOL"):
if (configs["vehicle_type"] == "HEX"):
for point in waypoints:
cmds.add(
Command(0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 0,
0,
waypoint_tolerance, 0, 0, 0, point.lat, point.lon, point.alt))
elif (configs["vehicle_type"] == "Quadcopter"):
elif (configs["vehicle_type"] == "Hexcopter"):
for point in waypoints:
cmds.add(
Command(0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 0,
0,
0, 0, 0, 0, point.lat, point.lon, point.alt))

# Transition to forward flight if applicable
if (configs["vehicle_type"] == "VTOL"):
if (configs["vehicle_type"] == "HEX"):
cmds.add(
Command(0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_DO_VTOL_TRANSITION,
Command(0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_DO_HEX_TRANSITION,
0, 0,
mavutil.mavlink.MAV_VTOL_STATE_MC, 0, 0, 0, 0, 0, 0))
mavutil.mavlink.MAV_HEX_STATE_MC, 0, 0, 0, 0, 0, 0))

# Add dummy endpoint
cmds.add(
Expand All @@ -139,15 +139,15 @@ def detailed_search_adds_mission(configs, vehicle):
cmds.clear()

# Due to a bug presumed to be the fault of DroneKit, the first command is ignored. Thus we have two takeoff commands
if (configs["vehicle_type"] == "VTOL"):
# Separate MAVlink message for a VTOL takeoff. This takes off to altitude and transitions
if (configs["vehicle_type"] == "HEX"):
# Separate MAVlink message for a HEX takeoff. This takes off to altitude and transitions
cmds.add(
Command(0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_NAV_VTOL_TAKEOFF, 0,
Command(0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_NAV_HEX_TAKEOFF, 0,
0, 0, 0, 0, 0, 0, 0, altitude))
cmds.add(
Command(0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_NAV_VTOL_TAKEOFF, 0,
Command(0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_NAV_HEX_TAKEOFF, 0,
0, 0, 0, 0, 0, 0, 0, altitude))
elif (configs["vehicle_type"] == "Quadcopter"):
elif (configs["vehicle_type"] == "Hexcopter"):
cmds.add(
Command(0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_NAV_TAKEOFF, 0, 0,
0, 0, 0, 0, 0, 0, altitude))
Expand Down Expand Up @@ -233,9 +233,9 @@ def detailed_search_autonomy(configs, autonomyToCV, GCS_TIMESTAMP, CONNECTION_TI

# Holds the copter in place if receives pause
if autonomy.PAUSE_MISSION:
if (configs["vehicle_type"] == "VTOL"):
if (configs["vehicle_type"] == "HEX"):
vehicle.mode = VehicleMode("QHOVER")
elif (configs["vehicle_type"] == "Quadcopter"):
elif (configs["vehicle_type"] == "Hexcopter"):
vehicle.mode = VehicleMode("ALT_HOLD")
change_status("paused")

Expand Down
4 changes: 2 additions & 2 deletions archives/executable_picker.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
'''
The GCS allocates roles to vehicles. The purpose of this program is to connect to the GCS and then
read a start message from the GCS, which contains a certain job_type. It then runs the
corresponding VTOL program (quick scan, detailed search, guide) based on the start message.
corresponding HEX program (quick scan, detailed search, guide) based on the start message.
'''
import sys
import json
import time
from util import parse_configs, new_output_file
from autonomy import VTOL
from autonomy import HEX
import autonomy

XBEE = None
Expand Down
18 changes: 9 additions & 9 deletions archives/quick_scan_autonomy.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ def quick_scan_adds_mission(configs, vehicle, lla_waypoint_list):
print(" Define/add new commands.")

# Due to a bug presumed to be the fault of DroneKit, the first command is ignored. Thus we have two takeoff commands
if (configs["vehicle_type"] == "VTOL"):
# Separate MAVlink message for a VTOL takeoff. This takes off to altitude and transitions
cmds.add(Command( 0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_NAV_VTOL_TAKEOFF, 0, 0, 0, 0, 0, 0, 0, 0, altitude))
cmds.add(Command( 0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_NAV_VTOL_TAKEOFF, 0, 0, 0, 0, 0, 0, 0, 0, altitude))
if (configs["vehicle_type"] == "HEX"):
# Separate MAVlink message for a HEX takeoff. This takes off to altitude and transitions
cmds.add(Command( 0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_NAV_HEX_TAKEOFF, 0, 0, 0, 0, 0, 0, 0, 0, altitude))
cmds.add(Command( 0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_NAV_HEX_TAKEOFF, 0, 0, 0, 0, 0, 0, 0, 0, altitude))

elif (configs["vehicle_type"] == "Quadcopter"):
elif (configs["vehicle_type"] == "Hexcopter"):
cmds.add(Command( 0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_NAV_TAKEOFF, 0, 0, 0, 0, 0, 0, 0, 0, altitude))
cmds.add(Command( 0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_NAV_TAKEOFF, 0, 0, 0, 0, 0, 0, 0, 0, altitude))

Expand All @@ -174,15 +174,15 @@ def quick_scan_adds_mission(configs, vehicle, lla_waypoint_list):
0, configs["air_speed"], -1, 0, 0, 0, 0))

# Add waypoints to the auto mission
if (configs["vehicle_type"] == "VTOL"):
if (configs["vehicle_type"] == "HEX"):
for point in lla_waypoint_list:
# Planes need a waypoint tolerance
cmds.add(Command(0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 0, 0,
0, configs["waypoint_tolerance"], 0, 0, point.lat, point.lon, point.alt))
# Adds dummy end point - this endpoint is the same as the last waypoint and lets us know we have reached destination.
cmds.add(Command(0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 0, 0,
0, configs["waypoint_tolerance"], 0, 0, lla_waypoint_list[-1].lat, lla_waypoint_list[-1].lon, lla_waypoint_list[-1].alt))
elif (configs["vehicle_type"] == "Quadcopter"):
elif (configs["vehicle_type"] == "Hexcopter"):
for point in lla_waypoint_list:
cmds.add(Command(0, 0, 0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 0, 0,
0, 0, 0, 0, point.lat, point.lon, point.alt))
Expand Down Expand Up @@ -259,9 +259,9 @@ def quick_scan_autonomy(configs, autonomyToCV, GCS_TIMESTAMP, CONNECTION_TIMESTA
time.sleep(1)
# Holds the copter in place if receives pause
if autonomy.PAUSE_MISSION:
if (configs["vehicle_type"] == "VTOL"):
if (configs["vehicle_type"] == "HEX"):
vehicle.mode = VehicleMode("QHOVER")
elif (configs["vehicle_type"] == "Quadcopter"):
elif (configs["vehicle_type"] == "Hexcopter"):
vehicle.mode = VehicleMode("ALT_HOLD")
# Lands the vehicle if receives stop mission
elif autonomy.STOP_MISSION:
Expand Down
17 changes: 14 additions & 3 deletions comm_sim_example.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
[
{
{
"time": 5.0,
"message" : {
"type": "RTL",
"type": "TAKEOFF",
"id": 1
}
}
},
{
"time": 15.0,
"message" : {
"type": "GOTO",
"body": {
"lat": 100,
"lon": 100
},
"id": 1
}
}
]
1 change: 1 addition & 0 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ pylint
python-dotenv
pytest
shapely
black
3 changes: 0 additions & 3 deletions examples/RCOverride/SITLExampleWaypoints/waypoint_test_1.txt

This file was deleted.

3 changes: 0 additions & 3 deletions examples/RCOverride/SITLExampleWaypoints/waypoint_test_2.txt

This file was deleted.

3 changes: 0 additions & 3 deletions examples/RCOverride/SITLExampleWaypoints/waypoint_test_3.txt

This file was deleted.

3 changes: 0 additions & 3 deletions examples/RCOverride/SITLExampleWaypoints/waypoint_test_4.txt

This file was deleted.

Loading