From dd4118e67b34afe33a2070dad7640a88e3aeff2f Mon Sep 17 00:00:00 2001 From: Arthur Golubtsov Date: Wed, 24 Jun 2020 23:09:05 +0300 Subject: [PATCH] drone: Add docstrings to mavros wrapper, decrease timeouts --- drone/modules/mavros_wrapper.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drone/modules/mavros_wrapper.py b/drone/modules/mavros_wrapper.py index f3b72ec..01f4f96 100644 --- a/drone/modules/mavros_wrapper.py +++ b/drone/modules/mavros_wrapper.py @@ -129,18 +129,23 @@ def stop_subscriber(): heartbeat_sub_status = False def get_amsl_altitude(): + ''' + Height above mean sea level in meters. + ''' try: - alt_msg = rospy.wait_for_message('/mavros/altitude', Altitude, timeout=1.) + alt_msg = rospy.wait_for_message('/mavros/altitude', Altitude, timeout=0.5) except rospy.ROSException: logger.error("Can't get altitude: timeout") return float('nan') else: return alt_msg.amsl -#Clockwise compass heading in degrees. 0 is North. def get_compass_hdg(): + ''' + Clockwise compass heading in degrees. 0 is North. + ''' try: - hdg_msg = rospy.wait_for_message('/mavros/global_position/compass_hdg', Float64, timeout=1.) + hdg_msg = rospy.wait_for_message('/mavros/global_position/compass_hdg', Float64, timeout=0.5) except rospy.ROSException: logger.error("Can't get altitude: timeout") return float('nan')