_Anemometer.py
Go to the documentation of this file.
00001 """autogenerated by genpy from lse_sensor_msgs/Anemometer.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 import std_msgs.msg
00008 
00009 class Anemometer(genpy.Message):
00010   _md5sum = "3ee7846671a32f40083d540319a34a23"
00011   _type = "lse_sensor_msgs/Anemometer"
00012   _has_header = True #flag to mark the presence of a Header object
00013   _full_text = """Header header                         # timestamp and frame_id
00014 
00015 float32 wind_speed                      # m/s
00016 float32 wind_direction          # rad
00017 
00018 float32 min_wind_speed          # m/s
00019 float32 max_wind_speed          # m/s
00020 
00021 
00022 ================================================================================
00023 MSG: std_msgs/Header
00024 # Standard metadata for higher-level stamped data types.
00025 # This is generally used to communicate timestamped data 
00026 # in a particular coordinate frame.
00027 # 
00028 # sequence ID: consecutively increasing ID 
00029 uint32 seq
00030 #Two-integer timestamp that is expressed as:
00031 # * stamp.secs: seconds (stamp_secs) since epoch
00032 # * stamp.nsecs: nanoseconds since stamp_secs
00033 # time-handling sugar is provided by the client library
00034 time stamp
00035 #Frame this data is associated with
00036 # 0: no frame
00037 # 1: global frame
00038 string frame_id
00039 
00040 """
00041   __slots__ = ['header','wind_speed','wind_direction','min_wind_speed','max_wind_speed']
00042   _slot_types = ['std_msgs/Header','float32','float32','float32','float32']
00043 
00044   def __init__(self, *args, **kwds):
00045     """
00046     Constructor. Any message fields that are implicitly/explicitly
00047     set to None will be assigned a default value. The recommend
00048     use is keyword arguments as this is more robust to future message
00049     changes.  You cannot mix in-order arguments and keyword arguments.
00050 
00051     The available fields are:
00052        header,wind_speed,wind_direction,min_wind_speed,max_wind_speed
00053 
00054     :param args: complete set of field values, in .msg order
00055     :param kwds: use keyword arguments corresponding to message field names
00056     to set specific fields.
00057     """
00058     if args or kwds:
00059       super(Anemometer, self).__init__(*args, **kwds)
00060       #message fields cannot be None, assign default values for those that are
00061       if self.header is None:
00062         self.header = std_msgs.msg.Header()
00063       if self.wind_speed is None:
00064         self.wind_speed = 0.
00065       if self.wind_direction is None:
00066         self.wind_direction = 0.
00067       if self.min_wind_speed is None:
00068         self.min_wind_speed = 0.
00069       if self.max_wind_speed is None:
00070         self.max_wind_speed = 0.
00071     else:
00072       self.header = std_msgs.msg.Header()
00073       self.wind_speed = 0.
00074       self.wind_direction = 0.
00075       self.min_wind_speed = 0.
00076       self.max_wind_speed = 0.
00077 
00078   def _get_types(self):
00079     """
00080     internal API method
00081     """
00082     return self._slot_types
00083 
00084   def serialize(self, buff):
00085     """
00086     serialize message into buffer
00087     :param buff: buffer, ``StringIO``
00088     """
00089     try:
00090       _x = self
00091       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00092       _x = self.header.frame_id
00093       length = len(_x)
00094       if python3 or type(_x) == unicode:
00095         _x = _x.encode('utf-8')
00096         length = len(_x)
00097       buff.write(struct.pack('<I%ss'%length, length, _x))
00098       _x = self
00099       buff.write(_struct_4f.pack(_x.wind_speed, _x.wind_direction, _x.min_wind_speed, _x.max_wind_speed))
00100     except struct.error as se: self._check_types(se)
00101     except TypeError as te: self._check_types(te)
00102 
00103   def deserialize(self, str):
00104     """
00105     unpack serialized message in str into this message instance
00106     :param str: byte array of serialized message, ``str``
00107     """
00108     try:
00109       if self.header is None:
00110         self.header = std_msgs.msg.Header()
00111       end = 0
00112       _x = self
00113       start = end
00114       end += 12
00115       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00116       start = end
00117       end += 4
00118       (length,) = _struct_I.unpack(str[start:end])
00119       start = end
00120       end += length
00121       if python3:
00122         self.header.frame_id = str[start:end].decode('utf-8')
00123       else:
00124         self.header.frame_id = str[start:end]
00125       _x = self
00126       start = end
00127       end += 16
00128       (_x.wind_speed, _x.wind_direction, _x.min_wind_speed, _x.max_wind_speed,) = _struct_4f.unpack(str[start:end])
00129       return self
00130     except struct.error as e:
00131       raise genpy.DeserializationError(e) #most likely buffer underfill
00132 
00133 
00134   def serialize_numpy(self, buff, numpy):
00135     """
00136     serialize message with numpy array types into buffer
00137     :param buff: buffer, ``StringIO``
00138     :param numpy: numpy python module
00139     """
00140     try:
00141       _x = self
00142       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00143       _x = self.header.frame_id
00144       length = len(_x)
00145       if python3 or type(_x) == unicode:
00146         _x = _x.encode('utf-8')
00147         length = len(_x)
00148       buff.write(struct.pack('<I%ss'%length, length, _x))
00149       _x = self
00150       buff.write(_struct_4f.pack(_x.wind_speed, _x.wind_direction, _x.min_wind_speed, _x.max_wind_speed))
00151     except struct.error as se: self._check_types(se)
00152     except TypeError as te: self._check_types(te)
00153 
00154   def deserialize_numpy(self, str, numpy):
00155     """
00156     unpack serialized message in str into this message instance using numpy for array types
00157     :param str: byte array of serialized message, ``str``
00158     :param numpy: numpy python module
00159     """
00160     try:
00161       if self.header is None:
00162         self.header = std_msgs.msg.Header()
00163       end = 0
00164       _x = self
00165       start = end
00166       end += 12
00167       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00168       start = end
00169       end += 4
00170       (length,) = _struct_I.unpack(str[start:end])
00171       start = end
00172       end += length
00173       if python3:
00174         self.header.frame_id = str[start:end].decode('utf-8')
00175       else:
00176         self.header.frame_id = str[start:end]
00177       _x = self
00178       start = end
00179       end += 16
00180       (_x.wind_speed, _x.wind_direction, _x.min_wind_speed, _x.max_wind_speed,) = _struct_4f.unpack(str[start:end])
00181       return self
00182     except struct.error as e:
00183       raise genpy.DeserializationError(e) #most likely buffer underfill
00184 
00185 _struct_I = genpy.struct_I
00186 _struct_4f = struct.Struct("<4f")
00187 _struct_3I = struct.Struct("<3I")


lse_sensor_msgs
Author(s): Gonçalo Cabrita and Pedro Sousa
autogenerated on Mon Jan 6 2014 11:25:04