_Nostril.py
Go to the documentation of this file.
00001 """autogenerated by genpy from lse_sensor_msgs/Nostril.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 Nostril(genpy.Message):
00010   _md5sum = "24385882d831997bf818f9304248e052"
00011   _type = "lse_sensor_msgs/Nostril"
00012   _has_header = True #flag to mark the presence of a Header object
00013   _full_text = """# Single gas sensor msg
00014 
00015 Header header                   # timestamp and frame_id
00016 
00017 string sensor_model
00018 
00019 # Gases enums
00020 uint8 ORGANIC_SOLVENTS=0
00021 uint8 AIR_CONTAMINANTS=1
00022 uint8 GENERAL_COMBUSTIBLE=3
00023 uint8 NATURAL_GAS_METHANE=4
00024 
00025 uint8[] gas_type        # the types of gases detected by the sensor
00026 
00027 float32 reading                 # ppm
00028 
00029 float32 min_reading             # ppm
00030 float32 max_reading             # ppm
00031 
00032 float32 clean_air               # ppm
00033 
00034 uint16 raw_data                 # mV
00035 
00036 ================================================================================
00037 MSG: std_msgs/Header
00038 # Standard metadata for higher-level stamped data types.
00039 # This is generally used to communicate timestamped data 
00040 # in a particular coordinate frame.
00041 # 
00042 # sequence ID: consecutively increasing ID 
00043 uint32 seq
00044 #Two-integer timestamp that is expressed as:
00045 # * stamp.secs: seconds (stamp_secs) since epoch
00046 # * stamp.nsecs: nanoseconds since stamp_secs
00047 # time-handling sugar is provided by the client library
00048 time stamp
00049 #Frame this data is associated with
00050 # 0: no frame
00051 # 1: global frame
00052 string frame_id
00053 
00054 """
00055   # Pseudo-constants
00056   ORGANIC_SOLVENTS = 0
00057   AIR_CONTAMINANTS = 1
00058   GENERAL_COMBUSTIBLE = 3
00059   NATURAL_GAS_METHANE = 4
00060 
00061   __slots__ = ['header','sensor_model','gas_type','reading','min_reading','max_reading','clean_air','raw_data']
00062   _slot_types = ['std_msgs/Header','string','uint8[]','float32','float32','float32','float32','uint16']
00063 
00064   def __init__(self, *args, **kwds):
00065     """
00066     Constructor. Any message fields that are implicitly/explicitly
00067     set to None will be assigned a default value. The recommend
00068     use is keyword arguments as this is more robust to future message
00069     changes.  You cannot mix in-order arguments and keyword arguments.
00070 
00071     The available fields are:
00072        header,sensor_model,gas_type,reading,min_reading,max_reading,clean_air,raw_data
00073 
00074     :param args: complete set of field values, in .msg order
00075     :param kwds: use keyword arguments corresponding to message field names
00076     to set specific fields.
00077     """
00078     if args or kwds:
00079       super(Nostril, self).__init__(*args, **kwds)
00080       #message fields cannot be None, assign default values for those that are
00081       if self.header is None:
00082         self.header = std_msgs.msg.Header()
00083       if self.sensor_model is None:
00084         self.sensor_model = ''
00085       if self.gas_type is None:
00086         self.gas_type = ''
00087       if self.reading is None:
00088         self.reading = 0.
00089       if self.min_reading is None:
00090         self.min_reading = 0.
00091       if self.max_reading is None:
00092         self.max_reading = 0.
00093       if self.clean_air is None:
00094         self.clean_air = 0.
00095       if self.raw_data is None:
00096         self.raw_data = 0
00097     else:
00098       self.header = std_msgs.msg.Header()
00099       self.sensor_model = ''
00100       self.gas_type = ''
00101       self.reading = 0.
00102       self.min_reading = 0.
00103       self.max_reading = 0.
00104       self.clean_air = 0.
00105       self.raw_data = 0
00106 
00107   def _get_types(self):
00108     """
00109     internal API method
00110     """
00111     return self._slot_types
00112 
00113   def serialize(self, buff):
00114     """
00115     serialize message into buffer
00116     :param buff: buffer, ``StringIO``
00117     """
00118     try:
00119       _x = self
00120       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00121       _x = self.header.frame_id
00122       length = len(_x)
00123       if python3 or type(_x) == unicode:
00124         _x = _x.encode('utf-8')
00125         length = len(_x)
00126       buff.write(struct.pack('<I%ss'%length, length, _x))
00127       _x = self.sensor_model
00128       length = len(_x)
00129       if python3 or type(_x) == unicode:
00130         _x = _x.encode('utf-8')
00131         length = len(_x)
00132       buff.write(struct.pack('<I%ss'%length, length, _x))
00133       _x = self.gas_type
00134       length = len(_x)
00135       # - if encoded as a list instead, serialize as bytes instead of string
00136       if type(_x) in [list, tuple]:
00137         buff.write(struct.pack('<I%sB'%length, length, *_x))
00138       else:
00139         buff.write(struct.pack('<I%ss'%length, length, _x))
00140       _x = self
00141       buff.write(_struct_4fH.pack(_x.reading, _x.min_reading, _x.max_reading, _x.clean_air, _x.raw_data))
00142     except struct.error as se: self._check_types(se)
00143     except TypeError as te: self._check_types(te)
00144 
00145   def deserialize(self, str):
00146     """
00147     unpack serialized message in str into this message instance
00148     :param str: byte array of serialized message, ``str``
00149     """
00150     try:
00151       if self.header is None:
00152         self.header = std_msgs.msg.Header()
00153       end = 0
00154       _x = self
00155       start = end
00156       end += 12
00157       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00158       start = end
00159       end += 4
00160       (length,) = _struct_I.unpack(str[start:end])
00161       start = end
00162       end += length
00163       if python3:
00164         self.header.frame_id = str[start:end].decode('utf-8')
00165       else:
00166         self.header.frame_id = str[start:end]
00167       start = end
00168       end += 4
00169       (length,) = _struct_I.unpack(str[start:end])
00170       start = end
00171       end += length
00172       if python3:
00173         self.sensor_model = str[start:end].decode('utf-8')
00174       else:
00175         self.sensor_model = str[start:end]
00176       start = end
00177       end += 4
00178       (length,) = _struct_I.unpack(str[start:end])
00179       start = end
00180       end += length
00181       if python3:
00182         self.gas_type = str[start:end].decode('utf-8')
00183       else:
00184         self.gas_type = str[start:end]
00185       _x = self
00186       start = end
00187       end += 18
00188       (_x.reading, _x.min_reading, _x.max_reading, _x.clean_air, _x.raw_data,) = _struct_4fH.unpack(str[start:end])
00189       return self
00190     except struct.error as e:
00191       raise genpy.DeserializationError(e) #most likely buffer underfill
00192 
00193 
00194   def serialize_numpy(self, buff, numpy):
00195     """
00196     serialize message with numpy array types into buffer
00197     :param buff: buffer, ``StringIO``
00198     :param numpy: numpy python module
00199     """
00200     try:
00201       _x = self
00202       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00203       _x = self.header.frame_id
00204       length = len(_x)
00205       if python3 or type(_x) == unicode:
00206         _x = _x.encode('utf-8')
00207         length = len(_x)
00208       buff.write(struct.pack('<I%ss'%length, length, _x))
00209       _x = self.sensor_model
00210       length = len(_x)
00211       if python3 or type(_x) == unicode:
00212         _x = _x.encode('utf-8')
00213         length = len(_x)
00214       buff.write(struct.pack('<I%ss'%length, length, _x))
00215       _x = self.gas_type
00216       length = len(_x)
00217       # - if encoded as a list instead, serialize as bytes instead of string
00218       if type(_x) in [list, tuple]:
00219         buff.write(struct.pack('<I%sB'%length, length, *_x))
00220       else:
00221         buff.write(struct.pack('<I%ss'%length, length, _x))
00222       _x = self
00223       buff.write(_struct_4fH.pack(_x.reading, _x.min_reading, _x.max_reading, _x.clean_air, _x.raw_data))
00224     except struct.error as se: self._check_types(se)
00225     except TypeError as te: self._check_types(te)
00226 
00227   def deserialize_numpy(self, str, numpy):
00228     """
00229     unpack serialized message in str into this message instance using numpy for array types
00230     :param str: byte array of serialized message, ``str``
00231     :param numpy: numpy python module
00232     """
00233     try:
00234       if self.header is None:
00235         self.header = std_msgs.msg.Header()
00236       end = 0
00237       _x = self
00238       start = end
00239       end += 12
00240       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00241       start = end
00242       end += 4
00243       (length,) = _struct_I.unpack(str[start:end])
00244       start = end
00245       end += length
00246       if python3:
00247         self.header.frame_id = str[start:end].decode('utf-8')
00248       else:
00249         self.header.frame_id = str[start:end]
00250       start = end
00251       end += 4
00252       (length,) = _struct_I.unpack(str[start:end])
00253       start = end
00254       end += length
00255       if python3:
00256         self.sensor_model = str[start:end].decode('utf-8')
00257       else:
00258         self.sensor_model = str[start:end]
00259       start = end
00260       end += 4
00261       (length,) = _struct_I.unpack(str[start:end])
00262       start = end
00263       end += length
00264       if python3:
00265         self.gas_type = str[start:end].decode('utf-8')
00266       else:
00267         self.gas_type = str[start:end]
00268       _x = self
00269       start = end
00270       end += 18
00271       (_x.reading, _x.min_reading, _x.max_reading, _x.clean_air, _x.raw_data,) = _struct_4fH.unpack(str[start:end])
00272       return self
00273     except struct.error as e:
00274       raise genpy.DeserializationError(e) #most likely buffer underfill
00275 
00276 _struct_I = genpy.struct_I
00277 _struct_3I = struct.Struct("<3I")
00278 _struct_4fH = struct.Struct("<4fH")


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