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