_CliffEvent.py
Go to the documentation of this file.
00001 """autogenerated by genpy from kobuki_comms/CliffEvent.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 CliffEvent(genpy.Message):
00009   _md5sum = "768947926ed252fd64a5711160ff3884"
00010   _type = "kobuki_comms/CliffEvent"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# Provides a cliff sensor event
00013 # This message is generated whenever the robot approaches or moves away from a cliff
00014 
00015 uint8 LEFT   = 0
00016 uint8 CENTER = 1
00017 uint8 RIGHT  = 2
00018 
00019 uint8 FLOOR = 0
00020 uint8 CLIFF = 1
00021 
00022 uint8  state
00023 uint8  sensor
00024 uint16 bottom
00025 """
00026   # Pseudo-constants
00027   LEFT = 0
00028   CENTER = 1
00029   RIGHT = 2
00030   FLOOR = 0
00031   CLIFF = 1
00032 
00033   __slots__ = ['state','sensor','bottom']
00034   _slot_types = ['uint8','uint8','uint16']
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,sensor,bottom
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(CliffEvent, 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.sensor is None:
00056         self.sensor = 0
00057       if self.bottom is None:
00058         self.bottom = 0
00059     else:
00060       self.state = 0
00061       self.sensor = 0
00062       self.bottom = 0
00063 
00064   def _get_types(self):
00065     """
00066     internal API method
00067     """
00068     return self._slot_types
00069 
00070   def serialize(self, buff):
00071     """
00072     serialize message into buffer
00073     :param buff: buffer, ``StringIO``
00074     """
00075     try:
00076       _x = self
00077       buff.write(_struct_2BH.pack(_x.state, _x.sensor, _x.bottom))
00078     except struct.error as se: self._check_types(se)
00079     except TypeError as te: self._check_types(te)
00080 
00081   def deserialize(self, str):
00082     """
00083     unpack serialized message in str into this message instance
00084     :param str: byte array of serialized message, ``str``
00085     """
00086     try:
00087       end = 0
00088       _x = self
00089       start = end
00090       end += 4
00091       (_x.state, _x.sensor, _x.bottom,) = _struct_2BH.unpack(str[start:end])
00092       return self
00093     except struct.error as e:
00094       raise genpy.DeserializationError(e) #most likely buffer underfill
00095 
00096 
00097   def serialize_numpy(self, buff, numpy):
00098     """
00099     serialize message with numpy array types into buffer
00100     :param buff: buffer, ``StringIO``
00101     :param numpy: numpy python module
00102     """
00103     try:
00104       _x = self
00105       buff.write(_struct_2BH.pack(_x.state, _x.sensor, _x.bottom))
00106     except struct.error as se: self._check_types(se)
00107     except TypeError as te: self._check_types(te)
00108 
00109   def deserialize_numpy(self, str, numpy):
00110     """
00111     unpack serialized message in str into this message instance using numpy for array types
00112     :param str: byte array of serialized message, ``str``
00113     :param numpy: numpy python module
00114     """
00115     try:
00116       end = 0
00117       _x = self
00118       start = end
00119       end += 4
00120       (_x.state, _x.sensor, _x.bottom,) = _struct_2BH.unpack(str[start:end])
00121       return self
00122     except struct.error as e:
00123       raise genpy.DeserializationError(e) #most likely buffer underfill
00124 
00125 _struct_I = genpy.struct_I
00126 _struct_2BH = struct.Struct("<2BH")
 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