00001 """autogenerated by genpy from hector_uav_msgs/ControllerState.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007 import std_msgs.msg
00008
00009 class ControllerState(genpy.Message):
00010 _md5sum = "a0f668496c9bbf505c01f59674f2a0c2"
00011 _type = "hector_uav_msgs/ControllerState"
00012 _has_header = True
00013 _full_text = """Header header
00014 uint8 source
00015
00016 uint8 mode
00017 uint8 MOTORS = 1
00018 uint8 ATTITUDE = 2
00019 uint8 VELOCITY = 4
00020 uint8 POSITION = 8
00021 uint8 HEADING = 16
00022 uint8 HEIGHT = 32
00023
00024 uint8 state
00025 uint8 MOTORS_RUNNING = 1
00026 uint8 AIRBORNE = 2
00027
00028 ================================================================================
00029 MSG: std_msgs/Header
00030 # Standard metadata for higher-level stamped data types.
00031 # This is generally used to communicate timestamped data
00032 # in a particular coordinate frame.
00033 #
00034 # sequence ID: consecutively increasing ID
00035 uint32 seq
00036 #Two-integer timestamp that is expressed as:
00037 # * stamp.secs: seconds (stamp_secs) since epoch
00038 # * stamp.nsecs: nanoseconds since stamp_secs
00039 # time-handling sugar is provided by the client library
00040 time stamp
00041 #Frame this data is associated with
00042 # 0: no frame
00043 # 1: global frame
00044 string frame_id
00045
00046 """
00047
00048 MOTORS = 1
00049 ATTITUDE = 2
00050 VELOCITY = 4
00051 POSITION = 8
00052 HEADING = 16
00053 HEIGHT = 32
00054 MOTORS_RUNNING = 1
00055 AIRBORNE = 2
00056
00057 __slots__ = ['header','source','mode','state']
00058 _slot_types = ['std_msgs/Header','uint8','uint8','uint8']
00059
00060 def __init__(self, *args, **kwds):
00061 """
00062 Constructor. Any message fields that are implicitly/explicitly
00063 set to None will be assigned a default value. The recommend
00064 use is keyword arguments as this is more robust to future message
00065 changes. You cannot mix in-order arguments and keyword arguments.
00066
00067 The available fields are:
00068 header,source,mode,state
00069
00070 :param args: complete set of field values, in .msg order
00071 :param kwds: use keyword arguments corresponding to message field names
00072 to set specific fields.
00073 """
00074 if args or kwds:
00075 super(ControllerState, self).__init__(*args, **kwds)
00076
00077 if self.header is None:
00078 self.header = std_msgs.msg.Header()
00079 if self.source is None:
00080 self.source = 0
00081 if self.mode is None:
00082 self.mode = 0
00083 if self.state is None:
00084 self.state = 0
00085 else:
00086 self.header = std_msgs.msg.Header()
00087 self.source = 0
00088 self.mode = 0
00089 self.state = 0
00090
00091 def _get_types(self):
00092 """
00093 internal API method
00094 """
00095 return self._slot_types
00096
00097 def serialize(self, buff):
00098 """
00099 serialize message into buffer
00100 :param buff: buffer, ``StringIO``
00101 """
00102 try:
00103 _x = self
00104 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00105 _x = self.header.frame_id
00106 length = len(_x)
00107 if python3 or type(_x) == unicode:
00108 _x = _x.encode('utf-8')
00109 length = len(_x)
00110 buff.write(struct.pack('<I%ss'%length, length, _x))
00111 _x = self
00112 buff.write(_struct_3B.pack(_x.source, _x.mode, _x.state))
00113 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00114 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00115
00116 def deserialize(self, str):
00117 """
00118 unpack serialized message in str into this message instance
00119 :param str: byte array of serialized message, ``str``
00120 """
00121 try:
00122 if self.header is None:
00123 self.header = std_msgs.msg.Header()
00124 end = 0
00125 _x = self
00126 start = end
00127 end += 12
00128 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00129 start = end
00130 end += 4
00131 (length,) = _struct_I.unpack(str[start:end])
00132 start = end
00133 end += length
00134 if python3:
00135 self.header.frame_id = str[start:end].decode('utf-8')
00136 else:
00137 self.header.frame_id = str[start:end]
00138 _x = self
00139 start = end
00140 end += 3
00141 (_x.source, _x.mode, _x.state,) = _struct_3B.unpack(str[start:end])
00142 return self
00143 except struct.error as e:
00144 raise genpy.DeserializationError(e)
00145
00146
00147 def serialize_numpy(self, buff, numpy):
00148 """
00149 serialize message with numpy array types into buffer
00150 :param buff: buffer, ``StringIO``
00151 :param numpy: numpy python module
00152 """
00153 try:
00154 _x = self
00155 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00156 _x = self.header.frame_id
00157 length = len(_x)
00158 if python3 or type(_x) == unicode:
00159 _x = _x.encode('utf-8')
00160 length = len(_x)
00161 buff.write(struct.pack('<I%ss'%length, length, _x))
00162 _x = self
00163 buff.write(_struct_3B.pack(_x.source, _x.mode, _x.state))
00164 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00165 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00166
00167 def deserialize_numpy(self, str, numpy):
00168 """
00169 unpack serialized message in str into this message instance using numpy for array types
00170 :param str: byte array of serialized message, ``str``
00171 :param numpy: numpy python module
00172 """
00173 try:
00174 if self.header is None:
00175 self.header = std_msgs.msg.Header()
00176 end = 0
00177 _x = self
00178 start = end
00179 end += 12
00180 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00181 start = end
00182 end += 4
00183 (length,) = _struct_I.unpack(str[start:end])
00184 start = end
00185 end += length
00186 if python3:
00187 self.header.frame_id = str[start:end].decode('utf-8')
00188 else:
00189 self.header.frame_id = str[start:end]
00190 _x = self
00191 start = end
00192 end += 3
00193 (_x.source, _x.mode, _x.state,) = _struct_3B.unpack(str[start:end])
00194 return self
00195 except struct.error as e:
00196 raise genpy.DeserializationError(e)
00197
00198 _struct_I = genpy.struct_I
00199 _struct_3B = struct.Struct("<3B")
00200 _struct_3I = struct.Struct("<3I")