mirror of
https://github.com/CopterExpress/clever-show.git
synced 2026-05-29 16:29:34 +00:00
drone: Add docstrings to mavros wrapper, decrease timeouts
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user