_ButtonEvent.py
Go to the documentation of this file.
00001 """autogenerated by genpy from kobuki_comms/ButtonEvent.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 ButtonEvent(genpy.Message):
00009   _md5sum = "627fdd6fd6471539e5190c0e4fadb9c2"
00010   _type = "kobuki_comms/ButtonEvent"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# Provides a button event
00013 # This message is generated whenever a button is pressed or released
00014 
00015 uint8 Button0 = 0
00016 uint8 Button1 = 1
00017 uint8 Button2 = 2
00018 
00019 uint8 RELEASED = 0
00020 uint8 PRESSED  = 1
00021 
00022 uint8 state
00023 uint8 button
00024 
00025 """
00026   # Pseudo-constants
00027   Button0 = 0
00028   Button1 = 1
00029   Button2 = 2
00030   RELEASED = 0
00031   PRESSED = 1
00032 
00033   __slots__ = ['state','button']
00034   _slot_types = ['uint8','uint8']
00035 
00036   def __init__(self, *args, **kwds):
00037     """
00038     Constructor. Any message fields that are implicitly/explicitly
00039     set to None will be assigned a default value. The recommend
00040     use is keyword arguments as this is more robust to future message
00041     changes.  You cannot mix in-order arguments and keyword arguments.
00042 
00043     The available fields are:
00044        state,button
00045 
00046     :param args: complete set of field values, in .msg order
00047     :param kwds: use keyword arguments corresponding to message field names
00048     to set specific fields.
00049     """
00050     if args or kwds:
00051       super(ButtonEvent, self).__init__(*args, **kwds)
00052       #message fields cannot be None, assign default values for those that are
00053       if self.state is None:
00054         self.state = 0
00055       if self.button is None:
00056         self.button = 0
00057     else:
00058       self.state = 0
00059       self.button = 0
00060 
00061   def _get_types(self):
00062     """
00063     internal API method
00064     """
00065     return self._slot_types
00066 
00067   def serialize(self, buff):
00068     """
00069     serialize message into buffer
00070     :param buff: buffer, ``StringIO``
00071     """
00072     try:
00073       _x = self
00074       buff.write(_struct_2B.pack(_x.state, _x.button))
00075     except struct.error as se: self._check_types(se)
00076     except TypeError as te: self._check_types(te)
00077 
00078   def deserialize(self, str):
00079     """
00080     unpack serialized message in str into this message instance
00081     :param str: byte array of serialized message, ``str``
00082     """
00083     try:
00084       end = 0
00085       _x = self
00086       start = end
00087       end += 2
00088       (_x.state, _x.button,) = _struct_2B.unpack(str[start:end])
00089       return self
00090     except struct.error as e:
00091       raise genpy.DeserializationError(e) #most likely buffer underfill
00092 
00093 
00094   def serialize_numpy(self, buff, numpy):
00095     """
00096     serialize message with numpy array types into buffer
00097     :param buff: buffer, ``StringIO``
00098     :param numpy: numpy python module
00099     """
00100     try:
00101       _x = self
00102       buff.write(_struct_2B.pack(_x.state, _x.button))
00103     except struct.error as se: self._check_types(se)
00104     except TypeError as te: self._check_types(te)
00105 
00106   def deserialize_numpy(self, str, numpy):
00107     """
00108     unpack serialized message in str into this message instance using numpy for array types
00109     :param str: byte array of serialized message, ``str``
00110     :param numpy: numpy python module
00111     """
00112     try:
00113       end = 0
00114       _x = self
00115       start = end
00116       end += 2
00117       (_x.state, _x.button,) = _struct_2B.unpack(str[start:end])
00118       return self
00119     except struct.error as e:
00120       raise genpy.DeserializationError(e) #most likely buffer underfill
00121 
00122 _struct_I = genpy.struct_I
00123 _struct_2B = struct.Struct("<2B")
 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