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