1 // aircraft.cxx -- various aircraft routines
3 // Written by Curtis Olson, started May 1997.
5 // Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
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.
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.
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.
26 #include <simgear/constants.h>
27 #include <simgear/debug/logstream.hxx>
29 #include <Main/globals.hxx>
31 #include "aircraft.hxx"
33 // This is a record containing all the info for the aircraft currently
35 fgAIRCRAFT current_aircraft;
38 // Initialize an Aircraft structure
39 void fgAircraftInit( void ) {
40 SG_LOG( SG_AIRCRAFT, SG_INFO, "Initializing Aircraft structure" );
42 current_aircraft.fdm_state = cur_fdm_state;
43 current_aircraft.controls = globals->get_controls();
47 // Display various parameters to stdout
48 void fgAircraftOutputCurrent(fgAIRCRAFT *a) {
53 SG_LOG( SG_FLIGHT, SG_DEBUG,
55 << (f->get_Longitude() * 3600.0 * SGD_RADIANS_TO_DEGREES) << ","
56 << (f->get_Latitude() * 3600.0 * SGD_RADIANS_TO_DEGREES) << ","
58 << ") (Phi,Theta,Psi)=("
59 << f->get_Phi() << ","
60 << f->get_Theta() << ","
61 << f->get_Psi() << ")" );
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 ) );