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


pr2_gripper_sensor_msgs
Author(s): Joe Romano
autogenerated on Fri Jan 3 2014 11:52:58