bool global_fullscreen = true;
#endif
-#include <Include/compiler.h>
+#include <simgear/compiler.h>
#include <math.h> // rint()
#include <stdio.h>
#include STL_STRING
-#include <Include/fg_constants.h>
+#include <simgear/constants.h>
+#include <simgear/debug/logstream.hxx>
+#include <simgear/misc/fgstream.hxx>
+
#include <Include/general.hxx>
#include <Cockpit/cockpit.hxx>
-#include <Debug/logstream.hxx>
#include <FDM/flight.hxx>
-#include <Misc/fgstream.hxx>
+#include <FDM/UIUCModel/uiuc_aircraftdir.h>
#ifdef FG_NETWORK_OLK
-# include <Network/network.h>
+# include <NetworkOLK/network.h>
#endif
#include <Time/fg_time.hxx>
+#include "views.hxx"
#include "options.hxx"
-#include "fg_serial.hxx"
FG_USING_STD(string);
FG_USING_NAMESPACE(std);
#endif
}
+
// Defined the shared options class here
fgOPTIONS current_options;
mouse_pointer(0),
pause(0),
control_mode(FG_JOYSTICK),
+ auto_coordination(FG_AUTO_COORD_NOT_SPECIFIED),
// Features
hud_status(1),
// Flight Model options
flight_model( FGInterface::FG_LARCSIM ),
+ aircraft( "c172" ),
model_hz( NEW_DEFAULT_MODEL_HZ ),
speed_up( 1 ),
// Rendering options
fog(FG_FOG_NICEST), // nicest
+ clouds(true),
+ clouds_asl(5000*FEET_TO_METER),
fov(55.0),
fullscreen(0),
shading(1),
wireframe(0),
xsize(640),
ysize(480),
+ view_mode(FG_VIEW_PILOT),
// Scenery options
tile_diameter(5),
tris_or_culled(0),
// Time options
- time_offset(0)
+ time_offset(0),
+
+ network_olk(false)
{
+ aircraft_dir=""; // Initialize the Aircraft directory to "" (UIUC)
+
// set initial values/defaults
time_offset_type=FG_TIME_SYS_OFFSET;
char* envp = ::getenv( "FG_ROOT" );
net_id = "Johnney"; // default pilot's name
// initialize port config string list
- port_options_list.erase ( port_options_list.begin(),
- port_options_list.end() );
+ channel_options_list.clear();
}
void
// Parse --fdm=abcdefg type option
int
fgOPTIONS::parse_fdm( const string& fm ) {
- // printf("fdm = %s\n", fm);
+ // cout << "fdm = " << fm << endl;
- if ( fm == "slew" ) {
- return FGInterface::FG_SLEW;
+ if ( fm == "balloon" ) {
+ return FGInterface::FG_BALLOONSIM;
+ } else if ( fm == "external" ) {
+ return FGInterface::FG_EXTERNAL;
} else if ( fm == "jsb" ) {
return FGInterface::FG_JSBSIM;
} else if ( (fm == "larcsim") || (fm == "LaRCsim") ) {
return FGInterface::FG_LARCSIM;
- } else if ( fm == "external" ) {
- return FGInterface::FG_EXTERNAL;
+ } else if ( fm == "magic" ) {
+ return FGInterface::FG_MAGICCARPET;
} else {
FG_LOG( FG_GENERAL, FG_ALERT, "Unknown fdm = " << fm );
exit(-1);
}
-// Parse serial port option --serial=/dev/ttyS1,nmea,4800,out
+// Parse I/O channel option
+//
+// Format is "--protocol=medium,direction,hz,medium_options,..."
//
-// Format is "--serial=device,format,baud,direction" where
+// protocol = { native, nmea, garmin, fgfs, rul, pve, etc. }
+// medium = { serial, socket, file, etc. }
+// direction = { in, out, bi }
+// hz = number of times to process channel per second (floating
+// point values are ok.
+//
+// Serial example "--nmea=serial,dir,hz,device,baud" where
//
-// device = OS device name to be open()'ed
-// format = {nmea, garmin,fgfs,rul}
+// device = OS device name of serial line to be open()'ed
// baud = {300, 1200, 2400, ..., 230400}
-// direction = {in, out, bi}
+//
+// Socket exacmple "--native=socket,dir,hz,machine,port" where
+//
+// machine = machine name or ip address if client (leave empty if server)
+// port = port, leave empty to let system choose
+//
+// File example "--garmin=file,dir,hz,filename" where
+//
+// filename = file system file name
bool
-fgOPTIONS::parse_serial( const string& serial_str ) {
- string::size_type pos;
-
- // cout << "Serial string = " << serial_str << endl;
-
- // a flailing attempt to see if the port config string has a
- // chance at being valid
- pos = serial_str.find(",");
- if ( pos == string::npos ) {
- FG_LOG( FG_GENERAL, FG_ALERT,
- "Malformed serial port configure string" );
- return false;
- }
-
- port_options_list.push_back( serial_str );
+fgOPTIONS::parse_channel( const string& type, const string& channel_str ) {
+ // cout << "Channel string = " << channel_str << endl;
+
+ channel_options_list.push_back( type + "," + channel_str );
return true;
}
pause = true;
} else if ( arg.find( "--control=") != string::npos ) {
parse_control( arg.substr(10) );
+ } else if ( arg == "--disable-auto-coordination" ) {
+ auto_coordination = FG_AUTO_COORD_DISABLED;
+ } else if ( arg == "--enable-auto-coordination" ) {
+ auto_coordination = FG_AUTO_COORD_ENABLED;
} else if ( arg == "--disable-hud" ) {
hud_status = false;
} else if ( arg == "--enable-hud" ) {
}
} else if ( arg.find( "--uBody=" ) != string::npos ) {
if ( units == FG_UNITS_FEET ) {
- uBody = atof( arg.substr(8) ) * FEET_TO_METER;
- } else {
uBody = atof( arg.substr(8) );
+ } else {
+ uBody = atof( arg.substr(8) ) * FEET_TO_METER;
}
} else if ( arg.find( "--vBody=" ) != string::npos ) {
if ( units == FG_UNITS_FEET ) {
- vBody = atof( arg.substr(8) ) * FEET_TO_METER;
- } else {
vBody = atof( arg.substr(8) );
+ } else {
+ vBody = atof( arg.substr(8) ) * FEET_TO_METER;
}
} else if ( arg.find( "--wBody=" ) != string::npos ) {
if ( units == FG_UNITS_FEET ) {
- wBody = atof( arg.substr(8) ) * FEET_TO_METER;
- } else {
wBody = atof( arg.substr(8) );
+ } else {
+ wBody = atof( arg.substr(8) ) * FEET_TO_METER;
}
} else if ( arg.find( "--heading=" ) != string::npos ) {
heading = atof( arg.substr(10) );
fg_root = arg.substr( 10 );
} else if ( arg.find( "--fdm=" ) != string::npos ) {
flight_model = parse_fdm( arg.substr(6) );
+ } else if ( arg.find( "--aircraft=" ) != string::npos ) {
+ aircraft = arg.substr(11);
+ } else if ( arg.find( "--aircraft-dir=" ) != string::npos ) {
+ aircraft_dir = arg.substr(15); // (UIUC)
} else if ( arg.find( "--model-hz=" ) != string::npos ) {
model_hz = atoi( arg.substr(11) );
} else if ( arg.find( "--speed=" ) != string::npos ) {
fog = FG_FOG_FASTEST;
} else if ( arg == "--fog-nicest" ) {
fog = FG_FOG_NICEST;
+ } else if ( arg == "--disable-clouds" ) {
+ clouds = false;
+ } else if ( arg == "--enable-clouds" ) {
+ clouds = true;
+ } else if ( arg.find( "--clouds-asl=" ) != string::npos ) {
+ if ( units == FG_UNITS_FEET ) {
+ clouds_asl = atof( arg.substr(13) ) * FEET_TO_METER;
+ } else {
+ clouds_asl = atof( arg.substr(13) );
+ }
} else if ( arg.find( "--fov=" ) != string::npos ) {
fov = parse_fov( arg.substr(6) );
} else if ( arg == "--disable-fullscreen" ) {
} else if ( arg.find( "--tile-radius=" ) != string::npos ) {
tile_radius = parse_tile_radius( arg.substr(14) );
tile_diameter = tile_radius * 2 + 1;
- } else if ( arg.find( "--time-offset-sys=" ) != string::npos ) {
- time_offset = parse_time_offset( (arg.substr(18)) );
+ } else if ( arg.find( "--time-offset" ) != string::npos ) {
+ time_offset = parse_time_offset( (arg.substr(14)) );
+ //time_offset_type = FG_TIME_SYS_OFFSET;
+ } else if ( arg.find( "--time-match-real") != string::npos ) {
+ //time_offset = parse_time_offset(arg.substr(18));
time_offset_type = FG_TIME_SYS_OFFSET;
- } else if ( arg.find( "--time-offset-lat=") != string::npos ) {
- time_offset = parse_time_offset(arg.substr(18));
+ } else if ( arg.find( "--time-match-local") != string::npos ) {
+ //time_offset = parse_time_offset(arg.substr(18));
time_offset_type = FG_TIME_LAT_OFFSET;
- } else if ( arg.find( "--time-offset-gmt=") != string::npos ) {
- time_offset = parse_time_offset(arg.substr(18));
- time_offset_type = FG_TIME_GMT_OFFSET;
} else if ( arg.find( "--start-date-sys=") != string::npos ) {
time_offset = parse_date( (arg.substr(17)) );
time_offset_type = FG_TIME_SYS_ABSOLUTE;
tris_or_culled = 0;
} else if ( arg == "--hud-culled" ) {
tris_or_culled = 1;
- } else if ( arg.find( "--serial=" ) != string::npos ) {
- parse_serial( arg.substr(9) );
+ } else if ( arg.find( "--native=" ) != string::npos ) {
+ parse_channel( "native", arg.substr(9) );
+ } else if ( arg.find( "--garmin=" ) != string::npos ) {
+ parse_channel( "garmin", arg.substr(9) );
+ } else if ( arg.find( "--nmea=" ) != string::npos ) {
+ parse_channel( "nmea", arg.substr(7) );
+ } else if ( arg.find( "--pve=" ) != string::npos ) {
+ parse_channel( "pve", arg.substr(6) );
+ } else if ( arg.find( "--rul=" ) != string::npos ) {
+ parse_channel( "rul", arg.substr(6) );
#ifdef FG_NETWORK_OLK
+ } else if ( arg == "--disable-network-olk" ) {
+ network_olk = false;
+ } else if ( arg== "--enable-network-olk") {
+ network_olk = true;
} else if ( arg == "--net-hud" ) {
net_hud_display = 1;
} else if ( arg.find( "--net-id=") != string::npos ) {
string line;
#ifdef GETLINE_NEEDS_TERMINATOR
- getline( in, line, '\n' );
+ getline( in, line, '\n' );
+#elif defined (MACOS)
+ getline( in, line, '\r' );
#else
- getline( in, line );
+ getline( in, line );
#endif
if ( parse_option( line ) == FG_OPTIONS_ERROR ) {
cout << endl;
cout << "Flight Model:" << endl;
- cout << "\t--fdm=abcd: one of slew, jsb, larcsim, or external" << endl;
+ cout << "\t--fdm=abcd: selects the core flight model code." << endl;
+ cout << "\t\tcan be one of jsb, larcsim, magic, or external" << endl;
+ cout << "\t--aircraft=abcd: aircraft model to load" << endl;
cout << "\t--model-hz=n: run the FDM this rate (iterations per second)"
<< endl;
cout << "\t--speed=n: run the FDM this much faster than real time" << endl;
cout << endl;
+ //(UIUC)
+ cout <<"Aircraft model directory" << endl;
+ cout <<"\t--aircraft-dir=<path> path is relative to the path of the executable" << endl;
+ cout << endl;
cout << "Initial Position and Orientation:" << endl;
cout << "\t--airport-id=ABCD: specify starting postion by airport id"
cout << "\t--fog-disable: disable fog/haze" << endl;
cout << "\t--fog-fastest: enable fastest fog/haze" << endl;
cout << "\t--fog-nicest: enable nicest fog/haze" << endl;
+ cout << "\t--enable-clouds: enable demo cloud layer" << endl;
+ cout << "\t--disable-clouds: disable demo cloud layer" << endl;
+ cout << "\t--clouds-asl=xxx: specify altitude of cloud layer above sea level" << endl;
cout << "\t--fov=xx.x: specify initial field of view angle in degrees"
<< endl;
cout << "\t--disable-fullscreen: disable fullscreen mode" << endl;
cout << endl;
cout << "Time Options:" << endl;
- cout << "\t--time-offset-sys=[+-]hh:mm:ss: add this time offset to" << endl
- << "\t\tyour system time" << endl;
- cout << "\t--time-offset-gmt:[+-]hh:mm:ss: add this time offset to" << endl
- << "\t\tGreenwich Mean Time (GMT)" << endl;
- cout << "\t--time-offset-lat:[+-]hh:mm:ss: add this time offset to" << endl
- << "\t\tLocal Aircraft Time (LAT)" << endl;
+ cout << "\t--time-offset=[+-]hh:mm:ss: add this time offset" << endl;
+ cout << "\t--time-match-real: Synchronize real-world and FlightGear" << endl
+ << "\t\ttime. Can be used in combination with --time-offset." << endl;
+ cout << "\t--time-match-local:Synchronize local real-world and " << endl
+ << "\t\tFlightGear time" << endl;
cout << "\t--start-date-sys=yyyy:mm:dd:hh:mm:ss: specify a starting" << endl
<< "\t\tdate/time. Uses your system time " << endl;
cout << "\t--start-date-gmt=yyyy:mm:dd:hh:mm:ss: specify a starting" << endl