_smi540meas.py
Go to the documentation of this file.
00001 """autogenerated by genpy from smi540/smi540meas.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 smi540meas(genpy.Message):
00010   _md5sum = "0dbe54f84ea8052406fa280d1c1f5801"
00011   _type = "smi540/smi540meas"
00012   _has_header = True #flag to mark the presence of a Header object
00013   _full_text = """Header header
00014 string strIdSubDev
00015 int16[] iChipSelect
00016 float64[] fAcclX
00017 float64[] fAcclY
00018 float64[] fRateZ
00019 
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','strIdSubDev','iChipSelect','fAcclX','fAcclY','fRateZ']
00042   _slot_types = ['std_msgs/Header','string','int16[]','float64[]','float64[]','float64[]']
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,strIdSubDev,iChipSelect,fAcclX,fAcclY,fRateZ
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(smi540meas, 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.strIdSubDev is None:
00064         self.strIdSubDev = ''
00065       if self.iChipSelect is None:
00066         self.iChipSelect = []
00067       if self.fAcclX is None:
00068         self.fAcclX = []
00069       if self.fAcclY is None:
00070         self.fAcclY = []
00071       if self.fRateZ is None:
00072         self.fRateZ = []
00073     else:
00074       self.header = std_msgs.msg.Header()
00075       self.strIdSubDev = ''
00076       self.iChipSelect = []
00077       self.fAcclX = []
00078       self.fAcclY = []
00079       self.fRateZ = []
00080 
00081   def _get_types(self):
00082     """
00083     internal API method
00084     """
00085     return self._slot_types
00086 
00087   def serialize(self, buff):
00088     """
00089     serialize message into buffer
00090     :param buff: buffer, ``StringIO``
00091     """
00092     try:
00093       _x = self
00094       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00095       _x = self.header.frame_id
00096       length = len(_x)
00097       if python3 or type(_x) == unicode:
00098         _x = _x.encode('utf-8')
00099         length = len(_x)
00100       buff.write(struct.pack('<I%ss'%length, length, _x))
00101       _x = self.strIdSubDev
00102       length = len(_x)
00103       if python3 or type(_x) == unicode:
00104         _x = _x.encode('utf-8')
00105         length = len(_x)
00106       buff.write(struct.pack('<I%ss'%length, length, _x))
00107       length = len(self.iChipSelect)
00108       buff.write(_struct_I.pack(length))
00109       pattern = '<%sh'%length
00110       buff.write(struct.pack(pattern, *self.iChipSelect))
00111       length = len(self.fAcclX)
00112       buff.write(_struct_I.pack(length))
00113       pattern = '<%sd'%length
00114       buff.write(struct.pack(pattern, *self.fAcclX))
00115       length = len(self.fAcclY)
00116       buff.write(_struct_I.pack(length))
00117       pattern = '<%sd'%length
00118       buff.write(struct.pack(pattern, *self.fAcclY))
00119       length = len(self.fRateZ)
00120       buff.write(_struct_I.pack(length))
00121       pattern = '<%sd'%length
00122       buff.write(struct.pack(pattern, *self.fRateZ))
00123     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00124     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00125 
00126   def deserialize(self, str):
00127     """
00128     unpack serialized message in str into this message instance
00129     :param str: byte array of serialized message, ``str``
00130     """
00131     try:
00132       if self.header is None:
00133         self.header = std_msgs.msg.Header()
00134       end = 0
00135       _x = self
00136       start = end
00137       end += 12
00138       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00139       start = end
00140       end += 4
00141       (length,) = _struct_I.unpack(str[start:end])
00142       start = end
00143       end += length
00144       if python3:
00145         self.header.frame_id = str[start:end].decode('utf-8')
00146       else:
00147         self.header.frame_id = str[start:end]
00148       start = end
00149       end += 4
00150       (length,) = _struct_I.unpack(str[start:end])
00151       start = end
00152       end += length
00153       if python3:
00154         self.strIdSubDev = str[start:end].decode('utf-8')
00155       else:
00156         self.strIdSubDev = str[start:end]
00157       start = end
00158       end += 4
00159       (length,) = _struct_I.unpack(str[start:end])
00160       pattern = '<%sh'%length
00161       start = end
00162       end += struct.calcsize(pattern)
00163       self.iChipSelect = struct.unpack(pattern, str[start:end])
00164       start = end
00165       end += 4
00166       (length,) = _struct_I.unpack(str[start:end])
00167       pattern = '<%sd'%length
00168       start = end
00169       end += struct.calcsize(pattern)
00170       self.fAcclX = struct.unpack(pattern, str[start:end])
00171       start = end
00172       end += 4
00173       (length,) = _struct_I.unpack(str[start:end])
00174       pattern = '<%sd'%length
00175       start = end
00176       end += struct.calcsize(pattern)
00177       self.fAcclY = struct.unpack(pattern, str[start:end])
00178       start = end
00179       end += 4
00180       (length,) = _struct_I.unpack(str[start:end])
00181       pattern = '<%sd'%length
00182       start = end
00183       end += struct.calcsize(pattern)
00184       self.fRateZ = struct.unpack(pattern, str[start:end])
00185       return self
00186     except struct.error as e:
00187       raise genpy.DeserializationError(e) #most likely buffer underfill
00188 
00189 
00190   def serialize_numpy(self, buff, numpy):
00191     """
00192     serialize message with numpy array types into buffer
00193     :param buff: buffer, ``StringIO``
00194     :param numpy: numpy python module
00195     """
00196     try:
00197       _x = self
00198       buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00199       _x = self.header.frame_id
00200       length = len(_x)
00201       if python3 or type(_x) == unicode:
00202         _x = _x.encode('utf-8')
00203         length = len(_x)
00204       buff.write(struct.pack('<I%ss'%length, length, _x))
00205       _x = self.strIdSubDev
00206       length = len(_x)
00207       if python3 or type(_x) == unicode:
00208         _x = _x.encode('utf-8')
00209         length = len(_x)
00210       buff.write(struct.pack('<I%ss'%length, length, _x))
00211       length = len(self.iChipSelect)
00212       buff.write(_struct_I.pack(length))
00213       pattern = '<%sh'%length
00214       buff.write(self.iChipSelect.tostring())
00215       length = len(self.fAcclX)
00216       buff.write(_struct_I.pack(length))
00217       pattern = '<%sd'%length
00218       buff.write(self.fAcclX.tostring())
00219       length = len(self.fAcclY)
00220       buff.write(_struct_I.pack(length))
00221       pattern = '<%sd'%length
00222       buff.write(self.fAcclY.tostring())
00223       length = len(self.fRateZ)
00224       buff.write(_struct_I.pack(length))
00225       pattern = '<%sd'%length
00226       buff.write(self.fRateZ.tostring())
00227     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00228     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00229 
00230   def deserialize_numpy(self, str, numpy):
00231     """
00232     unpack serialized message in str into this message instance using numpy for array types
00233     :param str: byte array of serialized message, ``str``
00234     :param numpy: numpy python module
00235     """
00236     try:
00237       if self.header is None:
00238         self.header = std_msgs.msg.Header()
00239       end = 0
00240       _x = self
00241       start = end
00242       end += 12
00243       (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00244       start = end
00245       end += 4
00246       (length,) = _struct_I.unpack(str[start:end])
00247       start = end
00248       end += length
00249       if python3:
00250         self.header.frame_id = str[start:end].decode('utf-8')
00251       else:
00252         self.header.frame_id = str[start:end]
00253       start = end
00254       end += 4
00255       (length,) = _struct_I.unpack(str[start:end])
00256       start = end
00257       end += length
00258       if python3:
00259         self.strIdSubDev = str[start:end].decode('utf-8')
00260       else:
00261         self.strIdSubDev = str[start:end]
00262       start = end
00263       end += 4
00264       (length,) = _struct_I.unpack(str[start:end])
00265       pattern = '<%sh'%length
00266       start = end
00267       end += struct.calcsize(pattern)
00268       self.iChipSelect = numpy.frombuffer(str[start:end], dtype=numpy.int16, count=length)
00269       start = end
00270       end += 4
00271       (length,) = _struct_I.unpack(str[start:end])
00272       pattern = '<%sd'%length
00273       start = end
00274       end += struct.calcsize(pattern)
00275       self.fAcclX = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00276       start = end
00277       end += 4
00278       (length,) = _struct_I.unpack(str[start:end])
00279       pattern = '<%sd'%length
00280       start = end
00281       end += struct.calcsize(pattern)
00282       self.fAcclY = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00283       start = end
00284       end += 4
00285       (length,) = _struct_I.unpack(str[start:end])
00286       pattern = '<%sd'%length
00287       start = end
00288       end += struct.calcsize(pattern)
00289       self.fRateZ = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00290       return self
00291     except struct.error as e:
00292       raise genpy.DeserializationError(e) #most likely buffer underfill
00293 
00294 _struct_I = genpy.struct_I
00295 _struct_3I = struct.Struct("<3I")


smi540
Author(s): Lukas Marti, Nikhil Deshpande (Maintained by Philip Roan)
autogenerated on Mon Oct 6 2014 10:10:21