_DetectionResult.py
Go to the documentation of this file.
00001 """autogenerated by genpy from re_kinect_object_detector/DetectionResult.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 import std_msgs.msg
00010 import sensor_msgs.msg
00011 
00012 class DetectionResult(genpy.Message):
00013   _md5sum = "ff5eaa0c7838288761622bd26a33514f"
00014   _type = "re_kinect_object_detector/DetectionResult"
00015   _has_header = False #flag to mark the presence of a Header object
00016   _full_text = """sensor_msgs/Image Image
00017 string[] ObjectNames
00018 re_msgs/DetectedObject[] Detections
00019 
00020 
00021 ================================================================================
00022 MSG: sensor_msgs/Image
00023 # This message contains an uncompressed image
00024 # (0, 0) is at top-left corner of image
00025 #
00026 
00027 Header header        # Header timestamp should be acquisition time of image
00028                      # Header frame_id should be optical frame of camera
00029                      # origin of frame should be optical center of cameara
00030                      # +x should point to the right in the image
00031                      # +y should point down in the image
00032                      # +z should point into to plane of the image
00033                      # If the frame_id here and the frame_id of the CameraInfo
00034                      # message associated with the image conflict
00035                      # the behavior is undefined
00036 
00037 uint32 height         # image height, that is, number of rows
00038 uint32 width          # image width, that is, number of columns
00039 
00040 # The legal values for encoding are in file src/image_encodings.cpp
00041 # If you want to standardize a new string format, join
00042 # ros-users@lists.sourceforge.net and send an email proposing a new encoding.
00043 
00044 string encoding       # Encoding of pixels -- channel meaning, ordering, size
00045                       # taken from the list of strings in src/image_encodings.cpp
00046 
00047 uint8 is_bigendian    # is this data bigendian?
00048 uint32 step           # Full row length in bytes
00049 uint8[] data          # actual matrix data, size is (step * rows)
00050 
00051 ================================================================================
00052 MSG: std_msgs/Header
00053 # Standard metadata for higher-level stamped data types.
00054 # This is generally used to communicate timestamped data 
00055 # in a particular coordinate frame.
00056 # 
00057 # sequence ID: consecutively increasing ID 
00058 uint32 seq
00059 #Two-integer timestamp that is expressed as:
00060 # * stamp.secs: seconds (stamp_secs) since epoch
00061 # * stamp.nsecs: nanoseconds since stamp_secs
00062 # time-handling sugar is provided by the client library
00063 time stamp
00064 #Frame this data is associated with
00065 # 0: no frame
00066 # 1: global frame
00067 string frame_id
00068 
00069 ================================================================================
00070 MSG: re_msgs/DetectedObject
00071 # Information of object detected in an image by re_vision
00072 #
00073 
00074 # detected points in the image
00075 Pixel[] points2d
00076 # detected 3d points in the camera reference
00077 geometry_msgs/Point[] points3d
00078 # pose of the object in the camera reference
00079 geometry_msgs/Pose pose
00080 # detected 3d points in the model reference
00081 geometry_msgs/Point[] points3d_model
00082 # detected 3d points octave
00083 int32[] octave
00084 
00085 ================================================================================
00086 MSG: re_msgs/Pixel
00087 # top-left corner: (0,0)
00088 
00089 int32 x
00090 int32 y
00091 ================================================================================
00092 MSG: geometry_msgs/Point
00093 # This contains the position of a point in free space
00094 float64 x
00095 float64 y
00096 float64 z
00097 
00098 ================================================================================
00099 MSG: geometry_msgs/Pose
00100 # A representation of pose in free space, composed of postion and orientation. 
00101 Point position
00102 Quaternion orientation
00103 
00104 ================================================================================
00105 MSG: geometry_msgs/Quaternion
00106 # This represents an orientation in free space in quaternion form.
00107 
00108 float64 x
00109 float64 y
00110 float64 z
00111 float64 w
00112 
00113 """
00114   __slots__ = ['Image','ObjectNames','Detections']
00115   _slot_types = ['sensor_msgs/Image','string[]','re_msgs/DetectedObject[]']
00116 
00117   def __init__(self, *args, **kwds):
00118     """
00119     Constructor. Any message fields that are implicitly/explicitly
00120     set to None will be assigned a default value. The recommend
00121     use is keyword arguments as this is more robust to future message
00122     changes.  You cannot mix in-order arguments and keyword arguments.
00123 
00124     The available fields are:
00125        Image,ObjectNames,Detections
00126 
00127     :param args: complete set of field values, in .msg order
00128     :param kwds: use keyword arguments corresponding to message field names
00129     to set specific fields.
00130     """
00131     if args or kwds:
00132       super(DetectionResult, self).__init__(*args, **kwds)
00133       #message fields cannot be None, assign default values for those that are
00134       if self.Image is None:
00135         self.Image = sensor_msgs.msg.Image()
00136       if self.ObjectNames is None:
00137         self.ObjectNames = []
00138       if self.Detections is None:
00139         self.Detections = []
00140     else:
00141       self.Image = sensor_msgs.msg.Image()
00142       self.ObjectNames = []
00143       self.Detections = []
00144 
00145   def _get_types(self):
00146     """
00147     internal API method
00148     """
00149     return self._slot_types
00150 
00151   def serialize(self, buff):
00152     """
00153     serialize message into buffer
00154     :param buff: buffer, ``StringIO``
00155     """
00156     try:
00157       _x = self
00158       buff.write(_struct_3I.pack(_x.Image.header.seq, _x.Image.header.stamp.secs, _x.Image.header.stamp.nsecs))
00159       _x = self.Image.header.frame_id
00160       length = len(_x)
00161       if python3 or type(_x) == unicode:
00162         _x = _x.encode('utf-8')
00163         length = len(_x)
00164       buff.write(struct.pack('<I%ss'%length, length, _x))
00165       _x = self
00166       buff.write(_struct_2I.pack(_x.Image.height, _x.Image.width))
00167       _x = self.Image.encoding
00168       length = len(_x)
00169       if python3 or type(_x) == unicode:
00170         _x = _x.encode('utf-8')
00171         length = len(_x)
00172       buff.write(struct.pack('<I%ss'%length, length, _x))
00173       _x = self
00174       buff.write(_struct_BI.pack(_x.Image.is_bigendian, _x.Image.step))
00175       _x = self.Image.data
00176       length = len(_x)
00177       # - if encoded as a list instead, serialize as bytes instead of string
00178       if type(_x) in [list, tuple]:
00179         buff.write(struct.pack('<I%sB'%length, length, *_x))
00180       else:
00181         buff.write(struct.pack('<I%ss'%length, length, _x))
00182       length = len(self.ObjectNames)
00183       buff.write(_struct_I.pack(length))
00184       for val1 in self.ObjectNames:
00185         length = len(val1)
00186         if python3 or type(val1) == unicode:
00187           val1 = val1.encode('utf-8')
00188           length = len(val1)
00189         buff.write(struct.pack('<I%ss'%length, length, val1))
00190       length = len(self.Detections)
00191       buff.write(_struct_I.pack(length))
00192       for val1 in self.Detections:
00193         length = len(val1.points2d)
00194         buff.write(_struct_I.pack(length))
00195         for val2 in val1.points2d:
00196           _x = val2
00197           buff.write(_struct_2i.pack(_x.x, _x.y))
00198         length = len(val1.points3d)
00199         buff.write(_struct_I.pack(length))
00200         for val2 in val1.points3d:
00201           _x = val2
00202           buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00203         _v1 = val1.pose
00204         _v2 = _v1.position
00205         _x = _v2
00206         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00207         _v3 = _v1.orientation
00208         _x = _v3
00209         buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
00210         length = len(val1.points3d_model)
00211         buff.write(_struct_I.pack(length))
00212         for val2 in val1.points3d_model:
00213           _x = val2
00214           buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00215         length = len(val1.octave)
00216         buff.write(_struct_I.pack(length))
00217         pattern = '<%si'%length
00218         buff.write(struct.pack(pattern, *val1.octave))
00219     except struct.error as se: self._check_types(se)
00220     except TypeError as te: self._check_types(te)
00221 
00222   def deserialize(self, str):
00223     """
00224     unpack serialized message in str into this message instance
00225     :param str: byte array of serialized message, ``str``
00226     """
00227     try:
00228       if self.Image is None:
00229         self.Image = sensor_msgs.msg.Image()
00230       if self.Detections is None:
00231         self.Detections = None
00232       end = 0
00233       _x = self
00234       start = end
00235       end += 12
00236       (_x.Image.header.seq, _x.Image.header.stamp.secs, _x.Image.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00237       start = end
00238       end += 4
00239       (length,) = _struct_I.unpack(str[start:end])
00240       start = end
00241       end += length
00242       if python3:
00243         self.Image.header.frame_id = str[start:end].decode('utf-8')
00244       else:
00245         self.Image.header.frame_id = str[start:end]
00246       _x = self
00247       start = end
00248       end += 8
00249       (_x.Image.height, _x.Image.width,) = _struct_2I.unpack(str[start:end])
00250       start = end
00251       end += 4
00252       (length,) = _struct_I.unpack(str[start:end])
00253       start = end
00254       end += length
00255       if python3:
00256         self.Image.encoding = str[start:end].decode('utf-8')
00257       else:
00258         self.Image.encoding = str[start:end]
00259       _x = self
00260       start = end
00261       end += 5
00262       (_x.Image.is_bigendian, _x.Image.step,) = _struct_BI.unpack(str[start:end])
00263       start = end
00264       end += 4
00265       (length,) = _struct_I.unpack(str[start:end])
00266       start = end
00267       end += length
00268       if python3:
00269         self.Image.data = str[start:end].decode('utf-8')
00270       else:
00271         self.Image.data = str[start:end]
00272       start = end
00273       end += 4
00274       (length,) = _struct_I.unpack(str[start:end])
00275       self.ObjectNames = []
00276       for i in range(0, length):
00277         start = end
00278         end += 4
00279         (length,) = _struct_I.unpack(str[start:end])
00280         start = end
00281         end += length
00282         if python3:
00283           val1 = str[start:end].decode('utf-8')
00284         else:
00285           val1 = str[start:end]
00286         self.ObjectNames.append(val1)
00287       start = end
00288       end += 4
00289       (length,) = _struct_I.unpack(str[start:end])
00290       self.Detections = []
00291       for i in range(0, length):
00292         val1 = re_msgs.msg.DetectedObject()
00293         start = end
00294         end += 4
00295         (length,) = _struct_I.unpack(str[start:end])
00296         val1.points2d = []
00297         for i in range(0, length):
00298           val2 = re_msgs.msg.Pixel()
00299           _x = val2
00300           start = end
00301           end += 8
00302           (_x.x, _x.y,) = _struct_2i.unpack(str[start:end])
00303           val1.points2d.append(val2)
00304         start = end
00305         end += 4
00306         (length,) = _struct_I.unpack(str[start:end])
00307         val1.points3d = []
00308         for i in range(0, length):
00309           val2 = geometry_msgs.msg.Point()
00310           _x = val2
00311           start = end
00312           end += 24
00313           (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00314           val1.points3d.append(val2)
00315         _v4 = val1.pose
00316         _v5 = _v4.position
00317         _x = _v5
00318         start = end
00319         end += 24
00320         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00321         _v6 = _v4.orientation
00322         _x = _v6
00323         start = end
00324         end += 32
00325         (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
00326         start = end
00327         end += 4
00328         (length,) = _struct_I.unpack(str[start:end])
00329         val1.points3d_model = []
00330         for i in range(0, length):
00331           val2 = geometry_msgs.msg.Point()
00332           _x = val2
00333           start = end
00334           end += 24
00335           (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00336           val1.points3d_model.append(val2)
00337         start = end
00338         end += 4
00339         (length,) = _struct_I.unpack(str[start:end])
00340         pattern = '<%si'%length
00341         start = end
00342         end += struct.calcsize(pattern)
00343         val1.octave = struct.unpack(pattern, str[start:end])
00344         self.Detections.append(val1)
00345       return self
00346     except struct.error as e:
00347       raise genpy.DeserializationError(e) #most likely buffer underfill
00348 
00349 
00350   def serialize_numpy(self, buff, numpy):
00351     """
00352     serialize message with numpy array types into buffer
00353     :param buff: buffer, ``StringIO``
00354     :param numpy: numpy python module
00355     """
00356     try:
00357       _x = self
00358       buff.write(_struct_3I.pack(_x.Image.header.seq, _x.Image.header.stamp.secs, _x.Image.header.stamp.nsecs))
00359       _x = self.Image.header.frame_id
00360       length = len(_x)
00361       if python3 or type(_x) == unicode:
00362         _x = _x.encode('utf-8')
00363         length = len(_x)
00364       buff.write(struct.pack('<I%ss'%length, length, _x))
00365       _x = self
00366       buff.write(_struct_2I.pack(_x.Image.height, _x.Image.width))
00367       _x = self.Image.encoding
00368       length = len(_x)
00369       if python3 or type(_x) == unicode:
00370         _x = _x.encode('utf-8')
00371         length = len(_x)
00372       buff.write(struct.pack('<I%ss'%length, length, _x))
00373       _x = self
00374       buff.write(_struct_BI.pack(_x.Image.is_bigendian, _x.Image.step))
00375       _x = self.Image.data
00376       length = len(_x)
00377       # - if encoded as a list instead, serialize as bytes instead of string
00378       if type(_x) in [list, tuple]:
00379         buff.write(struct.pack('<I%sB'%length, length, *_x))
00380       else:
00381         buff.write(struct.pack('<I%ss'%length, length, _x))
00382       length = len(self.ObjectNames)
00383       buff.write(_struct_I.pack(length))
00384       for val1 in self.ObjectNames:
00385         length = len(val1)
00386         if python3 or type(val1) == unicode:
00387           val1 = val1.encode('utf-8')
00388           length = len(val1)
00389         buff.write(struct.pack('<I%ss'%length, length, val1))
00390       length = len(self.Detections)
00391       buff.write(_struct_I.pack(length))
00392       for val1 in self.Detections:
00393         length = len(val1.points2d)
00394         buff.write(_struct_I.pack(length))
00395         for val2 in val1.points2d:
00396           _x = val2
00397           buff.write(_struct_2i.pack(_x.x, _x.y))
00398         length = len(val1.points3d)
00399         buff.write(_struct_I.pack(length))
00400         for val2 in val1.points3d:
00401           _x = val2
00402           buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00403         _v7 = val1.pose
00404         _v8 = _v7.position
00405         _x = _v8
00406         buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00407         _v9 = _v7.orientation
00408         _x = _v9
00409         buff.write(_struct_4d.pack(_x.x, _x.y, _x.z, _x.w))
00410         length = len(val1.points3d_model)
00411         buff.write(_struct_I.pack(length))
00412         for val2 in val1.points3d_model:
00413           _x = val2
00414           buff.write(_struct_3d.pack(_x.x, _x.y, _x.z))
00415         length = len(val1.octave)
00416         buff.write(_struct_I.pack(length))
00417         pattern = '<%si'%length
00418         buff.write(val1.octave.tostring())
00419     except struct.error as se: self._check_types(se)
00420     except TypeError as te: self._check_types(te)
00421 
00422   def deserialize_numpy(self, str, numpy):
00423     """
00424     unpack serialized message in str into this message instance using numpy for array types
00425     :param str: byte array of serialized message, ``str``
00426     :param numpy: numpy python module
00427     """
00428     try:
00429       if self.Image is None:
00430         self.Image = sensor_msgs.msg.Image()
00431       if self.Detections is None:
00432         self.Detections = None
00433       end = 0
00434       _x = self
00435       start = end
00436       end += 12
00437       (_x.Image.header.seq, _x.Image.header.stamp.secs, _x.Image.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00438       start = end
00439       end += 4
00440       (length,) = _struct_I.unpack(str[start:end])
00441       start = end
00442       end += length
00443       if python3:
00444         self.Image.header.frame_id = str[start:end].decode('utf-8')
00445       else:
00446         self.Image.header.frame_id = str[start:end]
00447       _x = self
00448       start = end
00449       end += 8
00450       (_x.Image.height, _x.Image.width,) = _struct_2I.unpack(str[start:end])
00451       start = end
00452       end += 4
00453       (length,) = _struct_I.unpack(str[start:end])
00454       start = end
00455       end += length
00456       if python3:
00457         self.Image.encoding = str[start:end].decode('utf-8')
00458       else:
00459         self.Image.encoding = str[start:end]
00460       _x = self
00461       start = end
00462       end += 5
00463       (_x.Image.is_bigendian, _x.Image.step,) = _struct_BI.unpack(str[start:end])
00464       start = end
00465       end += 4
00466       (length,) = _struct_I.unpack(str[start:end])
00467       start = end
00468       end += length
00469       if python3:
00470         self.Image.data = str[start:end].decode('utf-8')
00471       else:
00472         self.Image.data = str[start:end]
00473       start = end
00474       end += 4
00475       (length,) = _struct_I.unpack(str[start:end])
00476       self.ObjectNames = []
00477       for i in range(0, length):
00478         start = end
00479         end += 4
00480         (length,) = _struct_I.unpack(str[start:end])
00481         start = end
00482         end += length
00483         if python3:
00484           val1 = str[start:end].decode('utf-8')
00485         else:
00486           val1 = str[start:end]
00487         self.ObjectNames.append(val1)
00488       start = end
00489       end += 4
00490       (length,) = _struct_I.unpack(str[start:end])
00491       self.Detections = []
00492       for i in range(0, length):
00493         val1 = re_msgs.msg.DetectedObject()
00494         start = end
00495         end += 4
00496         (length,) = _struct_I.unpack(str[start:end])
00497         val1.points2d = []
00498         for i in range(0, length):
00499           val2 = re_msgs.msg.Pixel()
00500           _x = val2
00501           start = end
00502           end += 8
00503           (_x.x, _x.y,) = _struct_2i.unpack(str[start:end])
00504           val1.points2d.append(val2)
00505         start = end
00506         end += 4
00507         (length,) = _struct_I.unpack(str[start:end])
00508         val1.points3d = []
00509         for i in range(0, length):
00510           val2 = geometry_msgs.msg.Point()
00511           _x = val2
00512           start = end
00513           end += 24
00514           (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00515           val1.points3d.append(val2)
00516         _v10 = val1.pose
00517         _v11 = _v10.position
00518         _x = _v11
00519         start = end
00520         end += 24
00521         (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00522         _v12 = _v10.orientation
00523         _x = _v12
00524         start = end
00525         end += 32
00526         (_x.x, _x.y, _x.z, _x.w,) = _struct_4d.unpack(str[start:end])
00527         start = end
00528         end += 4
00529         (length,) = _struct_I.unpack(str[start:end])
00530         val1.points3d_model = []
00531         for i in range(0, length):
00532           val2 = geometry_msgs.msg.Point()
00533           _x = val2
00534           start = end
00535           end += 24
00536           (_x.x, _x.y, _x.z,) = _struct_3d.unpack(str[start:end])
00537           val1.points3d_model.append(val2)
00538         start = end
00539         end += 4
00540         (length,) = _struct_I.unpack(str[start:end])
00541         pattern = '<%si'%length
00542         start = end
00543         end += struct.calcsize(pattern)
00544         val1.octave = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
00545         self.Detections.append(val1)
00546       return self
00547     except struct.error as e:
00548       raise genpy.DeserializationError(e) #most likely buffer underfill
00549 
00550 _struct_I = genpy.struct_I
00551 _struct_BI = struct.Struct("<BI")
00552 _struct_2I = struct.Struct("<2I")
00553 _struct_3I = struct.Struct("<3I")
00554 _struct_4d = struct.Struct("<4d")
00555 _struct_2i = struct.Struct("<2i")
00556 _struct_3d = struct.Struct("<3d")


re_kinect_object_detector
Author(s): Andreas Koch
autogenerated on Sun Jan 5 2014 11:38:30