00001 """autogenerated by genmsg_py from PR2GripperEventDetectorCommand.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005
00006 class PR2GripperEventDetectorCommand(roslib.message.Message):
00007 _md5sum = "b91a7e1e863671a84c1d06e0cac3146e"
00008 _type = "pr2_gripper_sensor_msgs/PR2GripperEventDetectorCommand"
00009 _has_header = False
00010 _full_text = """# state variable that defines what events we would like to trigger on
00011 # Leaving this field blank will result in the robot triggering when
00012 # anything touches the sides of the finger or an impact is detected
00013 # with the hand/arm.
00014 int8 trigger_conditions
00015 # definitions for our various trigger_conditions values
00016 # trigger on either acceleration contact or finger sensor side impact
00017 int8 FINGER_SIDE_IMPACT_OR_ACC = 0
00018 # tigger once both slip and acceleration signals occur
00019 int8 SLIP_AND_ACC = 1
00020 # trigger on either slip, acceleration, or finger sensor side impact
00021 int8 FINGER_SIDE_IMPACT_OR_SLIP_OR_ACC = 2
00022 # trigger only on slip information
00023 int8 SLIP = 3
00024 # trigger only on acceleration contact information
00025 int8 ACC = 4
00026
00027
00028 # the amount of acceleration to trigger on (acceleration vector magnitude)
00029 # Units = m/s^2
00030 # The user needs to be concerned here about not setting the trigger too
00031 # low so that is set off by the robot's own motions.
00032 #
00033 # For large rapid motions, say by a motion planner, 5 m/s^2 is a good level
00034 # For small delicate controlled motions this can be set MUCH lower (try 2.0)
00035 #
00036 # NOTE: When moving the gripper joint (opening/closing the grippr)
00037 # the high gearing of the PR2 gripper causes large acceleration vibrations
00038 # which will cause triggering to occur. This is a known drawback of the PR2.
00039 #
00040 # NOTE: Leaving this value blank will result in a 0 m/s^2 trigger. If you
00041 # are using a trigger_conditions value that returns on acceleration contact
00042 # events then it will immediately exceed your trigger and return
00043 float64 acceleration_trigger_magnitude
00044
00045
00046 # the slip detector gain to trigger on (either finger) : try 0.01
00047 # higher values decrease slip sensitivty (to a point)
00048 # lower values increase sensitivity (to a point)
00049 #
00050 # NOTE: Leaving this value blank will result in the most sensitive slip level.
00051 float64 slip_trigger_magnitude
00052 """
00053
00054 FINGER_SIDE_IMPACT_OR_ACC = 0
00055 SLIP_AND_ACC = 1
00056 FINGER_SIDE_IMPACT_OR_SLIP_OR_ACC = 2
00057 SLIP = 3
00058 ACC = 4
00059
00060 __slots__ = ['trigger_conditions','acceleration_trigger_magnitude','slip_trigger_magnitude']
00061 _slot_types = ['int8','float64','float64']
00062
00063 def __init__(self, *args, **kwds):
00064 """
00065 Constructor. Any message fields that are implicitly/explicitly
00066 set to None will be assigned a default value. The recommend
00067 use is keyword arguments as this is more robust to future message
00068 changes. You cannot mix in-order arguments and keyword arguments.
00069
00070 The available fields are:
00071 trigger_conditions,acceleration_trigger_magnitude,slip_trigger_magnitude
00072
00073 @param args: complete set of field values, in .msg order
00074 @param kwds: use keyword arguments corresponding to message field names
00075 to set specific fields.
00076 """
00077 if args or kwds:
00078 super(PR2GripperEventDetectorCommand, self).__init__(*args, **kwds)
00079
00080 if self.trigger_conditions is None:
00081 self.trigger_conditions = 0
00082 if self.acceleration_trigger_magnitude is None:
00083 self.acceleration_trigger_magnitude = 0.
00084 if self.slip_trigger_magnitude is None:
00085 self.slip_trigger_magnitude = 0.
00086 else:
00087 self.trigger_conditions = 0
00088 self.acceleration_trigger_magnitude = 0.
00089 self.slip_trigger_magnitude = 0.
00090
00091 def _get_types(self):
00092 """
00093 internal API method
00094 """
00095 return self._slot_types
00096
00097 def serialize(self, buff):
00098 """
00099 serialize message into buffer
00100 @param buff: buffer
00101 @type buff: StringIO
00102 """
00103 try:
00104 _x = self
00105 buff.write(_struct_b2d.pack(_x.trigger_conditions, _x.acceleration_trigger_magnitude, _x.slip_trigger_magnitude))
00106 except struct.error, se: self._check_types(se)
00107 except TypeError, te: self._check_types(te)
00108
00109 def deserialize(self, str):
00110 """
00111 unpack serialized message in str into this message instance
00112 @param str: byte array of serialized message
00113 @type str: str
00114 """
00115 try:
00116 end = 0
00117 _x = self
00118 start = end
00119 end += 17
00120 (_x.trigger_conditions, _x.acceleration_trigger_magnitude, _x.slip_trigger_magnitude,) = _struct_b2d.unpack(str[start:end])
00121 return self
00122 except struct.error, e:
00123 raise roslib.message.DeserializationError(e)
00124
00125
00126 def serialize_numpy(self, buff, numpy):
00127 """
00128 serialize message with numpy array types into buffer
00129 @param buff: buffer
00130 @type buff: StringIO
00131 @param numpy: numpy python module
00132 @type numpy module
00133 """
00134 try:
00135 _x = self
00136 buff.write(_struct_b2d.pack(_x.trigger_conditions, _x.acceleration_trigger_magnitude, _x.slip_trigger_magnitude))
00137 except struct.error, se: self._check_types(se)
00138 except TypeError, te: self._check_types(te)
00139
00140 def deserialize_numpy(self, str, numpy):
00141 """
00142 unpack serialized message in str into this message instance using numpy for array types
00143 @param str: byte array of serialized message
00144 @type str: str
00145 @param numpy: numpy python module
00146 @type numpy: module
00147 """
00148 try:
00149 end = 0
00150 _x = self
00151 start = end
00152 end += 17
00153 (_x.trigger_conditions, _x.acceleration_trigger_magnitude, _x.slip_trigger_magnitude,) = _struct_b2d.unpack(str[start:end])
00154 return self
00155 except struct.error, e:
00156 raise roslib.message.DeserializationError(e)
00157
00158 _struct_I = roslib.message.struct_I
00159 _struct_b2d = struct.Struct("<b2d")