Go to the documentation of this file.00001 """autogenerated by genpy from pr2_gripper_sensor_msgs/PR2GripperGrabData.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 pr2_gripper_sensor_msgs.msg
00008
00009 class PR2GripperGrabData(genpy.Message):
00010 _md5sum = "2c917fd7a48bc8daa7ae36787c8b7a82"
00011 _type = "pr2_gripper_sensor_msgs/PR2GripperGrabData"
00012 _has_header = False
00013 _full_text = """# the control state of our realtime controller
00014 PR2GripperSensorRTState rtstate
00015 ================================================================================
00016 MSG: pr2_gripper_sensor_msgs/PR2GripperSensorRTState
00017 # the control state of our realtime controller
00018 int8 realtime_controller_state
00019
00020 # predefined values to indicate our realtime_controller_state
00021 int8 DISABLED = 0
00022 int8 POSITION_SERVO = 3
00023 int8 FORCE_SERVO = 4
00024 int8 FIND_CONTACT = 5
00025 int8 SLIP_SERVO = 6
00026 """
00027 __slots__ = ['rtstate']
00028 _slot_types = ['pr2_gripper_sensor_msgs/PR2GripperSensorRTState']
00029
00030 def __init__(self, *args, **kwds):
00031 """
00032 Constructor. Any message fields that are implicitly/explicitly
00033 set to None will be assigned a default value. The recommend
00034 use is keyword arguments as this is more robust to future message
00035 changes. You cannot mix in-order arguments and keyword arguments.
00036
00037 The available fields are:
00038 rtstate
00039
00040 :param args: complete set of field values, in .msg order
00041 :param kwds: use keyword arguments corresponding to message field names
00042 to set specific fields.
00043 """
00044 if args or kwds:
00045 super(PR2GripperGrabData, self).__init__(*args, **kwds)
00046
00047 if self.rtstate is None:
00048 self.rtstate = pr2_gripper_sensor_msgs.msg.PR2GripperSensorRTState()
00049 else:
00050 self.rtstate = pr2_gripper_sensor_msgs.msg.PR2GripperSensorRTState()
00051
00052 def _get_types(self):
00053 """
00054 internal API method
00055 """
00056 return self._slot_types
00057
00058 def serialize(self, buff):
00059 """
00060 serialize message into buffer
00061 :param buff: buffer, ``StringIO``
00062 """
00063 try:
00064 buff.write(_struct_b.pack(self.rtstate.realtime_controller_state))
00065 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00066 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00067
00068 def deserialize(self, str):
00069 """
00070 unpack serialized message in str into this message instance
00071 :param str: byte array of serialized message, ``str``
00072 """
00073 try:
00074 if self.rtstate is None:
00075 self.rtstate = pr2_gripper_sensor_msgs.msg.PR2GripperSensorRTState()
00076 end = 0
00077 start = end
00078 end += 1
00079 (self.rtstate.realtime_controller_state,) = _struct_b.unpack(str[start:end])
00080 return self
00081 except struct.error as e:
00082 raise genpy.DeserializationError(e)
00083
00084
00085 def serialize_numpy(self, buff, numpy):
00086 """
00087 serialize message with numpy array types into buffer
00088 :param buff: buffer, ``StringIO``
00089 :param numpy: numpy python module
00090 """
00091 try:
00092 buff.write(_struct_b.pack(self.rtstate.realtime_controller_state))
00093 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00094 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00095
00096 def deserialize_numpy(self, str, numpy):
00097 """
00098 unpack serialized message in str into this message instance using numpy for array types
00099 :param str: byte array of serialized message, ``str``
00100 :param numpy: numpy python module
00101 """
00102 try:
00103 if self.rtstate is None:
00104 self.rtstate = pr2_gripper_sensor_msgs.msg.PR2GripperSensorRTState()
00105 end = 0
00106 start = end
00107 end += 1
00108 (self.rtstate.realtime_controller_state,) = _struct_b.unpack(str[start:end])
00109 return self
00110 except struct.error as e:
00111 raise genpy.DeserializationError(e)
00112
00113 _struct_I = genpy.struct_I
00114 _struct_b = struct.Struct("<b")