1 /**********************************************************************
3 FILENAME: uiuc_controlInput.cpp
5 ----------------------------------------------------------------------
7 DESCRIPTION: sets control surface deflections for specified input
10 ----------------------------------------------------------------------
14 ----------------------------------------------------------------------
18 ----------------------------------------------------------------------
20 HISTORY: 04/08/2000 initial release
21 06/18/2001 (RD) Added aileron_input and rudder_input
22 07/05/2001 (RD) Code added to allow the pilot to fly
23 aircraft after the control surface input
26 ----------------------------------------------------------------------
28 AUTHOR(S): Jeff Scott <jscott@mail.com>
29 Robert Deters <rdeters@uiuc.edu>
31 ----------------------------------------------------------------------
35 ----------------------------------------------------------------------
41 ----------------------------------------------------------------------
43 OUTPUTS: -elevator deflection
45 ----------------------------------------------------------------------
47 CALLED BY: uiuc_coefficients.cpp
49 ----------------------------------------------------------------------
53 ----------------------------------------------------------------------
55 COPYRIGHT: (C) 2000 by Michael Selig
57 This program is free software; you can redistribute it and/or
58 modify it under the terms of the GNU General Public License
59 as published by the Free Software Foundation.
61 This program is distributed in the hope that it will be useful,
62 but WITHOUT ANY WARRANTY; without even the implied warranty of
63 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
64 GNU General Public License for more details.
66 You should have received a copy of the GNU General Public License
67 along with this program; if not, write to the Free Software
68 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
70 **********************************************************************/
72 #include <simgear/compiler.h>
74 #include "uiuc_controlInput.h"
78 void uiuc_controlInput()
80 // elevator step input
83 if (Simtime >= elevator_step_startTime)
85 elevator = elevator + elevator_step_angle;
89 // elevator singlet input
92 if (Simtime >= elevator_singlet_startTime &&
93 Simtime <= (elevator_singlet_startTime + elevator_singlet_duration))
95 elevator = elevator + elevator_singlet_angle;
99 // elevator doublet input
100 if (elevator_doublet)
102 if (Simtime >= elevator_doublet_startTime &&
103 Simtime <= (elevator_doublet_startTime + elevator_doublet_duration/2))
105 elevator = elevator + elevator_doublet_angle;
107 else if (Simtime >= (elevator_doublet_startTime + elevator_doublet_duration/2) &&
108 Simtime <= (elevator_doublet_startTime + elevator_doublet_duration))
110 elevator = elevator - elevator_doublet_angle;
117 double elevator_input_endTime = elevator_input_timeArray[elevator_input_ntime];
118 if (Simtime >= elevator_input_startTime &&
119 Simtime <= (elevator_input_startTime + elevator_input_endTime))
121 double time = Simtime - elevator_input_startTime;
122 if (pilot_elev_no_check)
124 elevator = 0 + elevator_tab;
125 pilot_elev_no = true;
127 elevator = elevator +
128 uiuc_1Dinterpolation(elevator_input_timeArray,
129 elevator_input_deArray,
130 elevator_input_ntime,
138 double aileron_input_endTime = aileron_input_timeArray[aileron_input_ntime];
139 if (Simtime >= aileron_input_startTime &&
140 Simtime <= (aileron_input_startTime + aileron_input_endTime))
142 double time = Simtime - aileron_input_startTime;
143 if (pilot_ail_no_check)
146 if (Simtime==0) //7-25-01 (RD) Added because
147 pilot_ail_no = false; //segmentation fault is given
152 uiuc_1Dinterpolation(aileron_input_timeArray,
153 aileron_input_daArray,
162 double rudder_input_endTime = rudder_input_timeArray[rudder_input_ntime];
163 if (Simtime >= rudder_input_startTime &&
164 Simtime <= (rudder_input_startTime + rudder_input_endTime))
166 double time = Simtime - rudder_input_startTime;
167 if (pilot_rud_no_check)
173 uiuc_1Dinterpolation(rudder_input_timeArray,
174 rudder_input_drArray,
182 double flap_pos_input_endTime = flap_pos_input_timeArray[flap_pos_input_ntime];
183 if (Simtime >= flap_pos_input_startTime &&
184 Simtime <= (flap_pos_input_startTime + flap_pos_input_endTime))
186 double time = Simtime - flap_pos_input_startTime;
187 flap_pos = uiuc_1Dinterpolation(flap_pos_input_timeArray,
188 flap_pos_input_dfArray,
189 flap_pos_input_ntime,
197 // end uiuc_controlInput.cpp