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


bmp085
Author(s): Philip Roan
autogenerated on Mon Oct 6 2014 10:10:16