_PR2GripperFindContactCommand.py
Go to the documentation of this file.
00001 """autogenerated by genpy from pr2_gripper_sensor_msgs/PR2GripperFindContactCommand.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 
00008 class PR2GripperFindContactCommand(genpy.Message):
00009   _md5sum = "4a38a1a8e495aae86921ef2b292ec260"
00010   _type = "pr2_gripper_sensor_msgs/PR2GripperFindContactCommand"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# set true if you want to calibrate the fingertip sensors on the start
00013 # of the find_contact action. While this is not necessary (and
00014 # the default value will not calibrate the sensors) for best 
00015 # performance it is recommended that you set this to true each time 
00016 # you are calling find_contact and are confident the fingertips are 
00017 # not touching anything
00018 # NOTE: SHOULD ONLY BE TRUE WHEN BOTH FINGERS ARE TOUCHING NOTHING
00019 bool zero_fingertip_sensors
00020 
00021 # the finger contact conditions that determine what our goal is
00022 # Leaving this field blank will result in the robot closing until
00023 # contact on BOTH fingers is achieved
00024 int8 contact_conditions
00025 
00026 # predefined values for the above contact_conditions variable
00027 int8 BOTH = 0   # both fingers must make contact
00028 int8 LEFT = 1   # just the left finger 
00029 int8 RIGHT = 2  # just the right finger
00030 int8 EITHER = 3 # either finger, we don't care which
00031 
00032 """
00033   # Pseudo-constants
00034   BOTH = 0
00035   LEFT = 1
00036   RIGHT = 2
00037   EITHER = 3
00038 
00039   __slots__ = ['zero_fingertip_sensors','contact_conditions']
00040   _slot_types = ['bool','int8']
00041 
00042   def __init__(self, *args, **kwds):
00043     """
00044     Constructor. Any message fields that are implicitly/explicitly
00045     set to None will be assigned a default value. The recommend
00046     use is keyword arguments as this is more robust to future message
00047     changes.  You cannot mix in-order arguments and keyword arguments.
00048 
00049     The available fields are:
00050        zero_fingertip_sensors,contact_conditions
00051 
00052     :param args: complete set of field values, in .msg order
00053     :param kwds: use keyword arguments corresponding to message field names
00054     to set specific fields.
00055     """
00056     if args or kwds:
00057       super(PR2GripperFindContactCommand, self).__init__(*args, **kwds)
00058       #message fields cannot be None, assign default values for those that are
00059       if self.zero_fingertip_sensors is None:
00060         self.zero_fingertip_sensors = False
00061       if self.contact_conditions is None:
00062         self.contact_conditions = 0
00063     else:
00064       self.zero_fingertip_sensors = False
00065       self.contact_conditions = 0
00066 
00067   def _get_types(self):
00068     """
00069     internal API method
00070     """
00071     return self._slot_types
00072 
00073   def serialize(self, buff):
00074     """
00075     serialize message into buffer
00076     :param buff: buffer, ``StringIO``
00077     """
00078     try:
00079       _x = self
00080       buff.write(_struct_Bb.pack(_x.zero_fingertip_sensors, _x.contact_conditions))
00081     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00082     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00083 
00084   def deserialize(self, str):
00085     """
00086     unpack serialized message in str into this message instance
00087     :param str: byte array of serialized message, ``str``
00088     """
00089     try:
00090       end = 0
00091       _x = self
00092       start = end
00093       end += 2
00094       (_x.zero_fingertip_sensors, _x.contact_conditions,) = _struct_Bb.unpack(str[start:end])
00095       self.zero_fingertip_sensors = bool(self.zero_fingertip_sensors)
00096       return self
00097     except struct.error as e:
00098       raise genpy.DeserializationError(e) #most likely buffer underfill
00099 
00100 
00101   def serialize_numpy(self, buff, numpy):
00102     """
00103     serialize message with numpy array types into buffer
00104     :param buff: buffer, ``StringIO``
00105     :param numpy: numpy python module
00106     """
00107     try:
00108       _x = self
00109       buff.write(_struct_Bb.pack(_x.zero_fingertip_sensors, _x.contact_conditions))
00110     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00111     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00112 
00113   def deserialize_numpy(self, str, numpy):
00114     """
00115     unpack serialized message in str into this message instance using numpy for array types
00116     :param str: byte array of serialized message, ``str``
00117     :param numpy: numpy python module
00118     """
00119     try:
00120       end = 0
00121       _x = self
00122       start = end
00123       end += 2
00124       (_x.zero_fingertip_sensors, _x.contact_conditions,) = _struct_Bb.unpack(str[start:end])
00125       self.zero_fingertip_sensors = bool(self.zero_fingertip_sensors)
00126       return self
00127     except struct.error as e:
00128       raise genpy.DeserializationError(e) #most likely buffer underfill
00129 
00130 _struct_I = genpy.struct_I
00131 _struct_Bb = struct.Struct("<Bb")


pr2_gripper_sensor_msgs
Author(s): Joe Romano
autogenerated on Mon Oct 6 2014 12:17:32