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


nao_msgs
Author(s): Armin Hornung, Stefan Osswald, Daniel Maier
autogenerated on Tue Oct 15 2013 10:05:22