@@ -220,6 +220,25 @@ def __str__(self):
220220 return "GPSInfo:fix=%s,num_sat=%s" % (self .fix_type , self .satellites_visible )
221221
222222
223+ class Wind (object ):
224+ """
225+ Wind information
226+
227+ An object of this type is returned by :py:attr: `Vehicle.wind`.
228+
229+ :param wind_direction: Wind direction in degrees
230+ :param wind_speed: Wind speed in m/s
231+ :param wind_speed_z: vertical wind speed in m/s
232+ """
233+ def __init__ (self , wind_direction , wind_speed , wind_speed_z ):
234+ self .wind_direction = wind_direction
235+ self .wind_speed = wind_speed
236+ self .wind_speed_z = wind_speed_z
237+
238+ def __str__ (self ):
239+ return "Wind: wind direction: {}, wind speed: {}, wind speed z: {}" .format (self .wind_direction , self .wind_speed , self .wind_speed_z )
240+
241+
223242class Battery (object ):
224243 """
225244 System battery information.
@@ -1057,6 +1076,19 @@ def listener(_, msg):
10571076 self ._vy = None
10581077 self ._vz = None
10591078
1079+
1080+ self ._wind_direction = None
1081+ self ._wind_speed = None
1082+ self ._wind_speed_z = None
1083+
1084+ @self .on_message ('WIND' )
1085+ def listener (self ,name , m ):
1086+ """ WIND {direction : -180.0, speed : 0.0, speed_z : 0.0} """
1087+ self ._wind_direction = m .direction
1088+ self ._wind_speed = m .speed
1089+ self ._wind_speed_z = m .speed_z
1090+
1091+
10601092 @self .on_message ('STATUSTEXT' )
10611093 def statustext_listener (self , name , m ):
10621094 # Log the STATUSTEXT on the autopilot logger, with the correct severity
@@ -1678,6 +1710,13 @@ def listener(self, attr_name, value):
16781710 """
16791711 return self ._location
16801712
1713+ @property
1714+ def wind (self ):
1715+ """
1716+ Current wind status (:pu:class: `Wind`)
1717+ """
1718+ return Wind (self ._wind_direction , self ._wind_speed , self ._wind_speed_z )
1719+
16811720 @property
16821721 def battery (self ):
16831722 """
0 commit comments