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