_ArmHandResult.py
Go to the documentation of this file.
00001 """autogenerated by genpy from cogman_msgs/ArmHandResult.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 ArmHandResult(genpy.Message):
00010   _md5sum = "96fe826375e10406e4d32548d703c09c"
00011   _type = "cogman_msgs/ArmHandResult"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
00014 
00015 #result
00016 float32 distance_to_goal
00017 string situation            #Allowed: grasped slipped released unreachable ik_deadlock need_to_move_base
00018 vision_msgs/system_error error   #Description of error
00019 uint64[] better_base_ids    #List of lo_id's where we could grasp better
00020 
00021 ================================================================================
00022 MSG: vision_msgs/system_error
00023 uint64 MANIPULATION_POSE_UNREACHABLE = 64
00024 uint64 GRASP_FAILED = 128  # Grasp into the void
00025 uint64 OBJECT_NOT_FOUND = 256
00026 uint64 VISION_PRIMITIVE_FAILED = 512
00027 uint64 CONTRADICTING_TACTILE_FEEDBACK = 1024  # Collide without expecting it
00028 uint64 CONTRADICTING_VISION_RESULTS = 2048
00029 uint64 GRASP_FAILED_AND_CRASHED = 4096  # Throwing something out of the way
00030 uint64 JLO_ERROR = 8192  # Could not get position
00031 uint64 VECTOR_FIELD_CANT_REACH = 16384  # The arm got stuck along the way, did not reach the final grasping pose
00032 
00033 uint64  error_id                # One of the error constants defined above
00034 string  node_name               # The node causing this error
00035 string  error_description       # Further information about the error
00036 
00037 """
00038   __slots__ = ['distance_to_goal','situation','error','better_base_ids']
00039   _slot_types = ['float32','string','vision_msgs/system_error','uint64[]']
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        distance_to_goal,situation,error,better_base_ids
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(ArmHandResult, self).__init__(*args, **kwds)
00057       #message fields cannot be None, assign default values for those that are
00058       if self.distance_to_goal is None:
00059         self.distance_to_goal = 0.
00060       if self.situation is None:
00061         self.situation = ''
00062       if self.error is None:
00063         self.error = vision_msgs.msg.system_error()
00064       if self.better_base_ids is None:
00065         self.better_base_ids = []
00066     else:
00067       self.distance_to_goal = 0.
00068       self.situation = ''
00069       self.error = vision_msgs.msg.system_error()
00070       self.better_base_ids = []
00071 
00072   def _get_types(self):
00073     """
00074     internal API method
00075     """
00076     return self._slot_types
00077 
00078   def serialize(self, buff):
00079     """
00080     serialize message into buffer
00081     :param buff: buffer, ``StringIO``
00082     """
00083     try:
00084       buff.write(_struct_f.pack(self.distance_to_goal))
00085       _x = self.situation
00086       length = len(_x)
00087       if python3 or type(_x) == unicode:
00088         _x = _x.encode('utf-8')
00089         length = len(_x)
00090       buff.write(struct.pack('<I%ss'%length, length, _x))
00091       buff.write(_struct_Q.pack(self.error.error_id))
00092       _x = self.error.node_name
00093       length = len(_x)
00094       if python3 or type(_x) == unicode:
00095         _x = _x.encode('utf-8')
00096         length = len(_x)
00097       buff.write(struct.pack('<I%ss'%length, length, _x))
00098       _x = self.error.error_description
00099       length = len(_x)
00100       if python3 or type(_x) == unicode:
00101         _x = _x.encode('utf-8')
00102         length = len(_x)
00103       buff.write(struct.pack('<I%ss'%length, length, _x))
00104       length = len(self.better_base_ids)
00105       buff.write(_struct_I.pack(length))
00106       pattern = '<%sQ'%length
00107       buff.write(struct.pack(pattern, *self.better_base_ids))
00108     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00109     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00110 
00111   def deserialize(self, str):
00112     """
00113     unpack serialized message in str into this message instance
00114     :param str: byte array of serialized message, ``str``
00115     """
00116     try:
00117       if self.error is None:
00118         self.error = vision_msgs.msg.system_error()
00119       end = 0
00120       start = end
00121       end += 4
00122       (self.distance_to_goal,) = _struct_f.unpack(str[start:end])
00123       start = end
00124       end += 4
00125       (length,) = _struct_I.unpack(str[start:end])
00126       start = end
00127       end += length
00128       if python3:
00129         self.situation = str[start:end].decode('utf-8')
00130       else:
00131         self.situation = str[start:end]
00132       start = end
00133       end += 8
00134       (self.error.error_id,) = _struct_Q.unpack(str[start:end])
00135       start = end
00136       end += 4
00137       (length,) = _struct_I.unpack(str[start:end])
00138       start = end
00139       end += length
00140       if python3:
00141         self.error.node_name = str[start:end].decode('utf-8')
00142       else:
00143         self.error.node_name = str[start:end]
00144       start = end
00145       end += 4
00146       (length,) = _struct_I.unpack(str[start:end])
00147       start = end
00148       end += length
00149       if python3:
00150         self.error.error_description = str[start:end].decode('utf-8')
00151       else:
00152         self.error.error_description = str[start:end]
00153       start = end
00154       end += 4
00155       (length,) = _struct_I.unpack(str[start:end])
00156       pattern = '<%sQ'%length
00157       start = end
00158       end += struct.calcsize(pattern)
00159       self.better_base_ids = struct.unpack(pattern, str[start:end])
00160       return self
00161     except struct.error as e:
00162       raise genpy.DeserializationError(e) #most likely buffer underfill
00163 
00164 
00165   def serialize_numpy(self, buff, numpy):
00166     """
00167     serialize message with numpy array types into buffer
00168     :param buff: buffer, ``StringIO``
00169     :param numpy: numpy python module
00170     """
00171     try:
00172       buff.write(_struct_f.pack(self.distance_to_goal))
00173       _x = self.situation
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       buff.write(_struct_Q.pack(self.error.error_id))
00180       _x = self.error.node_name
00181       length = len(_x)
00182       if python3 or type(_x) == unicode:
00183         _x = _x.encode('utf-8')
00184         length = len(_x)
00185       buff.write(struct.pack('<I%ss'%length, length, _x))
00186       _x = self.error.error_description
00187       length = len(_x)
00188       if python3 or type(_x) == unicode:
00189         _x = _x.encode('utf-8')
00190         length = len(_x)
00191       buff.write(struct.pack('<I%ss'%length, length, _x))
00192       length = len(self.better_base_ids)
00193       buff.write(_struct_I.pack(length))
00194       pattern = '<%sQ'%length
00195       buff.write(self.better_base_ids.tostring())
00196     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00197     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00198 
00199   def deserialize_numpy(self, str, numpy):
00200     """
00201     unpack serialized message in str into this message instance using numpy for array types
00202     :param str: byte array of serialized message, ``str``
00203     :param numpy: numpy python module
00204     """
00205     try:
00206       if self.error is None:
00207         self.error = vision_msgs.msg.system_error()
00208       end = 0
00209       start = end
00210       end += 4
00211       (self.distance_to_goal,) = _struct_f.unpack(str[start:end])
00212       start = end
00213       end += 4
00214       (length,) = _struct_I.unpack(str[start:end])
00215       start = end
00216       end += length
00217       if python3:
00218         self.situation = str[start:end].decode('utf-8')
00219       else:
00220         self.situation = str[start:end]
00221       start = end
00222       end += 8
00223       (self.error.error_id,) = _struct_Q.unpack(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         self.error.node_name = str[start:end].decode('utf-8')
00231       else:
00232         self.error.node_name = 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.error_description = str[start:end].decode('utf-8')
00240       else:
00241         self.error.error_description = str[start:end]
00242       start = end
00243       end += 4
00244       (length,) = _struct_I.unpack(str[start:end])
00245       pattern = '<%sQ'%length
00246       start = end
00247       end += struct.calcsize(pattern)
00248       self.better_base_ids = numpy.frombuffer(str[start:end], dtype=numpy.uint64, count=length)
00249       return self
00250     except struct.error as e:
00251       raise genpy.DeserializationError(e) #most likely buffer underfill
00252 
00253 _struct_I = genpy.struct_I
00254 _struct_Q = struct.Struct("<Q")
00255 _struct_f = struct.Struct("<f")


cogman_msgs
Author(s): Alexis Maldonado
autogenerated on Mon Oct 6 2014 00:48:49