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