00001 """autogenerated by genmsg_py from PR2GripperEventDetectorResult.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import roslib.rostime
00006 import pr2_gripper_sensor_msgs.msg
00007
00008 class PR2GripperEventDetectorResult(roslib.message.Message):
00009 _md5sum = "817b45a51c75a067eb5dfb8e18b14aa1"
00010 _type = "pr2_gripper_sensor_msgs/PR2GripperEventDetectorResult"
00011 _has_header = False
00012 _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
00013 #results
00014 PR2GripperEventDetectorData data
00015
00016 ================================================================================
00017 MSG: pr2_gripper_sensor_msgs/PR2GripperEventDetectorData
00018 # Time the data was recorded at
00019 time stamp
00020
00021 # true if the trigger conditions have been met
00022 # (see PR2GripperEventDetectorCommand)
00023 bool trigger_conditions_met
00024
00025 # true if the pressure sensors detected a slip event
00026 # slip events occur when the finger pressure sensors
00027 # high-freq. content exceeds the slip_trigger_magnitude variable
00028 # (see PR2GripperEventDetectorCommand)
00029 bool slip_event
00030
00031 # true if the hand-mounted accelerometer detected a contact acceleration
00032 # acceleration events occur when the palm accelerometer
00033 # high-freq. content exceeds the acc_trigger_magnitude variable
00034 # (see PR2GripperEventDetectorCommand)
00035 bool acceleration_event
00036
00037 # the high-freq acceleration vector that was last seen (x,y,z)
00038 float64[3] acceleration_vector
00039 """
00040 __slots__ = ['data']
00041 _slot_types = ['pr2_gripper_sensor_msgs/PR2GripperEventDetectorData']
00042
00043 def __init__(self, *args, **kwds):
00044 """
00045 Constructor. Any message fields that are implicitly/explicitly
00046 set to None will be assigned a default value. The recommend
00047 use is keyword arguments as this is more robust to future message
00048 changes. You cannot mix in-order arguments and keyword arguments.
00049
00050 The available fields are:
00051 data
00052
00053 @param args: complete set of field values, in .msg order
00054 @param kwds: use keyword arguments corresponding to message field names
00055 to set specific fields.
00056 """
00057 if args or kwds:
00058 super(PR2GripperEventDetectorResult, self).__init__(*args, **kwds)
00059
00060 if self.data is None:
00061 self.data = pr2_gripper_sensor_msgs.msg.PR2GripperEventDetectorData()
00062 else:
00063 self.data = pr2_gripper_sensor_msgs.msg.PR2GripperEventDetectorData()
00064
00065 def _get_types(self):
00066 """
00067 internal API method
00068 """
00069 return self._slot_types
00070
00071 def serialize(self, buff):
00072 """
00073 serialize message into buffer
00074 @param buff: buffer
00075 @type buff: StringIO
00076 """
00077 try:
00078 _x = self
00079 buff.write(_struct_2I3B.pack(_x.data.stamp.secs, _x.data.stamp.nsecs, _x.data.trigger_conditions_met, _x.data.slip_event, _x.data.acceleration_event))
00080 buff.write(_struct_3d.pack(*self.data.acceleration_vector))
00081 except struct.error, se: self._check_types(se)
00082 except TypeError, te: self._check_types(te)
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
00088 @type str: str
00089 """
00090 try:
00091 if self.data is None:
00092 self.data = pr2_gripper_sensor_msgs.msg.PR2GripperEventDetectorData()
00093 end = 0
00094 _x = self
00095 start = end
00096 end += 11
00097 (_x.data.stamp.secs, _x.data.stamp.nsecs, _x.data.trigger_conditions_met, _x.data.slip_event, _x.data.acceleration_event,) = _struct_2I3B.unpack(str[start:end])
00098 self.data.trigger_conditions_met = bool(self.data.trigger_conditions_met)
00099 self.data.slip_event = bool(self.data.slip_event)
00100 self.data.acceleration_event = bool(self.data.acceleration_event)
00101 start = end
00102 end += 24
00103 self.data.acceleration_vector = _struct_3d.unpack(str[start:end])
00104 return self
00105 except struct.error, e:
00106 raise roslib.message.DeserializationError(e)
00107
00108
00109 def serialize_numpy(self, buff, numpy):
00110 """
00111 serialize message with numpy array types into buffer
00112 @param buff: buffer
00113 @type buff: StringIO
00114 @param numpy: numpy python module
00115 @type numpy module
00116 """
00117 try:
00118 _x = self
00119 buff.write(_struct_2I3B.pack(_x.data.stamp.secs, _x.data.stamp.nsecs, _x.data.trigger_conditions_met, _x.data.slip_event, _x.data.acceleration_event))
00120 buff.write(self.data.acceleration_vector.tostring())
00121 except struct.error, se: self._check_types(se)
00122 except TypeError, te: self._check_types(te)
00123
00124 def deserialize_numpy(self, str, numpy):
00125 """
00126 unpack serialized message in str into this message instance using numpy for array types
00127 @param str: byte array of serialized message
00128 @type str: str
00129 @param numpy: numpy python module
00130 @type numpy: module
00131 """
00132 try:
00133 if self.data is None:
00134 self.data = pr2_gripper_sensor_msgs.msg.PR2GripperEventDetectorData()
00135 end = 0
00136 _x = self
00137 start = end
00138 end += 11
00139 (_x.data.stamp.secs, _x.data.stamp.nsecs, _x.data.trigger_conditions_met, _x.data.slip_event, _x.data.acceleration_event,) = _struct_2I3B.unpack(str[start:end])
00140 self.data.trigger_conditions_met = bool(self.data.trigger_conditions_met)
00141 self.data.slip_event = bool(self.data.slip_event)
00142 self.data.acceleration_event = bool(self.data.acceleration_event)
00143 start = end
00144 end += 24
00145 self.data.acceleration_vector = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=3)
00146 return self
00147 except struct.error, e:
00148 raise roslib.message.DeserializationError(e)
00149
00150 _struct_I = roslib.message.struct_I
00151 _struct_2I3B = struct.Struct("<2I3B")
00152 _struct_3d = struct.Struct("<3d")