drone: Fix animation module

This commit is contained in:
Arthur Golubtsov
2020-06-18 16:29:45 +01:00
parent 6e47118dfb
commit dc38d55ddc

View File

@@ -445,10 +445,12 @@ class Animation(object):
self.mark_flight()
def get_start_frame(self, action):
try:
if action == 'fly':
return self.output_frames[self.start_frame_index]
if action == 'takeoff':
return self.output_frames_takeoff[self.start_frame_index]
except IndexError:
return None
def get_output_frames(self, action):
@@ -470,6 +472,7 @@ class Animation(object):
if not self.output_frames:
return 'error: empty output frames'
# Check current_height
if self.config.animation_check_ground:
if math.isnan(current_height):
return 'error: bad copter height'
# Select start action
@@ -491,6 +494,7 @@ class Animation(object):
else:
return 'error in [ANIMATION] start_action parameter'
# Check that bottom point of animation is higher than ground level
if self.config.animation_check_ground:
try:
ground_level = self.config.animation_ground_level
if ground_level == 'current':