mirror of
https://github.com/CopterExpress/clever-show.git
synced 2026-05-26 15:13:26 +00:00
drone: Update after testing
This commit is contained in:
@@ -496,7 +496,7 @@ def _command_move_start_to_current_position(*args, **kwargs):
|
||||
private_offset = copter.config.animation_private_offset
|
||||
offset = numpy.array(private_offset) + numpy.array(copter.config.animation_common_offset)
|
||||
try:
|
||||
xs, ys, zs = copter.animation.get_start_frame(copter.telemetry.start_action).pos()
|
||||
xs, ys, zs = copter.animation.get_start_frame(copter.telemetry.start_action).get_pos()
|
||||
except ValueError:
|
||||
logger.error("Can't get start point. Check animation file!")
|
||||
else:
|
||||
@@ -705,9 +705,10 @@ def _play_animation(*args, **kwargs):
|
||||
task_manager.add_task(frame_time, 0, animation.execute_frame,
|
||||
task_kwargs={
|
||||
"frame": frame,
|
||||
"config": config,
|
||||
"config": copter.config,
|
||||
})
|
||||
frame_time += frame.delay
|
||||
task_manager.add_task(frame_time, 0, animation.turn_off_led)
|
||||
|
||||
# noinspection PyAttributeOutsideInit
|
||||
class Telemetry:
|
||||
@@ -880,7 +881,7 @@ class Telemetry:
|
||||
state = [self.mode, self.armed, task_manager.get_last_task_name()]
|
||||
mode, armed, last_task = state
|
||||
# check external interruption
|
||||
external_interruption = (mode != "OFFBOARD" and armed == True and last_task not in [None, 'land'])
|
||||
external_interruption = (mode != "OFFBOARD" and armed == True and last_task not in [None, 'land', 'stand'])
|
||||
log_msg = ''
|
||||
if emergency:
|
||||
log_msg += 'emergency and '
|
||||
|
||||
@@ -507,7 +507,7 @@ try:
|
||||
def execute_frame(frame, config, interrupter=interrupt_event):
|
||||
auto_arm = False
|
||||
use_leds = config.led_use
|
||||
frame_id = config.frame_id
|
||||
frame_id = config.flight_frame_id
|
||||
if frame.action == 'takeoff':
|
||||
use_leds = use_leds & config.led_takeoff_indication
|
||||
takeoff(z=config.flight_takeoff_height, frame_id=frame_id, timeout=config.flight_takeoff_time, use_leds=use_leds, interrupter=interrupter)
|
||||
@@ -531,6 +531,9 @@ try:
|
||||
else:
|
||||
led.set_effect(r=red, g=green, b=blue)
|
||||
|
||||
def turn_off_led(interrupter=interrupt_event):
|
||||
led.set_effect(r=0, g=0, b=0)
|
||||
|
||||
def takeoff(z=1.5, safe_takeoff=False, frame_id='map', timeout=5.0, use_leds=True,
|
||||
interrupter=interrupt_event):
|
||||
if use_leds:
|
||||
|
||||
@@ -88,7 +88,13 @@ class TaskManager(object):
|
||||
raise KeyError('Pop from an empty priority queue')
|
||||
|
||||
def get_last_task_name(self):
|
||||
return self._last_task
|
||||
try:
|
||||
name = self._last_task.func.__name__
|
||||
if name == 'execute_frame':
|
||||
return name.kwargs["frame"].action
|
||||
return name
|
||||
except AttributeError:
|
||||
return None
|
||||
|
||||
def get_current_task(self):
|
||||
try:
|
||||
@@ -207,7 +213,7 @@ class TaskManager(object):
|
||||
self.pop_task()
|
||||
except KeyError as e:
|
||||
logger.error(str(e))
|
||||
self._last_task = task.func.__name__
|
||||
self._last_task = task
|
||||
#try:
|
||||
#print("Pop {} function!".format(task.func.__name__))
|
||||
#except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user