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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
69
USA or view http://www.gnu.org/copyleft/gpl.html.
71
**********************************************************************/
73
#include <simgear/compiler.h>
75
#include "uiuc_controlInput.h"
79
void uiuc_controlInput()
81
// elevator step input
84
if (Simtime >= elevator_step_startTime)
86
elevator = elevator + elevator_step_angle;
90
// elevator singlet input
93
if (Simtime >= elevator_singlet_startTime &&
94
Simtime <= (elevator_singlet_startTime + elevator_singlet_duration))
96
elevator = elevator + elevator_singlet_angle;
100
// elevator doublet input
101
if (elevator_doublet)
103
if (Simtime >= elevator_doublet_startTime &&
104
Simtime <= (elevator_doublet_startTime + elevator_doublet_duration/2))
106
elevator = elevator + elevator_doublet_angle;
108
else if (Simtime >= (elevator_doublet_startTime + elevator_doublet_duration/2) &&
109
Simtime <= (elevator_doublet_startTime + elevator_doublet_duration))
111
elevator = elevator - elevator_doublet_angle;
118
double elevator_input_endTime = elevator_input_timeArray[elevator_input_ntime];
119
if (Simtime >= elevator_input_startTime &&
120
Simtime <= (elevator_input_startTime + elevator_input_endTime))
122
double time = Simtime - elevator_input_startTime;
123
if (pilot_elev_no_check)
125
elevator = 0 + elevator_tab;
126
pilot_elev_no = true;
128
elevator = elevator +
129
uiuc_1Dinterpolation(elevator_input_timeArray,
130
elevator_input_deArray,
131
elevator_input_ntime,
139
double aileron_input_endTime = aileron_input_timeArray[aileron_input_ntime];
140
if (Simtime >= aileron_input_startTime &&
141
Simtime <= (aileron_input_startTime + aileron_input_endTime))
143
double time = Simtime - aileron_input_startTime;
144
if (pilot_ail_no_check)
147
if (Simtime==0) //7-25-01 (RD) Added because
148
pilot_ail_no = false; //segmentation fault is given
153
uiuc_1Dinterpolation(aileron_input_timeArray,
154
aileron_input_daArray,
163
double rudder_input_endTime = rudder_input_timeArray[rudder_input_ntime];
164
if (Simtime >= rudder_input_startTime &&
165
Simtime <= (rudder_input_startTime + rudder_input_endTime))
167
double time = Simtime - rudder_input_startTime;
168
if (pilot_rud_no_check)
174
uiuc_1Dinterpolation(rudder_input_timeArray,
175
rudder_input_drArray,
183
// end uiuc_controlInput.cpp