00001 """autogenerated by genpy from clearpath_sensors/Axis.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 Axis(genpy.Message):
00009 _md5sum = "7559be9cb80074f71cea3a03f4b3abe0"
00010 _type = "clearpath_sensors/Axis"
00011 _has_header = False
00012 _full_text = """float32 pan
00013 float32 tilt
00014 float32 zoom
00015 float32 focus
00016 float32 brightness
00017 float32 iris
00018 bool autofocus
00019
00020 """
00021 __slots__ = ['pan','tilt','zoom','focus','brightness','iris','autofocus']
00022 _slot_types = ['float32','float32','float32','float32','float32','float32','bool']
00023
00024 def __init__(self, *args, **kwds):
00025 """
00026 Constructor. Any message fields that are implicitly/explicitly
00027 set to None will be assigned a default value. The recommend
00028 use is keyword arguments as this is more robust to future message
00029 changes. You cannot mix in-order arguments and keyword arguments.
00030
00031 The available fields are:
00032 pan,tilt,zoom,focus,brightness,iris,autofocus
00033
00034 :param args: complete set of field values, in .msg order
00035 :param kwds: use keyword arguments corresponding to message field names
00036 to set specific fields.
00037 """
00038 if args or kwds:
00039 super(Axis, self).__init__(*args, **kwds)
00040
00041 if self.pan is None:
00042 self.pan = 0.
00043 if self.tilt is None:
00044 self.tilt = 0.
00045 if self.zoom is None:
00046 self.zoom = 0.
00047 if self.focus is None:
00048 self.focus = 0.
00049 if self.brightness is None:
00050 self.brightness = 0.
00051 if self.iris is None:
00052 self.iris = 0.
00053 if self.autofocus is None:
00054 self.autofocus = False
00055 else:
00056 self.pan = 0.
00057 self.tilt = 0.
00058 self.zoom = 0.
00059 self.focus = 0.
00060 self.brightness = 0.
00061 self.iris = 0.
00062 self.autofocus = False
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_6fB.pack(_x.pan, _x.tilt, _x.zoom, _x.focus, _x.brightness, _x.iris, _x.autofocus))
00078 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00079 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
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 += 25
00091 (_x.pan, _x.tilt, _x.zoom, _x.focus, _x.brightness, _x.iris, _x.autofocus,) = _struct_6fB.unpack(str[start:end])
00092 self.autofocus = bool(self.autofocus)
00093 return self
00094 except struct.error as e:
00095 raise genpy.DeserializationError(e)
00096
00097
00098 def serialize_numpy(self, buff, numpy):
00099 """
00100 serialize message with numpy array types into buffer
00101 :param buff: buffer, ``StringIO``
00102 :param numpy: numpy python module
00103 """
00104 try:
00105 _x = self
00106 buff.write(_struct_6fB.pack(_x.pan, _x.tilt, _x.zoom, _x.focus, _x.brightness, _x.iris, _x.autofocus))
00107 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00108 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00109
00110 def deserialize_numpy(self, str, numpy):
00111 """
00112 unpack serialized message in str into this message instance using numpy for array types
00113 :param str: byte array of serialized message, ``str``
00114 :param numpy: numpy python module
00115 """
00116 try:
00117 end = 0
00118 _x = self
00119 start = end
00120 end += 25
00121 (_x.pan, _x.tilt, _x.zoom, _x.focus, _x.brightness, _x.iris, _x.autofocus,) = _struct_6fB.unpack(str[start:end])
00122 self.autofocus = bool(self.autofocus)
00123 return self
00124 except struct.error as e:
00125 raise genpy.DeserializationError(e)
00126
00127 _struct_I = genpy.struct_I
00128 _struct_6fB = struct.Struct("<6fB")