Go to the documentation of this file.00001 """autogenerated by genpy from corobot_pantilt/PanTilt.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 PanTilt(genpy.Message):
00009 _md5sum = "0b5a18079de4fe44248582bbf0247b62"
00010 _type = "corobot_pantilt/PanTilt"
00011 _has_header = False
00012 _full_text = """#Deprecated. Prefer to use the one in corobot_msgs package, which is exactly the same
00013
00014 int32 pan
00015 int32 tilt
00016 bool reset
00017
00018 """
00019 __slots__ = ['pan','tilt','reset']
00020 _slot_types = ['int32','int32','bool']
00021
00022 def __init__(self, *args, **kwds):
00023 """
00024 Constructor. Any message fields that are implicitly/explicitly
00025 set to None will be assigned a default value. The recommend
00026 use is keyword arguments as this is more robust to future message
00027 changes. You cannot mix in-order arguments and keyword arguments.
00028
00029 The available fields are:
00030 pan,tilt,reset
00031
00032 :param args: complete set of field values, in .msg order
00033 :param kwds: use keyword arguments corresponding to message field names
00034 to set specific fields.
00035 """
00036 if args or kwds:
00037 super(PanTilt, self).__init__(*args, **kwds)
00038
00039 if self.pan is None:
00040 self.pan = 0
00041 if self.tilt is None:
00042 self.tilt = 0
00043 if self.reset is None:
00044 self.reset = False
00045 else:
00046 self.pan = 0
00047 self.tilt = 0
00048 self.reset = False
00049
00050 def _get_types(self):
00051 """
00052 internal API method
00053 """
00054 return self._slot_types
00055
00056 def serialize(self, buff):
00057 """
00058 serialize message into buffer
00059 :param buff: buffer, ``StringIO``
00060 """
00061 try:
00062 _x = self
00063 buff.write(_struct_2iB.pack(_x.pan, _x.tilt, _x.reset))
00064 except struct.error as se: self._check_types(se)
00065 except TypeError as te: self._check_types(te)
00066
00067 def deserialize(self, str):
00068 """
00069 unpack serialized message in str into this message instance
00070 :param str: byte array of serialized message, ``str``
00071 """
00072 try:
00073 end = 0
00074 _x = self
00075 start = end
00076 end += 9
00077 (_x.pan, _x.tilt, _x.reset,) = _struct_2iB.unpack(str[start:end])
00078 self.reset = bool(self.reset)
00079 return self
00080 except struct.error as e:
00081 raise genpy.DeserializationError(e)
00082
00083
00084 def serialize_numpy(self, buff, numpy):
00085 """
00086 serialize message with numpy array types into buffer
00087 :param buff: buffer, ``StringIO``
00088 :param numpy: numpy python module
00089 """
00090 try:
00091 _x = self
00092 buff.write(_struct_2iB.pack(_x.pan, _x.tilt, _x.reset))
00093 except struct.error as se: self._check_types(se)
00094 except TypeError as te: self._check_types(te)
00095
00096 def deserialize_numpy(self, str, numpy):
00097 """
00098 unpack serialized message in str into this message instance using numpy for array types
00099 :param str: byte array of serialized message, ``str``
00100 :param numpy: numpy python module
00101 """
00102 try:
00103 end = 0
00104 _x = self
00105 start = end
00106 end += 9
00107 (_x.pan, _x.tilt, _x.reset,) = _struct_2iB.unpack(str[start:end])
00108 self.reset = bool(self.reset)
00109 return self
00110 except struct.error as e:
00111 raise genpy.DeserializationError(e)
00112
00113 _struct_I = genpy.struct_I
00114 _struct_2iB = struct.Struct("<2iB")