diff --git a/drone/client.py b/drone/client.py index 5433f7e..e6bdf45 100644 --- a/drone/client.py +++ b/drone/client.py @@ -607,7 +607,11 @@ def _command_land(*args, **kwargs): @messaging.message_callback("emergency_land") def _emergency_land(*args, **kwargs): - logger.info(flight.emergency_land().message) + try: + result = flight.emergency_land() + logger.info(result.message) + except rospy.ServiceException: + logger.error("Can't execute emergency land: service is unavailable!") @messaging.message_callback("disarm") @@ -798,7 +802,7 @@ class Telemetry: start_action = copter.animation.get_start_action( copter.config.animation_start_action, self.ros_telemetry.z, copter.config.animation_takeoff_level, copter.config.animation_ground_level, - copter.config.animation_ratio, offset) + copter.config.animation_ratio, offset, self.fcu_status) return [x,y,z,yaw,start_action,start_delay] @classmethod diff --git a/drone/modules/animation.py b/drone/modules/animation.py index c740aa3..9dfdbe0 100644 --- a/drone/modules/animation.py +++ b/drone/modules/animation.py @@ -322,7 +322,7 @@ class Animation(object): return ground_level <= self.get_scaled_output_min_z(ratio, offset) def get_start_action(self, start_action, current_height, takeoff_level, - ground_level, ratio=(1,1,1), offset=(0,0,0)): + ground_level, ratio=(1,1,1), offset=(0,0,0), state="STANDBY"): # Check output frames if not self.output_frames: return 'error: empty output frames' @@ -335,7 +335,7 @@ class Animation(object): ground_level = float(ground_level) except ValueError: return 'error in [ANIMATION] ground_level parameter' - if ground_level > self.get_scaled_output_min_z(ratio, offset): + if state != "ACTIVE" and ground_level > self.get_scaled_output_min_z(ratio, offset): return 'error: some animation points are lower than ground level for {:.2f}m (max)'.format( ground_level - self.get_scaled_output_min_z(ratio, offset) )