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


gumstix_memread_bma180
Author(s): Nikhil Deshpande (Maintained by Philip Roan)
autogenerated on Sat Dec 28 2013 16:49:24