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