00001 """autogenerated by genpy from re_msgs/DetectedObject.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 re_msgs.msg
00008 import geometry_msgs.msg
00009
00010 class DetectedObject(genpy.Message):
00011 _md5sum = "db086185ac6f68f8b4560ea38a8ec39b"
00012 _type = "re_msgs/DetectedObject"
00013 _has_header = False
00014 _full_text = """# Information of object detected in an image by re_vision
00015 #
00016
00017 # detected points in the image
00018 Pixel[] points2d
00019 # detected 3d points in the camera reference
00020 geometry_msgs/Point[] points3d
00021 # pose of the object in the camera reference
00022 geometry_msgs/Pose pose
00023 # detected 3d points in the model reference
00024 geometry_msgs/Point[] points3d_model
00025 # detected 3d points octave
00026 int32[] octave
00027
00028 ================================================================================
00029 MSG: re_msgs/Pixel
00030 # top-left corner: (0,0)
00031
00032 int32 x
00033 int32 y
00034 ================================================================================
00035 MSG: geometry_msgs/Point
00036 # This contains the position of a point in free space
00037 float64 x
00038 float64 y
00039 float64 z
00040
00041 ================================================================================
00042 MSG: geometry_msgs/Pose
00043 # A representation of pose in free space, composed of postion and orientation.
00044 Point position
00045 Quaternion orientation
00046
00047 ================================================================================
00048 MSG: geometry_msgs/Quaternion
00049 # This represents an orientation in free space in quaternion form.
00050
00051 float64 x
00052 float64 y
00053 float64 z
00054 float64 w
00055
00056 """
00057 __slots__ = ['points2d','points3d','pose','points3d_model','octave']
00058 _slot_types = ['re_msgs/Pixel[]','geometry_msgs/Point[]','geometry_msgs/Pose','geometry_msgs/Point[]','int32[]']
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 points2d,points3d,pose,points3d_model,octave
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(DetectedObject, self).__init__(*args, **kwds)
00076
00077 if self.points2d is None:
00078 self.points2d = []
00079 if self.points3d is None:
00080 self.points3d = []
00081 if self.pose is None:
00082 self.pose = geometry_msgs.msg.Pose()
00083 if self.points3d_model is None:
00084 self.points3d_model = []
00085 if self.octave is None:
00086 self.octave = []
00087 else:
00088 self.points2d = []
00089 self.points3d = []
00090 self.pose = geometry_msgs.msg.Pose()
00091 self.points3d_model = []
00092 self.octave = []
00093
00094 def _get_types(self):
00095 """
00096 internal API method
00097 """
00098 return self._slot_types
00099
00100 def serialize(self, buff):
00101 """
00102 serialize message into buffer
00103 :param buff: buffer, ``StringIO``
00104 """
00105 try:
00106 length = len(self.points2d)
00107 buff.write(_struct_I.pack(length))
00108 for val1 in self.points2d:
00109 _x = val1
00110 buff.write(_struct_2i.pack(_x.x, _x.y))
00111 length = len(self.points3d)
00112 buff.write(_struct_I.pack(length))
00113 for val1 in self.points3d:
00114 _x = val1
00115 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00116 _x = self
00117 buff.write(_struct_7d.pack(_x.pose.position.x, _x.pose.position.y, _x.pose.position.z, _x.pose.orientation.x, _x.pose.orientation.y, _x.pose.orientation.z, _x.pose.orientation.w))
00118 length = len(self.points3d_model)
00119 buff.write(_struct_I.pack(length))
00120 for val1 in self.points3d_model:
00121 _x = val1
00122 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00123 length = len(self.octave)
00124 buff.write(_struct_I.pack(length))
00125 pattern = '<%si'%length
00126 buff.write(struct.pack(pattern, *self.octave))
00127 except struct.error as se: self._check_types(se)
00128 except TypeError as te: self._check_types(te)
00129
00130 def deserialize(self, str):
00131 """
00132 unpack serialized message in str into this message instance
00133 :param str: byte array of serialized message, ``str``
00134 """
00135 try:
00136 if self.points2d is None:
00137 self.points2d = None
00138 if self.points3d is None:
00139 self.points3d = None
00140 if self.pose is None:
00141 self.pose = geometry_msgs.msg.Pose()
00142 if self.points3d_model is None:
00143 self.points3d_model = None
00144 end = 0
00145 start = end
00146 end += 4
00147 (length,) = _struct_I.unpack(str[start:end])
00148 self.points2d = []
00149 for i in range(0, length):
00150 val1 = re_msgs.msg.Pixel()
00151 _x = val1
00152 start = end
00153 end += 8
00154 (_x.x, _x.y,) = _struct_2i.unpack(str[start:end])
00155 self.points2d.append(val1)
00156 start = end
00157 end += 4
00158 (length,) = _struct_I.unpack(str[start:end])
00159 self.points3d = []
00160 for i in range(0, length):
00161 val1 = geometry_msgs.msg.Point()
00162 _x = val1
00163 start = end
00164 end += 24
00165 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00166 self.points3d.append(val1)
00167 _x = self
00168 start = end
00169 end += 56
00170 (_x.pose.position.x, _x.pose.position.y, _x.pose.position.z, _x.pose.orientation.x, _x.pose.orientation.y, _x.pose.orientation.z, _x.pose.orientation.w,) = _struct_7d.unpack(str[start:end])
00171 start = end
00172 end += 4
00173 (length,) = _struct_I.unpack(str[start:end])
00174 self.points3d_model = []
00175 for i in range(0, length):
00176 val1 = geometry_msgs.msg.Point()
00177 _x = val1
00178 start = end
00179 end += 24
00180 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00181 self.points3d_model.append(val1)
00182 start = end
00183 end += 4
00184 (length,) = _struct_I.unpack(str[start:end])
00185 pattern = '<%si'%length
00186 start = end
00187 end += struct.calcsize(pattern)
00188 self.octave = struct.unpack(pattern, str[start:end])
00189 return self
00190 except struct.error as e:
00191 raise genpy.DeserializationError(e)
00192
00193
00194 def serialize_numpy(self, buff, numpy):
00195 """
00196 serialize message with numpy array types into buffer
00197 :param buff: buffer, ``StringIO``
00198 :param numpy: numpy python module
00199 """
00200 try:
00201 length = len(self.points2d)
00202 buff.write(_struct_I.pack(length))
00203 for val1 in self.points2d:
00204 _x = val1
00205 buff.write(_struct_2i.pack(_x.x, _x.y))
00206 length = len(self.points3d)
00207 buff.write(_struct_I.pack(length))
00208 for val1 in self.points3d:
00209 _x = val1
00210 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00211 _x = self
00212 buff.write(_struct_7d.pack(_x.pose.position.x, _x.pose.position.y, _x.pose.position.z, _x.pose.orientation.x, _x.pose.orientation.y, _x.pose.orientation.z, _x.pose.orientation.w))
00213 length = len(self.points3d_model)
00214 buff.write(_struct_I.pack(length))
00215 for val1 in self.points3d_model:
00216 _x = val1
00217 buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00218 length = len(self.octave)
00219 buff.write(_struct_I.pack(length))
00220 pattern = '<%si'%length
00221 buff.write(self.octave.tostring())
00222 except struct.error as se: self._check_types(se)
00223 except TypeError as te: self._check_types(te)
00224
00225 def deserialize_numpy(self, str, numpy):
00226 """
00227 unpack serialized message in str into this message instance using numpy for array types
00228 :param str: byte array of serialized message, ``str``
00229 :param numpy: numpy python module
00230 """
00231 try:
00232 if self.points2d is None:
00233 self.points2d = None
00234 if self.points3d is None:
00235 self.points3d = None
00236 if self.pose is None:
00237 self.pose = geometry_msgs.msg.Pose()
00238 if self.points3d_model is None:
00239 self.points3d_model = None
00240 end = 0
00241 start = end
00242 end += 4
00243 (length,) = _struct_I.unpack(str[start:end])
00244 self.points2d = []
00245 for i in range(0, length):
00246 val1 = re_msgs.msg.Pixel()
00247 _x = val1
00248 start = end
00249 end += 8
00250 (_x.x, _x.y,) = _struct_2i.unpack(str[start:end])
00251 self.points2d.append(val1)
00252 start = end
00253 end += 4
00254 (length,) = _struct_I.unpack(str[start:end])
00255 self.points3d = []
00256 for i in range(0, length):
00257 val1 = geometry_msgs.msg.Point()
00258 _x = val1
00259 start = end
00260 end += 24
00261 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00262 self.points3d.append(val1)
00263 _x = self
00264 start = end
00265 end += 56
00266 (_x.pose.position.x, _x.pose.position.y, _x.pose.position.z, _x.pose.orientation.x, _x.pose.orientation.y, _x.pose.orientation.z, _x.pose.orientation.w,) = _struct_7d.unpack(str[start:end])
00267 start = end
00268 end += 4
00269 (length,) = _struct_I.unpack(str[start:end])
00270 self.points3d_model = []
00271 for i in range(0, length):
00272 val1 = geometry_msgs.msg.Point()
00273 _x = val1
00274 start = end
00275 end += 24
00276 (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00277 self.points3d_model.append(val1)
00278 start = end
00279 end += 4
00280 (length,) = _struct_I.unpack(str[start:end])
00281 pattern = '<%si'%length
00282 start = end
00283 end += struct.calcsize(pattern)
00284 self.octave = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
00285 return self
00286 except struct.error as e:
00287 raise genpy.DeserializationError(e)
00288
00289 _struct_I = genpy.struct_I
00290 _struct_7d = struct.Struct("<7d")
00291 _struct_2i = struct.Struct("<2i")
00292 _struct_3d = struct.Struct("<3d")