_cop_answer.py
Go to the documentation of this file.
00001 """autogenerated by genpy from vision_msgs/cop_answer.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 vision_msgs.msg
00008 
00009 class cop_answer(genpy.Message):
00010   _md5sum = "1f3f6145b8086e5dd7885136dd895de4"
00011   _type = "vision_msgs/cop_answer"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """#Message that cop uses to  answer on specified topics, U. Klank klank@in.tum.de
00014 uint64 perception_primitive         # Perception primitive that caused this answer
00015 string error                        # eventuelly there are errors like no object found
00016 aposteriori_position[] found_poses  # list od found pose candidate for a certain query
00017 
00018 ================================================================================
00019 MSG: vision_msgs/aposteriori_position
00020 #objects a posteriori position, U. Klank klank@in.tum.de
00021 uint64 objectId                  #id of an cop object
00022 float64 probability              #approximated a posteriori probability of the object beeing at the position
00023 uint64 position                  #lo id of an position
00024 cop_descriptor[] models           #list of all models assigned to the returned object
00025 ================================================================================
00026 MSG: vision_msgs/cop_descriptor
00027 #Descriptors of models used in cop, U. Klank klank@in.tum.de
00028 uint64  object_id          # unique id that could be used for a query
00029 string  sem_class          # connected semantic concept
00030 string  type               # Class name that was used to generate the corresponding cop descriptor plugin, 
00031                            # example are: ShapeModel, ColorClass, DeformShapeModel
00032 float64 quality            # the current quality assinged to this descriptor
00033 
00034 
00035 
00036 
00037 """
00038   __slots__ = ['perception_primitive','error','found_poses']
00039   _slot_types = ['uint64','string','vision_msgs/aposteriori_position[]']
00040 
00041   def __init__(self, *args, **kwds):
00042     """
00043     Constructor. Any message fields that are implicitly/explicitly
00044     set to None will be assigned a default value. The recommend
00045     use is keyword arguments as this is more robust to future message
00046     changes.  You cannot mix in-order arguments and keyword arguments.
00047 
00048     The available fields are:
00049        perception_primitive,error,found_poses
00050 
00051     :param args: complete set of field values, in .msg order
00052     :param kwds: use keyword arguments corresponding to message field names
00053     to set specific fields.
00054     """
00055     if args or kwds:
00056       super(cop_answer, self).__init__(*args, **kwds)
00057       #message fields cannot be None, assign default values for those that are
00058       if self.perception_primitive is None:
00059         self.perception_primitive = 0
00060       if self.error is None:
00061         self.error = ''
00062       if self.found_poses is None:
00063         self.found_poses = []
00064     else:
00065       self.perception_primitive = 0
00066       self.error = ''
00067       self.found_poses = []
00068 
00069   def _get_types(self):
00070     """
00071     internal API method
00072     """
00073     return self._slot_types
00074 
00075   def serialize(self, buff):
00076     """
00077     serialize message into buffer
00078     :param buff: buffer, ``StringIO``
00079     """
00080     try:
00081       buff.write(_struct_Q.pack(self.perception_primitive))
00082       _x = self.error
00083       length = len(_x)
00084       if python3 or type(_x) == unicode:
00085         _x = _x.encode('utf-8')
00086         length = len(_x)
00087       buff.write(struct.pack('<I%ss'%length, length, _x))
00088       length = len(self.found_poses)
00089       buff.write(_struct_I.pack(length))
00090       for val1 in self.found_poses:
00091         _x = val1
00092         buff.write(_struct_QdQ.pack(_x.objectId, _x.probability, _x.position))
00093         length = len(val1.models)
00094         buff.write(_struct_I.pack(length))
00095         for val2 in val1.models:
00096           buff.write(_struct_Q.pack(val2.object_id))
00097           _x = val2.sem_class
00098           length = len(_x)
00099           if python3 or type(_x) == unicode:
00100             _x = _x.encode('utf-8')
00101             length = len(_x)
00102           buff.write(struct.pack('<I%ss'%length, length, _x))
00103           _x = val2.type
00104           length = len(_x)
00105           if python3 or type(_x) == unicode:
00106             _x = _x.encode('utf-8')
00107             length = len(_x)
00108           buff.write(struct.pack('<I%ss'%length, length, _x))
00109           buff.write(_struct_d.pack(val2.quality))
00110     except struct.error as se: self._check_types(se)
00111     except TypeError as te: self._check_types(te)
00112 
00113   def deserialize(self, str):
00114     """
00115     unpack serialized message in str into this message instance
00116     :param str: byte array of serialized message, ``str``
00117     """
00118     try:
00119       if self.found_poses is None:
00120         self.found_poses = None
00121       end = 0
00122       start = end
00123       end += 8
00124       (self.perception_primitive,) = _struct_Q.unpack(str[start:end])
00125       start = end
00126       end += 4
00127       (length,) = _struct_I.unpack(str[start:end])
00128       start = end
00129       end += length
00130       if python3:
00131         self.error = str[start:end].decode('utf-8')
00132       else:
00133         self.error = str[start:end]
00134       start = end
00135       end += 4
00136       (length,) = _struct_I.unpack(str[start:end])
00137       self.found_poses = []
00138       for i in range(0, length):
00139         val1 = vision_msgs.msg.aposteriori_position()
00140         _x = val1
00141         start = end
00142         end += 24
00143         (_x.objectId, _x.probability, _x.position,) = _struct_QdQ.unpack(str[start:end])
00144         start = end
00145         end += 4
00146         (length,) = _struct_I.unpack(str[start:end])
00147         val1.models = []
00148         for i in range(0, length):
00149           val2 = vision_msgs.msg.cop_descriptor()
00150           start = end
00151           end += 8
00152           (val2.object_id,) = _struct_Q.unpack(str[start:end])
00153           start = end
00154           end += 4
00155           (length,) = _struct_I.unpack(str[start:end])
00156           start = end
00157           end += length
00158           if python3:
00159             val2.sem_class = str[start:end].decode('utf-8')
00160           else:
00161             val2.sem_class = str[start:end]
00162           start = end
00163           end += 4
00164           (length,) = _struct_I.unpack(str[start:end])
00165           start = end
00166           end += length
00167           if python3:
00168             val2.type = str[start:end].decode('utf-8')
00169           else:
00170             val2.type = str[start:end]
00171           start = end
00172           end += 8
00173           (val2.quality,) = _struct_d.unpack(str[start:end])
00174           val1.models.append(val2)
00175         self.found_poses.append(val1)
00176       return self
00177     except struct.error as e:
00178       raise genpy.DeserializationError(e) #most likely buffer underfill
00179 
00180 
00181   def serialize_numpy(self, buff, numpy):
00182     """
00183     serialize message with numpy array types into buffer
00184     :param buff: buffer, ``StringIO``
00185     :param numpy: numpy python module
00186     """
00187     try:
00188       buff.write(_struct_Q.pack(self.perception_primitive))
00189       _x = self.error
00190       length = len(_x)
00191       if python3 or type(_x) == unicode:
00192         _x = _x.encode('utf-8')
00193         length = len(_x)
00194       buff.write(struct.pack('<I%ss'%length, length, _x))
00195       length = len(self.found_poses)
00196       buff.write(_struct_I.pack(length))
00197       for val1 in self.found_poses:
00198         _x = val1
00199         buff.write(_struct_QdQ.pack(_x.objectId, _x.probability, _x.position))
00200         length = len(val1.models)
00201         buff.write(_struct_I.pack(length))
00202         for val2 in val1.models:
00203           buff.write(_struct_Q.pack(val2.object_id))
00204           _x = val2.sem_class
00205           length = len(_x)
00206           if python3 or type(_x) == unicode:
00207             _x = _x.encode('utf-8')
00208             length = len(_x)
00209           buff.write(struct.pack('<I%ss'%length, length, _x))
00210           _x = val2.type
00211           length = len(_x)
00212           if python3 or type(_x) == unicode:
00213             _x = _x.encode('utf-8')
00214             length = len(_x)
00215           buff.write(struct.pack('<I%ss'%length, length, _x))
00216           buff.write(_struct_d.pack(val2.quality))
00217     except struct.error as se: self._check_types(se)
00218     except TypeError as te: self._check_types(te)
00219 
00220   def deserialize_numpy(self, str, numpy):
00221     """
00222     unpack serialized message in str into this message instance using numpy for array types
00223     :param str: byte array of serialized message, ``str``
00224     :param numpy: numpy python module
00225     """
00226     try:
00227       if self.found_poses is None:
00228         self.found_poses = None
00229       end = 0
00230       start = end
00231       end += 8
00232       (self.perception_primitive,) = _struct_Q.unpack(str[start:end])
00233       start = end
00234       end += 4
00235       (length,) = _struct_I.unpack(str[start:end])
00236       start = end
00237       end += length
00238       if python3:
00239         self.error = str[start:end].decode('utf-8')
00240       else:
00241         self.error = str[start:end]
00242       start = end
00243       end += 4
00244       (length,) = _struct_I.unpack(str[start:end])
00245       self.found_poses = []
00246       for i in range(0, length):
00247         val1 = vision_msgs.msg.aposteriori_position()
00248         _x = val1
00249         start = end
00250         end += 24
00251         (_x.objectId, _x.probability, _x.position,) = _struct_QdQ.unpack(str[start:end])
00252         start = end
00253         end += 4
00254         (length,) = _struct_I.unpack(str[start:end])
00255         val1.models = []
00256         for i in range(0, length):
00257           val2 = vision_msgs.msg.cop_descriptor()
00258           start = end
00259           end += 8
00260           (val2.object_id,) = _struct_Q.unpack(str[start:end])
00261           start = end
00262           end += 4
00263           (length,) = _struct_I.unpack(str[start:end])
00264           start = end
00265           end += length
00266           if python3:
00267             val2.sem_class = str[start:end].decode('utf-8')
00268           else:
00269             val2.sem_class = str[start:end]
00270           start = end
00271           end += 4
00272           (length,) = _struct_I.unpack(str[start:end])
00273           start = end
00274           end += length
00275           if python3:
00276             val2.type = str[start:end].decode('utf-8')
00277           else:
00278             val2.type = str[start:end]
00279           start = end
00280           end += 8
00281           (val2.quality,) = _struct_d.unpack(str[start:end])
00282           val1.models.append(val2)
00283         self.found_poses.append(val1)
00284       return self
00285     except struct.error as e:
00286       raise genpy.DeserializationError(e) #most likely buffer underfill
00287 
00288 _struct_I = genpy.struct_I
00289 _struct_Q = struct.Struct("<Q")
00290 _struct_d = struct.Struct("<d")
00291 _struct_QdQ = struct.Struct("<QdQ")


vision_msgs
Author(s): Ulrich F Klank
autogenerated on Thu Jan 2 2014 11:21:42