00001 """autogenerated by genpy from pr2_controllers_msgs/Pr2GripperCommandResult.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007
00008 class Pr2GripperCommandResult(genpy.Message):
00009 _md5sum = "e4cbff56d3562bcf113da5a5adeef91f"
00010 _type = "pr2_controllers_msgs/Pr2GripperCommandResult"
00011 _has_header = False
00012 _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
00013 float64 position # The current gripper gap size (in meters)
00014 float64 effort # The current effort exerted (in Newtons)
00015 bool stalled # True iff the gripper is exerting max effort and not moving
00016 bool reached_goal # True iff the gripper position has reached the commanded setpoint
00017
00018 """
00019 __slots__ = ['position','effort','stalled','reached_goal']
00020 _slot_types = ['float64','float64','bool','bool']
00021
00022 def __init__(self, *args, **kwds):
00023 """
00024 Constructor. Any message fields that are implicitly/explicitly
00025 set to None will be assigned a default value. The recommend
00026 use is keyword arguments as this is more robust to future message
00027 changes. You cannot mix in-order arguments and keyword arguments.
00028
00029 The available fields are:
00030 position,effort,stalled,reached_goal
00031
00032 :param args: complete set of field values, in .msg order
00033 :param kwds: use keyword arguments corresponding to message field names
00034 to set specific fields.
00035 """
00036 if args or kwds:
00037 super(Pr2GripperCommandResult, self).__init__(*args, **kwds)
00038
00039 if self.position is None:
00040 self.position = 0.
00041 if self.effort is None:
00042 self.effort = 0.
00043 if self.stalled is None:
00044 self.stalled = False
00045 if self.reached_goal is None:
00046 self.reached_goal = False
00047 else:
00048 self.position = 0.
00049 self.effort = 0.
00050 self.stalled = False
00051 self.reached_goal = False
00052
00053 def _get_types(self):
00054 """
00055 internal API method
00056 """
00057 return self._slot_types
00058
00059 def serialize(self, buff):
00060 """
00061 serialize message into buffer
00062 :param buff: buffer, ``StringIO``
00063 """
00064 try:
00065 _x = self
00066 buff.write(_struct_2d2B.pack(_x.position, _x.effort, _x.stalled, _x.reached_goal))
00067 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00068 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00069
00070 def deserialize(self, str):
00071 """
00072 unpack serialized message in str into this message instance
00073 :param str: byte array of serialized message, ``str``
00074 """
00075 try:
00076 end = 0
00077 _x = self
00078 start = end
00079 end += 18
00080 (_x.position, _x.effort, _x.stalled, _x.reached_goal,) = _struct_2d2B.unpack(str[start:end])
00081 self.stalled = bool(self.stalled)
00082 self.reached_goal = bool(self.reached_goal)
00083 return self
00084 except struct.error as e:
00085 raise genpy.DeserializationError(e)
00086
00087
00088 def serialize_numpy(self, buff, numpy):
00089 """
00090 serialize message with numpy array types into buffer
00091 :param buff: buffer, ``StringIO``
00092 :param numpy: numpy python module
00093 """
00094 try:
00095 _x = self
00096 buff.write(_struct_2d2B.pack(_x.position, _x.effort, _x.stalled, _x.reached_goal))
00097 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00098 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00099
00100 def deserialize_numpy(self, str, numpy):
00101 """
00102 unpack serialized message in str into this message instance using numpy for array types
00103 :param str: byte array of serialized message, ``str``
00104 :param numpy: numpy python module
00105 """
00106 try:
00107 end = 0
00108 _x = self
00109 start = end
00110 end += 18
00111 (_x.position, _x.effort, _x.stalled, _x.reached_goal,) = _struct_2d2B.unpack(str[start:end])
00112 self.stalled = bool(self.stalled)
00113 self.reached_goal = bool(self.reached_goal)
00114 return self
00115 except struct.error as e:
00116 raise genpy.DeserializationError(e)
00117
00118 _struct_I = genpy.struct_I
00119 _struct_2d2B = struct.Struct("<2d2B")