play_animation: add reach_frame function and add timeout for takeoff and reach_frame

This commit is contained in:
Arthur Golubtsov
2019-03-22 04:32:45 +00:00
parent e023f4cc30
commit 9c8e77cdaf

View File

@@ -9,10 +9,10 @@ animation_file_path = 'animation.csv'
USE_LEDS = True
def takeoff(z=1.0):
def takeoff(z=1.0, timeout=1000):
if USE_LEDS:
LedLib.wipe_to(255, 0, 0)
FlightLib.takeoff(z=z, wait=True) # TODO dont forget change back to takeoff
FlightLib.takeoff(z=z, wait=True, timeout_takeoff = timeout) # TODO dont forget change back to takeoff
def land():
@@ -28,6 +28,11 @@ def animate_frame(current_frame, x0=0.0, y0=0.0):
if USE_LEDS:
LedLib.fill(current_frame['red'], current_frame['green'], current_frame['blue'])
def reach_frame(current_frame, x0=0.0, y0=0.0, timeout=1000):
FlightLib.reach_point(current_frame['x']+x0, current_frame['y']+y0, current_frame['z'], yaw=1.57, timeout=timeout) # TODO yaw
if USE_LEDS:
LedLib.fill(current_frame['red'], current_frame['green'], current_frame['blue'])
def read_animation_file(filepath=animation_file_path):
imporetd_frames = []