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