Skip to content
Snippets Groups Projects
Commit f79f767d authored by Zsedrovits Tamás's avatar Zsedrovits Tamás
Browse files

Movement base changed

parent 00b6f186
Branches
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@ from dbr import *
# Speed of the drone
S = 100
# Step size
s_S = 100
STEP = 100
# Frames per second of the pygame window display
# A low number also results in input lag, as input information is processed once per frame.
FPS = 120
......@@ -42,47 +42,33 @@ class FrontEnd():
def run(self):
""" Main thread."""
while True:
#try:
command = self.commands_to_run.get(block=True, timeout=None)
if command == "e": # forward
success = self.tello.move_forward(s_S)
while not success:
while not self.tello.move_forward(STEP):
time.sleep(1)
success = self.tello.move_forward(s_S)
elif command == "h": # back
success = self.tello.move_back(s_S)
while not success:
while not self.tello.move_back(STEP):
time.sleep(1)
success = self.tello.move_back(s_S)
elif command == "b": # left
success = self.tello.move_left(s_S)
while not success:
while not self.tello.move_left(STEP):
time.sleep(1)
success = self.tello.move_left(s_S)
elif command == "j": # right
success = self.tello.move_right(s_S)
while not success:
while not self.tello.move_right(STEP):
time.sleep(1)
success = self.tello.move_right(s_S)
elif command == "f": # up
success = self.tello.move_up(int(s_S/4))
while not success:
while not self.tello.move_up(int(STEP/4)):
time.sleep(1)
success = self.tello.move_up(int(s_S/4))
elif command == "l": # down
success = self.tello.move_down(int(s_S/4))
while not success:
while not self.tello.move_down(int(STEP/4)):
time.sleep(1)
success = self.tello.move_down(int(s_S/4))
elif command == "ccw": # turn left
success = self.tello.rotate_counter_clockwise(15)
while not success:
while not self.tello.rotate_counter_clockwise(15):
time.sleep(1)
success = self.tello.rotate_counter_clockwise(15)
elif command == "cw": # turn right
success = self.tello.rotate_clockwise(15)
while not success:
while not self.tello.rotate_clockwise(15):
time.sleep(1)
success = self.tello.rotate_clockwise(15)
def __init__(self):
# Init pygame
......@@ -99,6 +85,10 @@ class FrontEnd():
self.tello = Tello()
# Drone velocities between -100~100
self.for_back_velocity = 0
self.left_right_velocity = 0
self.up_down_velocity = 0
self.yaw_velocity = 0
self.speed = S
# create update timer
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment