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