00001 """autogenerated by genpy from vision_msgs/cop_feedback.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_feedback(genpy.Message):
00010 _md5sum = "e876bab42e04aea08a659bc18c7b47cc"
00011 _type = "vision_msgs/cop_feedback"
00012 _has_header = False
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 float64 evaluation # A score describing the quality of the outcomes of the perception primitive
00016 system_error[] error # A list of occured system failures which might be caused by the perception primitive
00017 uint64[] eval_whitelist # list results which are included into the evaluation (note: default is all, not none, so an empty list means that all elements have to be evaluated, since the case that none of the results should get an evaluation does not make much sense)
00018
00019 ================================================================================
00020 MSG: vision_msgs/system_error
00021 uint64 MANIPULATION_POSE_UNREACHABLE = 64
00022 uint64 GRASP_FAILED = 128 # Grasp into the void
00023 uint64 OBJECT_NOT_FOUND = 256
00024 uint64 VISION_PRIMITIVE_FAILED = 512
00025 uint64 CONTRADICTING_TACTILE_FEEDBACK = 1024 # Collide without expecting it
00026 uint64 CONTRADICTING_VISION_RESULTS = 2048
00027 uint64 GRASP_FAILED_AND_CRASHED = 4096 # Throwing something out of the way
00028 uint64 JLO_ERROR = 8192 # Could not get position
00029 uint64 VECTOR_FIELD_CANT_REACH = 16384 # The arm got stuck along the way, did not reach the final grasping pose
00030
00031 uint64 error_id # One of the error constants defined above
00032 string node_name # The node causing this error
00033 string error_description # Further information about the error
00034
00035 """
00036 __slots__ = ['perception_primitive','evaluation','error','eval_whitelist']
00037 _slot_types = ['uint64','float64','vision_msgs/system_error[]','uint64[]']
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,evaluation,error,eval_whitelist
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_feedback, self).__init__(*args, **kwds)
00055
00056 if self.perception_primitive is None:
00057 self.perception_primitive = 0
00058 if self.evaluation is None:
00059 self.evaluation = 0.
00060 if self.error is None:
00061 self.error = []
00062 if self.eval_whitelist is None:
00063 self.eval_whitelist = []
00064 else:
00065 self.perception_primitive = 0
00066 self.evaluation = 0.
00067 self.error = []
00068 self.eval_whitelist = []
00069
00070 def _get_types(self):
00071 """
00072 internal API method
00073 """
00074 return self._slot_types
00075
00076 def serialize(self, buff):
00077 """
00078 serialize message into buffer
00079 :param buff: buffer, ``StringIO``
00080 """
00081 try:
00082 _x = self
00083 buff.write(_struct_Qd.pack(_x.perception_primitive, _x.evaluation))
00084 length = len(self.error)
00085 buff.write(_struct_I.pack(length))
00086 for val1 in self.error:
00087 buff.write(_struct_Q.pack(val1.error_id))
00088 _x = val1.node_name
00089 length = len(_x)
00090 if python3 or type(_x) == unicode:
00091 _x = _x.encode('utf-8')
00092 length = len(_x)
00093 buff.write(struct.pack('<I%ss'%length, length, _x))
00094 _x = val1.error_description
00095 length = len(_x)
00096 if python3 or type(_x) == unicode:
00097 _x = _x.encode('utf-8')
00098 length = len(_x)
00099 buff.write(struct.pack('<I%ss'%length, length, _x))
00100 length = len(self.eval_whitelist)
00101 buff.write(_struct_I.pack(length))
00102 pattern = '<%sQ'%length
00103 buff.write(struct.pack(pattern, *self.eval_whitelist))
00104 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00105 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00106
00107 def deserialize(self, str):
00108 """
00109 unpack serialized message in str into this message instance
00110 :param str: byte array of serialized message, ``str``
00111 """
00112 try:
00113 if self.error is None:
00114 self.error = None
00115 end = 0
00116 _x = self
00117 start = end
00118 end += 16
00119 (_x.perception_primitive, _x.evaluation,) = _struct_Qd.unpack(str[start:end])
00120 start = end
00121 end += 4
00122 (length,) = _struct_I.unpack(str[start:end])
00123 self.error = []
00124 for i in range(0, length):
00125 val1 = vision_msgs.msg.system_error()
00126 start = end
00127 end += 8
00128 (val1.error_id,) = _struct_Q.unpack(str[start:end])
00129 start = end
00130 end += 4
00131 (length,) = _struct_I.unpack(str[start:end])
00132 start = end
00133 end += length
00134 if python3:
00135 val1.node_name = str[start:end].decode('utf-8')
00136 else:
00137 val1.node_name = str[start:end]
00138 start = end
00139 end += 4
00140 (length,) = _struct_I.unpack(str[start:end])
00141 start = end
00142 end += length
00143 if python3:
00144 val1.error_description = str[start:end].decode('utf-8')
00145 else:
00146 val1.error_description = str[start:end]
00147 self.error.append(val1)
00148 start = end
00149 end += 4
00150 (length,) = _struct_I.unpack(str[start:end])
00151 pattern = '<%sQ'%length
00152 start = end
00153 end += struct.calcsize(pattern)
00154 self.eval_whitelist = struct.unpack(pattern, str[start:end])
00155 return self
00156 except struct.error as e:
00157 raise genpy.DeserializationError(e)
00158
00159
00160 def serialize_numpy(self, buff, numpy):
00161 """
00162 serialize message with numpy array types into buffer
00163 :param buff: buffer, ``StringIO``
00164 :param numpy: numpy python module
00165 """
00166 try:
00167 _x = self
00168 buff.write(_struct_Qd.pack(_x.perception_primitive, _x.evaluation))
00169 length = len(self.error)
00170 buff.write(_struct_I.pack(length))
00171 for val1 in self.error:
00172 buff.write(_struct_Q.pack(val1.error_id))
00173 _x = val1.node_name
00174 length = len(_x)
00175 if python3 or type(_x) == unicode:
00176 _x = _x.encode('utf-8')
00177 length = len(_x)
00178 buff.write(struct.pack('<I%ss'%length, length, _x))
00179 _x = val1.error_description
00180 length = len(_x)
00181 if python3 or type(_x) == unicode:
00182 _x = _x.encode('utf-8')
00183 length = len(_x)
00184 buff.write(struct.pack('<I%ss'%length, length, _x))
00185 length = len(self.eval_whitelist)
00186 buff.write(_struct_I.pack(length))
00187 pattern = '<%sQ'%length
00188 buff.write(self.eval_whitelist.tostring())
00189 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00190 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00191
00192 def deserialize_numpy(self, str, numpy):
00193 """
00194 unpack serialized message in str into this message instance using numpy for array types
00195 :param str: byte array of serialized message, ``str``
00196 :param numpy: numpy python module
00197 """
00198 try:
00199 if self.error is None:
00200 self.error = None
00201 end = 0
00202 _x = self
00203 start = end
00204 end += 16
00205 (_x.perception_primitive, _x.evaluation,) = _struct_Qd.unpack(str[start:end])
00206 start = end
00207 end += 4
00208 (length,) = _struct_I.unpack(str[start:end])
00209 self.error = []
00210 for i in range(0, length):
00211 val1 = vision_msgs.msg.system_error()
00212 start = end
00213 end += 8
00214 (val1.error_id,) = _struct_Q.unpack(str[start:end])
00215 start = end
00216 end += 4
00217 (length,) = _struct_I.unpack(str[start:end])
00218 start = end
00219 end += length
00220 if python3:
00221 val1.node_name = str[start:end].decode('utf-8')
00222 else:
00223 val1.node_name = str[start:end]
00224 start = end
00225 end += 4
00226 (length,) = _struct_I.unpack(str[start:end])
00227 start = end
00228 end += length
00229 if python3:
00230 val1.error_description = str[start:end].decode('utf-8')
00231 else:
00232 val1.error_description = str[start:end]
00233 self.error.append(val1)
00234 start = end
00235 end += 4
00236 (length,) = _struct_I.unpack(str[start:end])
00237 pattern = '<%sQ'%length
00238 start = end
00239 end += struct.calcsize(pattern)
00240 self.eval_whitelist = numpy.frombuffer(str[start:end], dtype=numpy.uint64, count=length)
00241 return self
00242 except struct.error as e:
00243 raise genpy.DeserializationError(e)
00244
00245 _struct_I = genpy.struct_I
00246 _struct_Q = struct.Struct("<Q")
00247 _struct_Qd = struct.Struct("<Qd")