From 9c8e77cdaf1ca502e494d3e1fdd7be851a1e96d7 Mon Sep 17 00:00:00 2001 From: Arthur Golubtsov Date: Fri, 22 Mar 2019 04:32:45 +0000 Subject: [PATCH] play_animation: add reach_frame function and add timeout for takeoff and reach_frame --- Drone/play_animation.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Drone/play_animation.py b/Drone/play_animation.py index 6d9915a..cb8c281 100644 --- a/Drone/play_animation.py +++ b/Drone/play_animation.py @@ -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 = []