00001 """autogenerated by genpy from pr2_gripper_sensor_msgs/PR2GripperForceServoFeedback.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 genpy
00008 import pr2_gripper_sensor_msgs.msg
00009
00010 class PR2GripperForceServoFeedback(genpy.Message):
00011 _md5sum = "a85c0d43537b45945527f5de565ab7c2"
00012 _type = "pr2_gripper_sensor_msgs/PR2GripperForceServoFeedback"
00013 _has_header = False
00014 _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
00015
00016 #feedback
00017 PR2GripperForceServoData data
00018
00019 ================================================================================
00020 MSG: pr2_gripper_sensor_msgs/PR2GripperForceServoData
00021 # Time the data was recorded at
00022 time stamp
00023
00024 # the force experienced by the finger Pads (N)
00025 # NOTE:this ignores data from the edges of the finger pressure
00026 float64 left_fingertip_pad_force
00027 float64 right_fingertip_pad_force
00028
00029 # the current gripper virtual parallel joint effort (in N)
00030 float64 joint_effort
00031
00032 # true when the gripper is no longer moving
00033 # and we have reached the desired force level
00034 bool force_achieved
00035
00036
00037 # the control state of our realtime controller
00038 PR2GripperSensorRTState rtstate
00039
00040 ================================================================================
00041 MSG: pr2_gripper_sensor_msgs/PR2GripperSensorRTState
00042 # the control state of our realtime controller
00043 int8 realtime_controller_state
00044
00045 # predefined values to indicate our realtime_controller_state
00046 int8 DISABLED = 0
00047 int8 POSITION_SERVO = 3
00048 int8 FORCE_SERVO = 4
00049 int8 FIND_CONTACT = 5
00050 int8 SLIP_SERVO = 6
00051 """
00052 __slots__ = ['data']
00053 _slot_types = ['pr2_gripper_sensor_msgs/PR2GripperForceServoData']
00054
00055 def __init__(self, *args, **kwds):
00056 """
00057 Constructor. Any message fields that are implicitly/explicitly
00058 set to None will be assigned a default value. The recommend
00059 use is keyword arguments as this is more robust to future message
00060 changes. You cannot mix in-order arguments and keyword arguments.
00061
00062 The available fields are:
00063 data
00064
00065 :param args: complete set of field values, in .msg order
00066 :param kwds: use keyword arguments corresponding to message field names
00067 to set specific fields.
00068 """
00069 if args or kwds:
00070 super(PR2GripperForceServoFeedback, self).__init__(*args, **kwds)
00071
00072 if self.data is None:
00073 self.data = pr2_gripper_sensor_msgs.msg.PR2GripperForceServoData()
00074 else:
00075 self.data = pr2_gripper_sensor_msgs.msg.PR2GripperForceServoData()
00076
00077 def _get_types(self):
00078 """
00079 internal API method
00080 """
00081 return self._slot_types
00082
00083 def serialize(self, buff):
00084 """
00085 serialize message into buffer
00086 :param buff: buffer, ``StringIO``
00087 """
00088 try:
00089 _x = self
00090 buff.write(_struct_2I3dBb.pack(_x.data.stamp.secs, _x.data.stamp.nsecs, _x.data.left_fingertip_pad_force, _x.data.right_fingertip_pad_force, _x.data.joint_effort, _x.data.force_achieved, _x.data.rtstate.realtime_controller_state))
00091 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00092 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00093
00094 def deserialize(self, str):
00095 """
00096 unpack serialized message in str into this message instance
00097 :param str: byte array of serialized message, ``str``
00098 """
00099 try:
00100 if self.data is None:
00101 self.data = pr2_gripper_sensor_msgs.msg.PR2GripperForceServoData()
00102 end = 0
00103 _x = self
00104 start = end
00105 end += 34
00106 (_x.data.stamp.secs, _x.data.stamp.nsecs, _x.data.left_fingertip_pad_force, _x.data.right_fingertip_pad_force, _x.data.joint_effort, _x.data.force_achieved, _x.data.rtstate.realtime_controller_state,) = _struct_2I3dBb.unpack(str[start:end])
00107 self.data.force_achieved = bool(self.data.force_achieved)
00108 return self
00109 except struct.error as e:
00110 raise genpy.DeserializationError(e)
00111
00112
00113 def serialize_numpy(self, buff, numpy):
00114 """
00115 serialize message with numpy array types into buffer
00116 :param buff: buffer, ``StringIO``
00117 :param numpy: numpy python module
00118 """
00119 try:
00120 _x = self
00121 buff.write(_struct_2I3dBb.pack(_x.data.stamp.secs, _x.data.stamp.nsecs, _x.data.left_fingertip_pad_force, _x.data.right_fingertip_pad_force, _x.data.joint_effort, _x.data.force_achieved, _x.data.rtstate.realtime_controller_state))
00122 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00123 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00124
00125 def deserialize_numpy(self, str, numpy):
00126 """
00127 unpack serialized message in str into this message instance using numpy for array types
00128 :param str: byte array of serialized message, ``str``
00129 :param numpy: numpy python module
00130 """
00131 try:
00132 if self.data is None:
00133 self.data = pr2_gripper_sensor_msgs.msg.PR2GripperForceServoData()
00134 end = 0
00135 _x = self
00136 start = end
00137 end += 34
00138 (_x.data.stamp.secs, _x.data.stamp.nsecs, _x.data.left_fingertip_pad_force, _x.data.right_fingertip_pad_force, _x.data.joint_effort, _x.data.force_achieved, _x.data.rtstate.realtime_controller_state,) = _struct_2I3dBb.unpack(str[start:end])
00139 self.data.force_achieved = bool(self.data.force_achieved)
00140 return self
00141 except struct.error as e:
00142 raise genpy.DeserializationError(e)
00143
00144 _struct_I = genpy.struct_I
00145 _struct_2I3dBb = struct.Struct("<2I3dBb")