00001 """autogenerated by genmsg_py from State.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import std_msgs.msg
00006
00007 class State(roslib.message.Message):
00008 _md5sum = "da95463f5af1db345e11ec4ce9b23d3f"
00009 _type = "mav_msgs/State"
00010 _has_header = True
00011 _full_text = """# Software License Agreement (BSD License)
00012 #
00013 # Copyright (c) 2010
00014 # Ivan Dryanovski <ivan.dryanovski@gmail.com>
00015 # All rights reserved.
00016 #
00017 # Redistribution and use in source and binary forms, with or without
00018 # modification, are permitted provided that the following conditions
00019 # are met:
00020 #
00021 # * Redistributions of source code must retain the above copyright
00022 # notice, this list of conditions and the following disclaimer.
00023 # * Redistributions in binary form must reproduce the above
00024 # copyright notice, this list of conditions and the following
00025 # disclaimer in the documentation and/or other materials provided
00026 # with the distribution.
00027 # * Neither the name of CCNY Robotics Lab nor the names of its
00028 # contributors may be used to endorse or promote products derived
00029 # from this software without specific prior written permission.
00030 #
00031 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00032 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00033 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00034 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00035 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00036 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00037 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00038 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00039 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00040 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00041 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00042 # POSSIBILITY OF SUCH DAMAGE.
00043
00044 Header header
00045
00046 uint8 state
00047
00048 ================================================================================
00049 MSG: std_msgs/Header
00050 # Standard metadata for higher-level stamped data types.
00051 # This is generally used to communicate timestamped data
00052 # in a particular coordinate frame.
00053 #
00054 # sequence ID: consecutively increasing ID
00055 uint32 seq
00056 #Two-integer timestamp that is expressed as:
00057 # * stamp.secs: seconds (stamp_secs) since epoch
00058 # * stamp.nsecs: nanoseconds since stamp_secs
00059 # time-handling sugar is provided by the client library
00060 time stamp
00061 #Frame this data is associated with
00062 # 0: no frame
00063 # 1: global frame
00064 string frame_id
00065
00066 """
00067 __slots__ = ['header','state']
00068 _slot_types = ['Header','uint8']
00069
00070 def __init__(self, *args, **kwds):
00071 """
00072 Constructor. Any message fields that are implicitly/explicitly
00073 set to None will be assigned a default value. The recommend
00074 use is keyword arguments as this is more robust to future message
00075 changes. You cannot mix in-order arguments and keyword arguments.
00076
00077 The available fields are:
00078 header,state
00079
00080 @param args: complete set of field values, in .msg order
00081 @param kwds: use keyword arguments corresponding to message field names
00082 to set specific fields.
00083 """
00084 if args or kwds:
00085 super(State, self).__init__(*args, **kwds)
00086
00087 if self.header is None:
00088 self.header = std_msgs.msg._Header.Header()
00089 if self.state is None:
00090 self.state = 0
00091 else:
00092 self.header = std_msgs.msg._Header.Header()
00093 self.state = 0
00094
00095 def _get_types(self):
00096 """
00097 internal API method
00098 """
00099 return self._slot_types
00100
00101 def serialize(self, buff):
00102 """
00103 serialize message into buffer
00104 @param buff: buffer
00105 @type buff: StringIO
00106 """
00107 try:
00108 _x = self
00109 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00110 _x = self.header.frame_id
00111 length = len(_x)
00112 buff.write(struct.pack('<I%ss'%length, length, _x))
00113 buff.write(_struct_B.pack(self.state))
00114 except struct.error, se: self._check_types(se)
00115 except TypeError, te: self._check_types(te)
00116
00117 def deserialize(self, str):
00118 """
00119 unpack serialized message in str into this message instance
00120 @param str: byte array of serialized message
00121 @type str: str
00122 """
00123 try:
00124 if self.header is None:
00125 self.header = std_msgs.msg._Header.Header()
00126 end = 0
00127 _x = self
00128 start = end
00129 end += 12
00130 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00131 start = end
00132 end += 4
00133 (length,) = _struct_I.unpack(str[start:end])
00134 start = end
00135 end += length
00136 self.header.frame_id = str[start:end]
00137 start = end
00138 end += 1
00139 (self.state,) = _struct_B.unpack(str[start:end])
00140 return self
00141 except struct.error, e:
00142 raise roslib.message.DeserializationError(e)
00143
00144
00145 def serialize_numpy(self, buff, numpy):
00146 """
00147 serialize message with numpy array types into buffer
00148 @param buff: buffer
00149 @type buff: StringIO
00150 @param numpy: numpy python module
00151 @type numpy 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 buff.write(struct.pack('<I%ss'%length, length, _x))
00159 buff.write(_struct_B.pack(self.state))
00160 except struct.error, se: self._check_types(se)
00161 except TypeError, te: self._check_types(te)
00162
00163 def deserialize_numpy(self, str, numpy):
00164 """
00165 unpack serialized message in str into this message instance using numpy for array types
00166 @param str: byte array of serialized message
00167 @type str: str
00168 @param numpy: numpy python module
00169 @type numpy: module
00170 """
00171 try:
00172 if self.header is None:
00173 self.header = std_msgs.msg._Header.Header()
00174 end = 0
00175 _x = self
00176 start = end
00177 end += 12
00178 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00179 start = end
00180 end += 4
00181 (length,) = _struct_I.unpack(str[start:end])
00182 start = end
00183 end += length
00184 self.header.frame_id = str[start:end]
00185 start = end
00186 end += 1
00187 (self.state,) = _struct_B.unpack(str[start:end])
00188 return self
00189 except struct.error, e:
00190 raise roslib.message.DeserializationError(e)
00191
00192 _struct_I = roslib.message.struct_I
00193 _struct_3I = struct.Struct("<3I")
00194 _struct_B = struct.Struct("<B")