_FingerState.py
Go to the documentation of this file.
00001 """autogenerated by genpy from pr2_collision_monitor/FingerState.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 FingerState(genpy.Message):
00009   _md5sum = "d60cf19982434fd444941f1ee656aa92"
00010   _type = "pr2_collision_monitor/FingerState"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """bool any_collision
00013 bool[] r_finger_tip
00014 bool[] l_finger_tip
00015 
00016 """
00017   __slots__ = ['any_collision','r_finger_tip','l_finger_tip']
00018   _slot_types = ['bool','bool[]','bool[]']
00019 
00020   def __init__(self, *args, **kwds):
00021     """
00022     Constructor. Any message fields that are implicitly/explicitly
00023     set to None will be assigned a default value. The recommend
00024     use is keyword arguments as this is more robust to future message
00025     changes.  You cannot mix in-order arguments and keyword arguments.
00026 
00027     The available fields are:
00028        any_collision,r_finger_tip,l_finger_tip
00029 
00030     :param args: complete set of field values, in .msg order
00031     :param kwds: use keyword arguments corresponding to message field names
00032     to set specific fields.
00033     """
00034     if args or kwds:
00035       super(FingerState, self).__init__(*args, **kwds)
00036       #message fields cannot be None, assign default values for those that are
00037       if self.any_collision is None:
00038         self.any_collision = False
00039       if self.r_finger_tip is None:
00040         self.r_finger_tip = []
00041       if self.l_finger_tip is None:
00042         self.l_finger_tip = []
00043     else:
00044       self.any_collision = False
00045       self.r_finger_tip = []
00046       self.l_finger_tip = []
00047 
00048   def _get_types(self):
00049     """
00050     internal API method
00051     """
00052     return self._slot_types
00053 
00054   def serialize(self, buff):
00055     """
00056     serialize message into buffer
00057     :param buff: buffer, ``StringIO``
00058     """
00059     try:
00060       buff.write(_struct_B.pack(self.any_collision))
00061       length = len(self.r_finger_tip)
00062       buff.write(_struct_I.pack(length))
00063       pattern = '<%sB'%length
00064       buff.write(struct.pack(pattern, *self.r_finger_tip))
00065       length = len(self.l_finger_tip)
00066       buff.write(_struct_I.pack(length))
00067       pattern = '<%sB'%length
00068       buff.write(struct.pack(pattern, *self.l_finger_tip))
00069     except struct.error as se: self._check_types(se)
00070     except TypeError as te: self._check_types(te)
00071 
00072   def deserialize(self, str):
00073     """
00074     unpack serialized message in str into this message instance
00075     :param str: byte array of serialized message, ``str``
00076     """
00077     try:
00078       end = 0
00079       start = end
00080       end += 1
00081       (self.any_collision,) = _struct_B.unpack(str[start:end])
00082       self.any_collision = bool(self.any_collision)
00083       start = end
00084       end += 4
00085       (length,) = _struct_I.unpack(str[start:end])
00086       pattern = '<%sB'%length
00087       start = end
00088       end += struct.calcsize(pattern)
00089       self.r_finger_tip = struct.unpack(pattern, str[start:end])
00090       self.r_finger_tip = map(bool, self.r_finger_tip)
00091       start = end
00092       end += 4
00093       (length,) = _struct_I.unpack(str[start:end])
00094       pattern = '<%sB'%length
00095       start = end
00096       end += struct.calcsize(pattern)
00097       self.l_finger_tip = struct.unpack(pattern, str[start:end])
00098       self.l_finger_tip = map(bool, self.l_finger_tip)
00099       return self
00100     except struct.error as e:
00101       raise genpy.DeserializationError(e) #most likely buffer underfill
00102 
00103 
00104   def serialize_numpy(self, buff, numpy):
00105     """
00106     serialize message with numpy array types into buffer
00107     :param buff: buffer, ``StringIO``
00108     :param numpy: numpy python module
00109     """
00110     try:
00111       buff.write(_struct_B.pack(self.any_collision))
00112       length = len(self.r_finger_tip)
00113       buff.write(_struct_I.pack(length))
00114       pattern = '<%sB'%length
00115       buff.write(self.r_finger_tip.tostring())
00116       length = len(self.l_finger_tip)
00117       buff.write(_struct_I.pack(length))
00118       pattern = '<%sB'%length
00119       buff.write(self.l_finger_tip.tostring())
00120     except struct.error as se: self._check_types(se)
00121     except TypeError as te: self._check_types(te)
00122 
00123   def deserialize_numpy(self, str, numpy):
00124     """
00125     unpack serialized message in str into this message instance using numpy for array types
00126     :param str: byte array of serialized message, ``str``
00127     :param numpy: numpy python module
00128     """
00129     try:
00130       end = 0
00131       start = end
00132       end += 1
00133       (self.any_collision,) = _struct_B.unpack(str[start:end])
00134       self.any_collision = bool(self.any_collision)
00135       start = end
00136       end += 4
00137       (length,) = _struct_I.unpack(str[start:end])
00138       pattern = '<%sB'%length
00139       start = end
00140       end += struct.calcsize(pattern)
00141       self.r_finger_tip = numpy.frombuffer(str[start:end], dtype=numpy.bool, count=length)
00142       self.r_finger_tip = map(bool, self.r_finger_tip)
00143       start = end
00144       end += 4
00145       (length,) = _struct_I.unpack(str[start:end])
00146       pattern = '<%sB'%length
00147       start = end
00148       end += struct.calcsize(pattern)
00149       self.l_finger_tip = numpy.frombuffer(str[start:end], dtype=numpy.bool, count=length)
00150       self.l_finger_tip = map(bool, self.l_finger_tip)
00151       return self
00152     except struct.error as e:
00153       raise genpy.DeserializationError(e) #most likely buffer underfill
00154 
00155 _struct_I = genpy.struct_I
00156 _struct_B = struct.Struct("<B")


pr2_collision_monitor
Author(s): Kelsey Hawkins, Advisor: Prof. Charlie Kemp (Healthcare Robotics Lab at Georgia Tech)
autogenerated on Wed Nov 27 2013 11:40:10