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