_DigitalInputEvent.py
Go to the documentation of this file.
00001 """autogenerated by genpy from kobuki_comms/DigitalInputEvent.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 DigitalInputEvent(genpy.Message):
00009   _md5sum = "93da823c8b121f8a3940ef3830c58e44"
00010   _type = "kobuki_comms/DigitalInputEvent"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# Digital input - only four pins. 
00013 
00014 # Array of values indices represent pins 0-3 respectively.
00015 bool[4] values
00016 
00017 """
00018   __slots__ = ['values']
00019   _slot_types = ['bool[4]']
00020 
00021   def __init__(self, *args, **kwds):
00022     """
00023     Constructor. Any message fields that are implicitly/explicitly
00024     set to None will be assigned a default value. The recommend
00025     use is keyword arguments as this is more robust to future message
00026     changes.  You cannot mix in-order arguments and keyword arguments.
00027 
00028     The available fields are:
00029        values
00030 
00031     :param args: complete set of field values, in .msg order
00032     :param kwds: use keyword arguments corresponding to message field names
00033     to set specific fields.
00034     """
00035     if args or kwds:
00036       super(DigitalInputEvent, self).__init__(*args, **kwds)
00037       #message fields cannot be None, assign default values for those that are
00038       if self.values is None:
00039         self.values = [False,False,False,False]
00040     else:
00041       self.values = [False,False,False,False]
00042 
00043   def _get_types(self):
00044     """
00045     internal API method
00046     """
00047     return self._slot_types
00048 
00049   def serialize(self, buff):
00050     """
00051     serialize message into buffer
00052     :param buff: buffer, ``StringIO``
00053     """
00054     try:
00055       buff.write(_struct_4B.pack(*self.values))
00056     except struct.error as se: self._check_types(se)
00057     except TypeError as te: self._check_types(te)
00058 
00059   def deserialize(self, str):
00060     """
00061     unpack serialized message in str into this message instance
00062     :param str: byte array of serialized message, ``str``
00063     """
00064     try:
00065       end = 0
00066       start = end
00067       end += 4
00068       self.values = _struct_4B.unpack(str[start:end])
00069       self.values = map(bool, self.values)
00070       return self
00071     except struct.error as e:
00072       raise genpy.DeserializationError(e) #most likely buffer underfill
00073 
00074 
00075   def serialize_numpy(self, buff, numpy):
00076     """
00077     serialize message with numpy array types into buffer
00078     :param buff: buffer, ``StringIO``
00079     :param numpy: numpy python module
00080     """
00081     try:
00082       buff.write(self.values.tostring())
00083     except struct.error as se: self._check_types(se)
00084     except TypeError as te: self._check_types(te)
00085 
00086   def deserialize_numpy(self, str, numpy):
00087     """
00088     unpack serialized message in str into this message instance using numpy for array types
00089     :param str: byte array of serialized message, ``str``
00090     :param numpy: numpy python module
00091     """
00092     try:
00093       end = 0
00094       start = end
00095       end += 4
00096       self.values = numpy.frombuffer(str[start:end], dtype=numpy.bool, count=4)
00097       self.values = map(bool, self.values)
00098       return self
00099     except struct.error as e:
00100       raise genpy.DeserializationError(e) #most likely buffer underfill
00101 
00102 _struct_I = genpy.struct_I
00103 _struct_4B = struct.Struct("<4B")
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends


kobuki_comms
Author(s): Daniel Stonier, 주영훈
autogenerated on Thu Nov 15 2012 18:05:16