00001 """autogenerated by genpy from checkerboard_detector2/ObjectDetection.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 checkerboard_detector2.msg
00009 import std_msgs.msg
00010
00011 class ObjectDetection(genpy.Message):
00012 _md5sum = "9522c3b7d0b1ebe285597561ebb0bba3"
00013 _type = "checkerboard_detector2/ObjectDetection"
00014 _has_header = True
00015 _full_text = """Header header
00016 Object6DPose[] objects
00017 # unique image id these objects were taken from
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: checkerboard_detector2/Object6DPose
00039 # 6D pose of object
00040 geometry_msgs/Pose pose
00041
00042 # type of object, usually contains the filename of the object that allows the receiving side to visualize it
00043 # can also be used as a unique type id
00044 string type
00045 uint32 id
00046 ================================================================================
00047 MSG: geometry_msgs/Pose
00048 # A representation of pose in free space, composed of postion and orientation.
00049 Point position
00050 Quaternion orientation
00051
00052 ================================================================================
00053 MSG: geometry_msgs/Point
00054 # This contains the position of a point in free space
00055 float64 x
00056 float64 y
00057 float64 z
00058
00059 ================================================================================
00060 MSG: geometry_msgs/Quaternion
00061 # This represents an orientation in free space in quaternion form.
00062
00063 float64 x
00064 float64 y
00065 float64 z
00066 float64 w
00067
00068 """
00069 __slots__ = ['header','objects']
00070 _slot_types = ['std_msgs/Header','checkerboard_detector2/Object6DPose[]']
00071
00072 def __init__(self, *args, **kwds):
00073 """
00074 Constructor. Any message fields that are implicitly/explicitly
00075 set to None will be assigned a default value. The recommend
00076 use is keyword arguments as this is more robust to future message
00077 changes. You cannot mix in-order arguments and keyword arguments.
00078
00079 The available fields are:
00080 header,objects
00081
00082 :param args: complete set of field values, in .msg order
00083 :param kwds: use keyword arguments corresponding to message field names
00084 to set specific fields.
00085 """
00086 if args or kwds:
00087 super(ObjectDetection, self).__init__(*args, **kwds)
00088
00089 if self.header is None:
00090 self.header = std_msgs.msg.Header()
00091 if self.objects is None:
00092 self.objects = []
00093 else:
00094 self.header = std_msgs.msg.Header()
00095 self.objects = []
00096
00097 def _get_types(self):
00098 """
00099 internal API method
00100 """
00101 return self._slot_types
00102
00103 def serialize(self, buff):
00104 """
00105 serialize message into buffer
00106 :param buff: buffer, ``StringIO``
00107 """
00108 try:
00109 _x = self
00110 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00111 _x = self.header.frame_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 length = len(self.objects)
00118 buff.write(_struct_I.pack(length))
00119 for val1 in self.objects:
00120 _v1 = val1.pose
00121 _v2 = _v1.position
00122 _x = _v2
00123 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00124 _v3 = _v1.orientation
00125 _x = _v3
00126 buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
00127 _x = val1.type
00128 length = len(_x)
00129 if python3 or type(_x) == unicode:
00130 _x = _x.encode('utf-8')
00131 length = len(_x)
00132 buff.write(struct.pack('<I%ss'%length, length, _x))
00133 buff.write(_struct_I.pack(val1.id))
00134 except struct.error as se: self._check_types(se)
00135 except TypeError as te: self._check_types(te)
00136
00137 def deserialize(self, str):
00138 """
00139 unpack serialized message in str into this message instance
00140 :param str: byte array of serialized message, ``str``
00141 """
00142 try:
00143 if self.header is None:
00144 self.header = std_msgs.msg.Header()
00145 if self.objects is None:
00146 self.objects = None
00147 end = 0
00148 _x = self
00149 start = end
00150 end += 12
00151 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00152 start = end
00153 end += 4
00154 (length,) = _struct_I.unpack(str[start:end])
00155 start = end
00156 end += length
00157 if python3:
00158 self.header.frame_id = str[start:end].decode('utf-8')
00159 else:
00160 self.header.frame_id = str[start:end]
00161 start = end
00162 end += 4
00163 (length,) = _struct_I.unpack(str[start:end])
00164 self.objects = []
00165 for i in range(0, length):
00166 val1 = checkerboard_detector2.msg.Object6DPose()
00167 _v4 = val1.pose
00168 _v5 = _v4.position
00169 _x = _v5
00170 start = end
00171 end += 24
00172 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00173 _v6 = _v4.orientation
00174 _x = _v6
00175 start = end
00176 end += 32
00177 (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
00178 start = end
00179 end += 4
00180 (length,) = _struct_I.unpack(str[start:end])
00181 start = end
00182 end += length
00183 if python3:
00184 val1.type = str[start:end].decode('utf-8')
00185 else:
00186 val1.type = str[start:end]
00187 start = end
00188 end += 4
00189 (val1.id,) = _struct_I.unpack(str[start:end])
00190 self.objects.append(val1)
00191 return self
00192 except struct.error as e:
00193 raise genpy.DeserializationError(e)
00194
00195
00196 def serialize_numpy(self, buff, numpy):
00197 """
00198 serialize message with numpy array types into buffer
00199 :param buff: buffer, ``StringIO``
00200 :param numpy: numpy python module
00201 """
00202 try:
00203 _x = self
00204 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00205 _x = self.header.frame_id
00206 length = len(_x)
00207 if python3 or type(_x) == unicode:
00208 _x = _x.encode('utf-8')
00209 length = len(_x)
00210 buff.write(struct.pack('<I%ss'%length, length, _x))
00211 length = len(self.objects)
00212 buff.write(_struct_I.pack(length))
00213 for val1 in self.objects:
00214 _v7 = val1.pose
00215 _v8 = _v7.position
00216 _x = _v8
00217 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00218 _v9 = _v7.orientation
00219 _x = _v9
00220 buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
00221 _x = val1.type
00222 length = len(_x)
00223 if python3 or type(_x) == unicode:
00224 _x = _x.encode('utf-8')
00225 length = len(_x)
00226 buff.write(struct.pack('<I%ss'%length, length, _x))
00227 buff.write(_struct_I.pack(val1.id))
00228 except struct.error as se: self._check_types(se)
00229 except TypeError as te: self._check_types(te)
00230
00231 def deserialize_numpy(self, str, numpy):
00232 """
00233 unpack serialized message in str into this message instance using numpy for array types
00234 :param str: byte array of serialized message, ``str``
00235 :param numpy: numpy python module
00236 """
00237 try:
00238 if self.header is None:
00239 self.header = std_msgs.msg.Header()
00240 if self.objects is None:
00241 self.objects = None
00242 end = 0
00243 _x = self
00244 start = end
00245 end += 12
00246 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00247 start = end
00248 end += 4
00249 (length,) = _struct_I.unpack(str[start:end])
00250 start = end
00251 end += length
00252 if python3:
00253 self.header.frame_id = str[start:end].decode('utf-8')
00254 else:
00255 self.header.frame_id = str[start:end]
00256 start = end
00257 end += 4
00258 (length,) = _struct_I.unpack(str[start:end])
00259 self.objects = []
00260 for i in range(0, length):
00261 val1 = checkerboard_detector2.msg.Object6DPose()
00262 _v10 = val1.pose
00263 _v11 = _v10.position
00264 _x = _v11
00265 start = end
00266 end += 24
00267 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00268 _v12 = _v10.orientation
00269 _x = _v12
00270 start = end
00271 end += 32
00272 (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(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.type = str[start:end].decode('utf-8')
00280 else:
00281 val1.type = str[start:end]
00282 start = end
00283 end += 4
00284 (val1.id,) = _struct_I.unpack(str[start:end])
00285 self.objects.append(val1)
00286 return self
00287 except struct.error as e:
00288 raise genpy.DeserializationError(e)
00289
00290 _struct_I = genpy.struct_I
00291 _struct_3I = struct.Struct("<3I")
00292 _struct_4d = struct.Struct("<4d")
00293 _struct_3d = struct.Struct("<3d")