Skip to content
This repository was archived by the owner on Aug 26, 2024. It is now read-only.

Commit d9be5ae

Browse files
committedSep 22, 2023
Comply with code style
1 parent 919596f commit d9be5ae

File tree

7 files changed

+153
-20
lines changed

7 files changed

+153
-20
lines changed
 

‎.idea/codeStyles/Project.xml

+63
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/codeStyles/codeStyleConfig.xml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/inspectionProfiles/Daedalus_Robotics.xml

+29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎.idea/inspectionProfiles/profiles_settings.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# avr_tello_2023
2+
23
Place where our Tello code for the season is housed.

‎avr_tello_2023/__main__.py

+25-19
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,54 @@
55
from inspect import signature
66

77
tello = Tello()
8-
tello.connect()
9-
tello.streamon()
108

119
school_distance = 359 # distance to the school building in cm from helipad
1210
back_bridge_distance = 620 # distance from helipad to back of bridge line in cm
13-
back_to_middle_bridge_distance = 190 # distance from the back of the bridge to the middle where color square is (needs to be calibrated)
14-
manual_commands = { # I could've used match statement, but IDK, I just felt like using this instead.
11+
# ToDo: Calibrate distance
12+
back_to_middle_bridge_distance = 190 # distance from the back of the bridge to the middle where color square is
13+
manual_commands = { # I could've used a match statement, but IDK, I just felt like using this instead.
1514
'w': tello.move_forward,
1615
's': tello.move_back,
1716
'd': tello.move_right,
1817
'a': tello.move_left,
1918
't': tello.takeoff,
2019
'l': tello.land,
2120
}
22-
manual_commands_str = "\n".join([f"{letter}: {func.__name__}" for letter, func in manual_commands.items()]) # commands in human-readable format
23-
battery_left = tello.get_battery() # how much batter left
21+
manual_commands_str = "\n".join(
22+
[f"{letter}: {func.__name__}" for letter, func in manual_commands.items()]) # commands in human-readable format
23+
battery_left = tello.get_battery() # how much battery left
2424

25-
def enter_manual_mode():
25+
26+
def enter_manual_mode() -> None:
2627
"""
2728
Enters Manual Mode
2829
2930
Commands are:
3031
- w: moves the drone forward
31-
- s: moves the drone backword
32+
- s: moves the drone backward
3233
- d: moves the drone right
3334
- a: moves the drone left
3435
- t: takeoff
3536
- l: lands
3637
"""
3738
distance = 50
38-
39+
3940
while True:
4041
for letter, func in manual_commands.items():
4142
if keyboard.is_pressed(letter):
4243
# checking for the number of arguments the function takes
43-
if len(signature(func).parameters) == 1:
44+
if len(signature(func).parameters) > 0:
45+
# noinspection PyArgumentList
4446
func(distance)
4547
else:
4648
func()
4749
elif keyboard.is_pressed('q'):
4850
# getting outta manual mode
4951
return
5052

51-
def get_color():
52-
""" TODO """
53+
54+
def get_color() -> None:
55+
# ToDo
5356
# tello code to get color from building
5457
tello.takeoff()
5558
tello.move_up(100) # needs to check this distance go over the building
@@ -62,35 +65,38 @@ def get_color():
6265
tello.move_right(back_to_middle_bridge_distance)
6366
tello.land()
6467

65-
def enter_recon_path():
66-
""" TODO """
68+
69+
def enter_recon_path() -> None:
70+
# ToDo
6771
# first recon path
6872
tello.takeoff()
6973
tello.move_forward(school_distance)
7074
# HERE IS WHERE CODE GO FOR PARACHUTE DROP
7175
tello.move_back(school_distance)
7276
tello.land()
7377

74-
def main():
78+
79+
def main() -> None:
7580
while True:
7681
img = tello.get_frame_read().frame
7782
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
7883
cv2.imshow('frame', img)
79-
84+
8085
if keyboard.is_pressed('r'):
8186
enter_recon_path()
8287
elif keyboard.is_pressed('c'):
8388
get_color()
8489
elif keyboard.is_pressed('m'):
8590
enter_manual_mode()
8691

92+
8793
if __name__ == '__main__':
94+
tello.connect()
95+
tello.streamon()
96+
8897
Tello.LOGGER.info(f"Battery: {battery_left}%")
8998

9099
try:
91100
main()
92-
except KeyboardInterrupt:
93-
tello.land()
94-
exit(1)
95101
finally:
96102
tello.land()

‎qodana.yaml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#-------------------------------------------------------------------------------#
2+
# Qodana analysis is configured by qodana.yaml file #
3+
# https://www.jetbrains.com/help/qodana/qodana-yaml.html #
4+
#-------------------------------------------------------------------------------#
5+
version: "1.0"
6+
7+
#Specify inspection profile for code analysis
8+
profile:
9+
name: qodana.starter
10+
11+
#Enable inspections
12+
#include:
13+
# - name: <SomeEnabledInspectionId>
14+
15+
#Disable inspections
16+
#exclude:
17+
# - name: <SomeDisabledInspectionId>
18+
# paths:
19+
# - <path/where/not/run/inspection>
20+
21+
#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
22+
#bootstrap: sh ./prepare-qodana.sh
23+
24+
#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
25+
#plugins:
26+
# - id: <plugin.id> # (plugin id can be found at https://plugins.jetbrains.com)
27+
28+
#Specify Qodana linter for analysis (Applied in CI/CD pipeline)
29+
linter: jetbrains/qodana-python:latest

0 commit comments

Comments
 (0)
This repository has been archived.