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