]> git.mxchange.org Git - flightgear.git/blob - src/Aircraft/aircraft.cxx
886cc149d93170d141159758c9d443a565794c11
[flightgear.git] / src / Aircraft / aircraft.cxx
1 // aircraft.cxx -- various aircraft routines
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
23
24 #include <stdio.h>
25
26 #include <simgear/constants.h>
27 #include <simgear/debug/logstream.hxx>
28
29 #include <Main/globals.hxx>
30
31 #include "aircraft.hxx"
32
33 // This is a record containing all the info for the aircraft currently
34 // being operated
35 fgAIRCRAFT current_aircraft;
36
37
38 // Initialize an Aircraft structure
39 void fgAircraftInit( void ) {
40     SG_LOG( SG_AIRCRAFT, SG_INFO, "Initializing Aircraft structure" );
41
42     current_aircraft.fdm_state   = cur_fdm_state;
43     current_aircraft.controls = globals->get_controls();
44 }
45
46
47 // Display various parameters to stdout
48 void fgAircraftOutputCurrent(fgAIRCRAFT *a) {
49     FGInterface *f;
50
51     f = a->fdm_state;
52
53     SG_LOG( SG_FLIGHT, SG_DEBUG,
54             "Pos = ("
55             << (f->get_Longitude() * 3600.0 * SGD_RADIANS_TO_DEGREES) << "," 
56             << (f->get_Latitude()  * 3600.0 * SGD_RADIANS_TO_DEGREES) << ","
57             << f->get_Altitude() 
58             << ")  (Phi,Theta,Psi)=("
59             << f->get_Phi() << "," 
60             << f->get_Theta() << "," 
61             << f->get_Psi() << ")" );
62
63     SG_LOG( SG_FLIGHT, SG_DEBUG,
64             "Kts = " << f->get_V_equiv_kts() 
65             << "  Elev = " << globals->get_controls()->get_elevator() 
66             << "  Aileron = " << globals->get_controls()->get_aileron() 
67             << "  Rudder = " << globals->get_controls()->get_rudder() 
68             << "  Power = " << globals->get_controls()->get_throttle( 0 ) );
69 }
70
71