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