00001 """autogenerated by genpy from people_msgs/PositionMeasurementArray.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 people_msgs.msg
00008 import geometry_msgs.msg
00009 import std_msgs.msg
00010
00011 class PositionMeasurementArray(genpy.Message):
00012 _md5sum = "59c860d40aa739ec920eb3ad24ae019e"
00013 _type = "people_msgs/PositionMeasurementArray"
00014 _has_header = True
00015 _full_text = """Header header
00016
00017 # All of the people found
00018 people_msgs/PositionMeasurement[] people
00019
00020 # The co-occurrence matrix between people
00021 float32[] cooccurrence
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 MSG: people_msgs/PositionMeasurement
00042 Header header
00043 string name
00044 string object_id
00045 geometry_msgs/Point pos
00046 float64 reliability
00047 float64[9] covariance
00048 byte initialization
00049 ================================================================================
00050 MSG: geometry_msgs/Point
00051 # This contains the position of a point in free space
00052 float64 x
00053 float64 y
00054 float64 z
00055
00056 """
00057 __slots__ = ['header','people','cooccurrence']
00058 _slot_types = ['std_msgs/Header','people_msgs/PositionMeasurement[]','float32[]']
00059
00060 def __init__(self, *args, **kwds):
00061 """
00062 Constructor. Any message fields that are implicitly/explicitly
00063 set to None will be assigned a default value. The recommend
00064 use is keyword arguments as this is more robust to future message
00065 changes. You cannot mix in-order arguments and keyword arguments.
00066
00067 The available fields are:
00068 header,people,cooccurrence
00069
00070 :param args: complete set of field values, in .msg order
00071 :param kwds: use keyword arguments corresponding to message field names
00072 to set specific fields.
00073 """
00074 if args or kwds:
00075 super(PositionMeasurementArray, self).__init__(*args, **kwds)
00076
00077 if self.header is None:
00078 self.header = std_msgs.msg.Header()
00079 if self.people is None:
00080 self.people = []
00081 if self.cooccurrence is None:
00082 self.cooccurrence = []
00083 else:
00084 self.header = std_msgs.msg.Header()
00085 self.people = []
00086 self.cooccurrence = []
00087
00088 def _get_types(self):
00089 """
00090 internal API method
00091 """
00092 return self._slot_types
00093
00094 def serialize(self, buff):
00095 """
00096 serialize message into buffer
00097 :param buff: buffer, ``StringIO``
00098 """
00099 try:
00100 _x = self
00101 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00102 _x = self.header.frame_id
00103 length = len(_x)
00104 if python3 or type(_x) == unicode:
00105 _x = _x.encode('utf-8')
00106 length = len(_x)
00107 buff.write(struct.pack('<I%ss'%length, length, _x))
00108 length = len(self.people)
00109 buff.write(_struct_I.pack(length))
00110 for val1 in self.people:
00111 _v1 = val1.header
00112 buff.write(_struct_I.pack(_v1.seq))
00113 _v2 = _v1.stamp
00114 _x = _v2
00115 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00116 _x = _v1.frame_id
00117 length = len(_x)
00118 if python3 or type(_x) == unicode:
00119 _x = _x.encode('utf-8')
00120 length = len(_x)
00121 buff.write(struct.pack('<I%ss'%length, length, _x))
00122 _x = val1.name
00123 length = len(_x)
00124 if python3 or type(_x) == unicode:
00125 _x = _x.encode('utf-8')
00126 length = len(_x)
00127 buff.write(struct.pack('<I%ss'%length, length, _x))
00128 _x = val1.object_id
00129 length = len(_x)
00130 if python3 or type(_x) == unicode:
00131 _x = _x.encode('utf-8')
00132 length = len(_x)
00133 buff.write(struct.pack('<I%ss'%length, length, _x))
00134 _v3 = val1.pos
00135 _x = _v3
00136 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00137 buff.write(_struct_d.pack(val1.reliability))
00138 buff.write(_struct_9d.pack(*val1.covariance))
00139 buff.write(_struct_b.pack(val1.initialization))
00140 length = len(self.cooccurrence)
00141 buff.write(_struct_I.pack(length))
00142 pattern = '<%sf'%length
00143 buff.write(struct.pack(pattern, *self.cooccurrence))
00144 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00145 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00146
00147 def deserialize(self, str):
00148 """
00149 unpack serialized message in str into this message instance
00150 :param str: byte array of serialized message, ``str``
00151 """
00152 try:
00153 if self.header is None:
00154 self.header = std_msgs.msg.Header()
00155 if self.people is None:
00156 self.people = None
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 start = end
00172 end += 4
00173 (length,) = _struct_I.unpack(str[start:end])
00174 self.people = []
00175 for i in range(0, length):
00176 val1 = people_msgs.msg.PositionMeasurement()
00177 _v4 = val1.header
00178 start = end
00179 end += 4
00180 (_v4.seq,) = _struct_I.unpack(str[start:end])
00181 _v5 = _v4.stamp
00182 _x = _v5
00183 start = end
00184 end += 8
00185 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00186 start = end
00187 end += 4
00188 (length,) = _struct_I.unpack(str[start:end])
00189 start = end
00190 end += length
00191 if python3:
00192 _v4.frame_id = str[start:end].decode('utf-8')
00193 else:
00194 _v4.frame_id = str[start:end]
00195 start = end
00196 end += 4
00197 (length,) = _struct_I.unpack(str[start:end])
00198 start = end
00199 end += length
00200 if python3:
00201 val1.name = str[start:end].decode('utf-8')
00202 else:
00203 val1.name = str[start:end]
00204 start = end
00205 end += 4
00206 (length,) = _struct_I.unpack(str[start:end])
00207 start = end
00208 end += length
00209 if python3:
00210 val1.object_id = str[start:end].decode('utf-8')
00211 else:
00212 val1.object_id = str[start:end]
00213 _v6 = val1.pos
00214 _x = _v6
00215 start = end
00216 end += 24
00217 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00218 start = end
00219 end += 8
00220 (val1.reliability,) = _struct_d.unpack(str[start:end])
00221 start = end
00222 end += 72
00223 val1.covariance = _struct_9d.unpack(str[start:end])
00224 start = end
00225 end += 1
00226 (val1.initialization,) = _struct_b.unpack(str[start:end])
00227 self.people.append(val1)
00228 start = end
00229 end += 4
00230 (length,) = _struct_I.unpack(str[start:end])
00231 pattern = '<%sf'%length
00232 start = end
00233 end += struct.calcsize(pattern)
00234 self.cooccurrence = struct.unpack(pattern, str[start:end])
00235 return self
00236 except struct.error as e:
00237 raise genpy.DeserializationError(e)
00238
00239
00240 def serialize_numpy(self, buff, numpy):
00241 """
00242 serialize message with numpy array types into buffer
00243 :param buff: buffer, ``StringIO``
00244 :param numpy: numpy python module
00245 """
00246 try:
00247 _x = self
00248 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00249 _x = self.header.frame_id
00250 length = len(_x)
00251 if python3 or type(_x) == unicode:
00252 _x = _x.encode('utf-8')
00253 length = len(_x)
00254 buff.write(struct.pack('<I%ss'%length, length, _x))
00255 length = len(self.people)
00256 buff.write(_struct_I.pack(length))
00257 for val1 in self.people:
00258 _v7 = val1.header
00259 buff.write(_struct_I.pack(_v7.seq))
00260 _v8 = _v7.stamp
00261 _x = _v8
00262 buff.write(_struct_2I.pack(_x.secs, _x.nsecs))
00263 _x = _v7.frame_id
00264 length = len(_x)
00265 if python3 or type(_x) == unicode:
00266 _x = _x.encode('utf-8')
00267 length = len(_x)
00268 buff.write(struct.pack('<I%ss'%length, length, _x))
00269 _x = val1.name
00270 length = len(_x)
00271 if python3 or type(_x) == unicode:
00272 _x = _x.encode('utf-8')
00273 length = len(_x)
00274 buff.write(struct.pack('<I%ss'%length, length, _x))
00275 _x = val1.object_id
00276 length = len(_x)
00277 if python3 or type(_x) == unicode:
00278 _x = _x.encode('utf-8')
00279 length = len(_x)
00280 buff.write(struct.pack('<I%ss'%length, length, _x))
00281 _v9 = val1.pos
00282 _x = _v9
00283 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00284 buff.write(_struct_d.pack(val1.reliability))
00285 buff.write(val1.covariance.tostring())
00286 buff.write(_struct_b.pack(val1.initialization))
00287 length = len(self.cooccurrence)
00288 buff.write(_struct_I.pack(length))
00289 pattern = '<%sf'%length
00290 buff.write(self.cooccurrence.tostring())
00291 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00292 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00293
00294 def deserialize_numpy(self, str, numpy):
00295 """
00296 unpack serialized message in str into this message instance using numpy for array types
00297 :param str: byte array of serialized message, ``str``
00298 :param numpy: numpy python module
00299 """
00300 try:
00301 if self.header is None:
00302 self.header = std_msgs.msg.Header()
00303 if self.people is None:
00304 self.people = None
00305 end = 0
00306 _x = self
00307 start = end
00308 end += 12
00309 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00310 start = end
00311 end += 4
00312 (length,) = _struct_I.unpack(str[start:end])
00313 start = end
00314 end += length
00315 if python3:
00316 self.header.frame_id = str[start:end].decode('utf-8')
00317 else:
00318 self.header.frame_id = str[start:end]
00319 start = end
00320 end += 4
00321 (length,) = _struct_I.unpack(str[start:end])
00322 self.people = []
00323 for i in range(0, length):
00324 val1 = people_msgs.msg.PositionMeasurement()
00325 _v10 = val1.header
00326 start = end
00327 end += 4
00328 (_v10.seq,) = _struct_I.unpack(str[start:end])
00329 _v11 = _v10.stamp
00330 _x = _v11
00331 start = end
00332 end += 8
00333 (_x.secs, _x.nsecs,) = _struct_2I.unpack(str[start:end])
00334 start = end
00335 end += 4
00336 (length,) = _struct_I.unpack(str[start:end])
00337 start = end
00338 end += length
00339 if python3:
00340 _v10.frame_id = str[start:end].decode('utf-8')
00341 else:
00342 _v10.frame_id = str[start:end]
00343 start = end
00344 end += 4
00345 (length,) = _struct_I.unpack(str[start:end])
00346 start = end
00347 end += length
00348 if python3:
00349 val1.name = str[start:end].decode('utf-8')
00350 else:
00351 val1.name = str[start:end]
00352 start = end
00353 end += 4
00354 (length,) = _struct_I.unpack(str[start:end])
00355 start = end
00356 end += length
00357 if python3:
00358 val1.object_id = str[start:end].decode('utf-8')
00359 else:
00360 val1.object_id = str[start:end]
00361 _v12 = val1.pos
00362 _x = _v12
00363 start = end
00364 end += 24
00365 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00366 start = end
00367 end += 8
00368 (val1.reliability,) = _struct_d.unpack(str[start:end])
00369 start = end
00370 end += 72
00371 val1.covariance = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=9)
00372 start = end
00373 end += 1
00374 (val1.initialization,) = _struct_b.unpack(str[start:end])
00375 self.people.append(val1)
00376 start = end
00377 end += 4
00378 (length,) = _struct_I.unpack(str[start:end])
00379 pattern = '<%sf'%length
00380 start = end
00381 end += struct.calcsize(pattern)
00382 self.cooccurrence = numpy.frombuffer(str[start:end], dtype=numpy.float32, count=length)
00383 return self
00384 except struct.error as e:
00385 raise genpy.DeserializationError(e)
00386
00387 _struct_I = genpy.struct_I
00388 _struct_b = struct.Struct("<b")
00389 _struct_d = struct.Struct("<d")
00390 _struct_9d = struct.Struct("<9d")
00391 _struct_3I = struct.Struct("<3I")
00392 _struct_2I = struct.Struct("<2I")
00393 _struct_3d = struct.Struct("<3d")