00001 """autogenerated by genmsg_py from PTZState.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005
00006 class PTZState(roslib.message.Message):
00007 _md5sum = "1f71ce2a42b32376ea869eb051358045"
00008 _type = "p2os_driver/PTZState"
00009 _has_header = False
00010 _full_text = """int32 pan
00011 int32 tilt
00012 int32 zoom
00013 bool relative
00014
00015 """
00016 __slots__ = ['pan','tilt','zoom','relative']
00017 _slot_types = ['int32','int32','int32','bool']
00018
00019 def __init__(self, *args, **kwds):
00020 """
00021 Constructor. Any message fields that are implicitly/explicitly
00022 set to None will be assigned a default value. The recommend
00023 use is keyword arguments as this is more robust to future message
00024 changes. You cannot mix in-order arguments and keyword arguments.
00025
00026 The available fields are:
00027 pan,tilt,zoom,relative
00028
00029 @param args: complete set of field values, in .msg order
00030 @param kwds: use keyword arguments corresponding to message field names
00031 to set specific fields.
00032 """
00033 if args or kwds:
00034 super(PTZState, self).__init__(*args, **kwds)
00035
00036 if self.pan is None:
00037 self.pan = 0
00038 if self.tilt is None:
00039 self.tilt = 0
00040 if self.zoom is None:
00041 self.zoom = 0
00042 if self.relative is None:
00043 self.relative = False
00044 else:
00045 self.pan = 0
00046 self.tilt = 0
00047 self.zoom = 0
00048 self.relative = 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
00060 @type buff: StringIO
00061 """
00062 try:
00063 _x = self
00064 buff.write(_struct_3iB.pack(_x.pan, _x.tilt, _x.zoom, _x.relative))
00065 except struct.error, se: self._check_types(se)
00066 except TypeError, te: self._check_types(te)
00067
00068 def deserialize(self, str):
00069 """
00070 unpack serialized message in str into this message instance
00071 @param str: byte array of serialized message
00072 @type str: str
00073 """
00074 try:
00075 end = 0
00076 _x = self
00077 start = end
00078 end += 13
00079 (_x.pan, _x.tilt, _x.zoom, _x.relative,) = _struct_3iB.unpack(str[start:end])
00080 self.relative = bool(self.relative)
00081 return self
00082 except struct.error, e:
00083 raise roslib.message.DeserializationError(e)
00084
00085
00086 def serialize_numpy(self, buff, numpy):
00087 """
00088 serialize message with numpy array types into buffer
00089 @param buff: buffer
00090 @type buff: StringIO
00091 @param numpy: numpy python module
00092 @type numpy module
00093 """
00094 try:
00095 _x = self
00096 buff.write(_struct_3iB.pack(_x.pan, _x.tilt, _x.zoom, _x.relative))
00097 except struct.error, se: self._check_types(se)
00098 except TypeError, te: self._check_types(te)
00099
00100 def deserialize_numpy(self, str, numpy):
00101 """
00102 unpack serialized message in str into this message instance using numpy for array types
00103 @param str: byte array of serialized message
00104 @type str: str
00105 @param numpy: numpy python module
00106 @type numpy: module
00107 """
00108 try:
00109 end = 0
00110 _x = self
00111 start = end
00112 end += 13
00113 (_x.pan, _x.tilt, _x.zoom, _x.relative,) = _struct_3iB.unpack(str[start:end])
00114 self.relative = bool(self.relative)
00115 return self
00116 except struct.error, e:
00117 raise roslib.message.DeserializationError(e)
00118
00119 _struct_I = roslib.message.struct_I
00120 _struct_3iB = struct.Struct("<3iB")