00001 """autogenerated by genpy from asctec_msgs/CtrlInput.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 CtrlInput(genpy.Message):
00010 _md5sum = "6a2f3591afa7529005dcc3a5acd6e490"
00011 _type = "asctec_msgs/CtrlInput"
00012 _has_header = True
00013 _full_text = """# Software License Agreement (BSD License)
00014 #
00015 # Copyright (c) 2010
00016 # William Morris <morris@ee.ccny.cuny.edu>
00017 # Ivan Dryanovski <ivan.dryanovski@gmail.com>
00018 # All rights reserved.
00019 #
00020 # Redistribution and use in source and binary forms, with or without
00021 # modification, are permitted provided that the following conditions
00022 # are met:
00023 #
00024 # * Redistributions of source code must retain the above copyright
00025 # notice, this list of conditions and the following disclaimer.
00026 # * Redistributions in binary form must reproduce the above
00027 # copyright notice, this list of conditions and the following
00028 # disclaimer in the documentation and/or other materials provided
00029 # with the distribution.
00030 # * Neither the name of CCNY Robotics Lab nor the names of its
00031 # contributors may be used to endorse or promote products derived
00032 # from this software without specific prior written permission.
00033 #
00034 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00035 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00036 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00037 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00038 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00039 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00040 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00041 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00042 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00043 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00044 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00045 # POSSIBILITY OF SUCH DAMAGE.
00046
00047 Header header
00048 # serial command (=Scientific Interface)
00049 # Pitch input: -2047 .. 2047 (0 = neutral)
00050 int16 pitch
00051 # Roll input: -2047 .. 2047 (0 = neutral)
00052 int16 roll
00053 # R/C Stick input: -2047 .. 2047 (0 = neutral)
00054 int16 yaw
00055 # Collective: 0 .. 4095 (= 0 .. 100%)
00056 int16 thrust
00057 # control byte:
00058 # bit 0: pitch control enabled
00059 # bit 1: roll control enabled
00060 # bit 2: yaw control enabled
00061 # bit 3: thrust control enabled
00062 # These bits can be used to only enable one axis at a time and thus to control
00063 # the other axes manually. This usually helps a lot to set up and finetune
00064 # controllers for each axis seperately.
00065 int16 ctrl
00066 int16 chksum
00067
00068 ================================================================================
00069 MSG: std_msgs/Header
00070 # Standard metadata for higher-level stamped data types.
00071 # This is generally used to communicate timestamped data
00072 # in a particular coordinate frame.
00073 #
00074 # sequence ID: consecutively increasing ID
00075 uint32 seq
00076 #Two-integer timestamp that is expressed as:
00077 # * stamp.secs: seconds (stamp_secs) since epoch
00078 # * stamp.nsecs: nanoseconds since stamp_secs
00079 # time-handling sugar is provided by the client library
00080 time stamp
00081 #Frame this data is associated with
00082 # 0: no frame
00083 # 1: global frame
00084 string frame_id
00085
00086 """
00087 __slots__ = ['header','pitch','roll','yaw','thrust','ctrl','chksum']
00088 _slot_types = ['std_msgs/Header','int16','int16','int16','int16','int16','int16']
00089
00090 def __init__(self, *args, **kwds):
00091 """
00092 Constructor. Any message fields that are implicitly/explicitly
00093 set to None will be assigned a default value. The recommend
00094 use is keyword arguments as this is more robust to future message
00095 changes. You cannot mix in-order arguments and keyword arguments.
00096
00097 The available fields are:
00098 header,pitch,roll,yaw,thrust,ctrl,chksum
00099
00100 :param args: complete set of field values, in .msg order
00101 :param kwds: use keyword arguments corresponding to message field names
00102 to set specific fields.
00103 """
00104 if args or kwds:
00105 super(CtrlInput, self).__init__(*args, **kwds)
00106
00107 if self.header is None:
00108 self.header = std_msgs.msg.Header()
00109 if self.pitch is None:
00110 self.pitch = 0
00111 if self.roll is None:
00112 self.roll = 0
00113 if self.yaw is None:
00114 self.yaw = 0
00115 if self.thrust is None:
00116 self.thrust = 0
00117 if self.ctrl is None:
00118 self.ctrl = 0
00119 if self.chksum is None:
00120 self.chksum = 0
00121 else:
00122 self.header = std_msgs.msg.Header()
00123 self.pitch = 0
00124 self.roll = 0
00125 self.yaw = 0
00126 self.thrust = 0
00127 self.ctrl = 0
00128 self.chksum = 0
00129
00130 def _get_types(self):
00131 """
00132 internal API method
00133 """
00134 return self._slot_types
00135
00136 def serialize(self, buff):
00137 """
00138 serialize message into buffer
00139 :param buff: buffer, ``StringIO``
00140 """
00141 try:
00142 _x = self
00143 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00144 _x = self.header.frame_id
00145 length = len(_x)
00146 if python3 or type(_x) == unicode:
00147 _x = _x.encode('utf-8')
00148 length = len(_x)
00149 buff.write(struct.pack('<I%ss'%length, length, _x))
00150 _x = self
00151 buff.write(_struct_6h.pack(_x.pitch, _x.roll, _x.yaw, _x.thrust, _x.ctrl, _x.chksum))
00152 except struct.error as se: self._check_types(se)
00153 except TypeError as te: self._check_types(te)
00154
00155 def deserialize(self, str):
00156 """
00157 unpack serialized message in str into this message instance
00158 :param str: byte array of serialized message, ``str``
00159 """
00160 try:
00161 if self.header is None:
00162 self.header = std_msgs.msg.Header()
00163 end = 0
00164 _x = self
00165 start = end
00166 end += 12
00167 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00168 start = end
00169 end += 4
00170 (length,) = _struct_I.unpack(str[start:end])
00171 start = end
00172 end += length
00173 if python3:
00174 self.header.frame_id = str[start:end].decode('utf-8')
00175 else:
00176 self.header.frame_id = str[start:end]
00177 _x = self
00178 start = end
00179 end += 12
00180 (_x.pitch, _x.roll, _x.yaw, _x.thrust, _x.ctrl, _x.chksum,) = _struct_6h.unpack(str[start:end])
00181 return self
00182 except struct.error as e:
00183 raise genpy.DeserializationError(e)
00184
00185
00186 def serialize_numpy(self, buff, numpy):
00187 """
00188 serialize message with numpy array types into buffer
00189 :param buff: buffer, ``StringIO``
00190 :param numpy: numpy python module
00191 """
00192 try:
00193 _x = self
00194 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00195 _x = self.header.frame_id
00196 length = len(_x)
00197 if python3 or type(_x) == unicode:
00198 _x = _x.encode('utf-8')
00199 length = len(_x)
00200 buff.write(struct.pack('<I%ss'%length, length, _x))
00201 _x = self
00202 buff.write(_struct_6h.pack(_x.pitch, _x.roll, _x.yaw, _x.thrust, _x.ctrl, _x.chksum))
00203 except struct.error as se: self._check_types(se)
00204 except TypeError as te: self._check_types(te)
00205
00206 def deserialize_numpy(self, str, numpy):
00207 """
00208 unpack serialized message in str into this message instance using numpy for array types
00209 :param str: byte array of serialized message, ``str``
00210 :param numpy: numpy python module
00211 """
00212 try:
00213 if self.header is None:
00214 self.header = std_msgs.msg.Header()
00215 end = 0
00216 _x = self
00217 start = end
00218 end += 12
00219 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00220 start = end
00221 end += 4
00222 (length,) = _struct_I.unpack(str[start:end])
00223 start = end
00224 end += length
00225 if python3:
00226 self.header.frame_id = str[start:end].decode('utf-8')
00227 else:
00228 self.header.frame_id = str[start:end]
00229 _x = self
00230 start = end
00231 end += 12
00232 (_x.pitch, _x.roll, _x.yaw, _x.thrust, _x.ctrl, _x.chksum,) = _struct_6h.unpack(str[start:end])
00233 return self
00234 except struct.error as e:
00235 raise genpy.DeserializationError(e)
00236
00237 _struct_I = genpy.struct_I
00238 _struct_6h = struct.Struct("<6h")
00239 _struct_3I = struct.Struct("<3I")