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