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