]> git.mxchange.org Git - flightgear.git/blob - Slew/slew.cxx
Moved max node per tile definition to fg_constants.h
[flightgear.git] / Slew / slew.cxx
1 // slew.cxx -- the "slew" flight model
2 //
3 // Written by Curtis Olson, started May 1997.
4 //
5 // Copyright (C) 1997  Curtis L. Olson  - curt@infoplane.com
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 //
21 // $Id$
22 // (Log is kept at end of this file)
23
24
25 #include <math.h>
26
27 #include "slew.hxx"
28
29 #include <FDM/flight.hxx>
30 #include <Aircraft/aircraft.hxx>
31 #include <Controls/controls.hxx>
32 #include <Include/fg_constants.h>
33
34
35 // reset flight params to a specific position
36 void fgSlewInit(double pos_x, double pos_y, double pos_z, double heading) {
37     FGInterface *f;
38     
39     f = current_aircraft.fdm_state;
40
41     /*
42     f->pos_x = pos_x;
43     f->pos_y = pos_y;
44     f->pos_z = pos_z;
45
46     f->vel_x = 0.0;
47     f->vel_y = 0.0;
48     f->vel_z = 0.0;
49
50     f->Phi = 0.0;
51     f->Theta = 0.0;
52     f->Psi = 0.0;
53
54     f->vel_Phi = 0.0;
55     f->vel_Theta = 0.0;
56     f->vel_Psi = 0.0;
57
58     f->Psi = heading;
59     */
60 }
61
62
63 // update position based on inputs, positions, velocities, etc.
64 void fgSlewUpdate( void ) {
65     FGInterface *f;
66     FGControls *c;
67
68     f = current_aircraft.fdm_state;
69     c = current_aircraft.controls;
70
71     /* f->Psi += ( c->aileron / 8 );
72     if ( f->Psi > FG_2PI ) {
73         f->Psi -= FG_2PI;
74     } else if ( f->Psi < 0 ) {
75         f->Psi += FG_2PI;
76     }
77
78     f->vel_x = -c->elev;
79
80     f->pos_x = f->pos_x + (cos(f->Psi) * f->vel_x);
81     f->pos_y = f->pos_y + (sin(f->Psi) * f->vel_x); */
82 }
83
84
85 // $Log$
86 // Revision 1.6  1999/02/05 21:29:05  curt
87 // Modifications to incorporate Jon S. Berndts flight model code.
88 //
89 // Revision 1.5  1999/02/01 21:33:33  curt
90 // Renamed FlightGear/Simulator/Flight to FlightGear/Simulator/FDM since
91 // Jon accepted my offer to do this and thought it was a good idea.
92 //
93 // Revision 1.4  1998/12/05 16:13:14  curt
94 // Renamed class fgCONTROLS to class FGControls.
95 //
96 // Revision 1.3  1998/12/05 15:54:16  curt
97 // Renamed class fgFLIGHT to class FGState as per request by JSB.
98 //
99 // Revision 1.2  1998/10/17 01:34:17  curt
100 // C++ ifying ...
101 //
102 // Revision 1.1  1998/10/16 23:27:50  curt
103 // C++-ifying.
104 //
105 // Revision 1.13  1998/04/25 22:06:29  curt
106 // Edited cvs log messages in source files ... bad bad bad!
107 //
108 // Revision 1.12  1998/04/08 23:35:30  curt
109 // Tweaks to Gnu automake/autoconf system.
110 //
111 // Revision 1.11  1998/02/07 15:29:39  curt
112 // Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
113 // <chotchkiss@namg.us.anritsu.com>
114 //
115 // Revision 1.10  1998/01/27 00:47:53  curt
116 // Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
117 // system and commandline/config file processing code.
118 //
119 // Revision 1.9  1998/01/19 19:27:06  curt
120 // Merged in make system changes from Bob Kuehne <rpk@sgi.com>
121 // This should simplify things tremendously.
122 //
123 // Revision 1.8  1998/01/19 18:40:30  curt
124 // Tons of little changes to clean up the code and to remove fatal errors
125 // when building with the c++ compiler.
126 //
127 // Revision 1.7  1997/12/15 23:54:42  curt
128 // Add xgl wrappers for debugging.
129 // Generate terrain normals on the fly.
130 //
131 // Revision 1.6  1997/08/27 03:30:11  curt
132 // Changed naming scheme of basic shared structures.
133 //
134 // Revision 1.5  1997/07/19 22:35:06  curt
135 // Moved fiddled with PI to avoid compiler warnings.
136 //
137 // Revision 1.4  1997/06/21 17:12:51  curt
138 // Capitalized subdirectory names.
139 //
140 // Revision 1.3  1997/05/29 22:40:00  curt
141 // Working on incorporating the LaRCsim flight model.
142 //
143 // Revision 1.2  1997/05/29 12:30:19  curt
144 // Some initial mods to work better in a timer environment.
145 //
146 // Revision 1.1  1997/05/29 02:29:42  curt
147 // Moved to their own directory.
148 //
149 // Revision 1.2  1997/05/23 15:40:37  curt
150 // Added GNU copyright headers.
151 //
152 // Revision 1.1  1997/05/16 16:04:45  curt
153 // Initial revision.
154 //
155