Tweaks to the LaRCsim interface to get wind working.
Corresponding tweaks to bfi.[ch]xx and options.cxx.
This commit is contained in:
parent
690d2ac3e8
commit
7a235abecd
5 changed files with 186 additions and 111 deletions
|
@ -2193,6 +2193,36 @@ SOURCE=.\src\Main\fg_io.cxx
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\src\Main\fg_props.cxx
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "FlightGear - Win32 Release"
|
||||||
|
|
||||||
|
# PROP Intermediate_Dir "Release\main"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP Intermediate_Dir "Debug\main"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\src\Main\fgfs.cxx
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "FlightGear - Win32 Release"
|
||||||
|
|
||||||
|
# PROP Intermediate_Dir "Release\main"
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP Intermediate_Dir "Debug\main"
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\src\Main\globals.cxx
|
SOURCE=.\src\Main\globals.cxx
|
||||||
|
|
||||||
!IF "$(CFG)" == "FlightGear - Win32 Release"
|
!IF "$(CFG)" == "FlightGear - Win32 Release"
|
||||||
|
@ -2238,21 +2268,6 @@ SOURCE=.\src\Main\options.cxx
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\src\Main\save.cxx
|
|
||||||
|
|
||||||
!IF "$(CFG)" == "FlightGear - Win32 Release"
|
|
||||||
|
|
||||||
# PROP Intermediate_Dir "Release\main"
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug"
|
|
||||||
|
|
||||||
# PROP Intermediate_Dir "Debug\main"
|
|
||||||
|
|
||||||
!ENDIF
|
|
||||||
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\src\Main\splash.cxx
|
SOURCE=.\src\Main\splash.cxx
|
||||||
|
|
||||||
!IF "$(CFG)" == "FlightGear - Win32 Release"
|
!IF "$(CFG)" == "FlightGear - Win32 Release"
|
||||||
|
|
|
@ -426,8 +426,8 @@ bool FGLaRCsim::copy_from_LaRCsim() {
|
||||||
_set_Velocities_Local( V_north, V_east, V_down );
|
_set_Velocities_Local( V_north, V_east, V_down );
|
||||||
// set_Velocities_Ground( V_north_rel_ground, V_east_rel_ground,
|
// set_Velocities_Ground( V_north_rel_ground, V_east_rel_ground,
|
||||||
// V_down_rel_ground );
|
// V_down_rel_ground );
|
||||||
// set_Velocities_Local_Airmass( V_north_airmass, V_east_airmass,
|
_set_Velocities_Local_Airmass( V_north_airmass, V_east_airmass,
|
||||||
// V_down_airmass );
|
V_down_airmass );
|
||||||
// set_Velocities_Local_Rel_Airmass( V_north_rel_airmass,
|
// set_Velocities_Local_Rel_Airmass( V_north_rel_airmass,
|
||||||
// V_east_rel_airmass, V_down_rel_airmass );
|
// V_east_rel_airmass, V_down_rel_airmass );
|
||||||
// set_Velocities_Gust( U_gust, V_gust, W_gust );
|
// set_Velocities_Gust( U_gust, V_gust, W_gust );
|
||||||
|
|
|
@ -315,9 +315,9 @@ FGBFI::init ()
|
||||||
|
|
||||||
// Weather
|
// Weather
|
||||||
fgTie("/environment/visibility", getVisibility, setVisibility);
|
fgTie("/environment/visibility", getVisibility, setVisibility);
|
||||||
fgTie("/environment/wind-north", getWindNorth);
|
fgTie("/environment/wind-north", getWindNorth, setWindNorth);
|
||||||
fgTie("/environment/wind-east", getWindEast);
|
fgTie("/environment/wind-east", getWindEast, setWindEast);
|
||||||
fgTie("/environment/wind-down", getWindDown);
|
fgTie("/environment/wind-down", getWindDown, setWindDown);
|
||||||
|
|
||||||
// View
|
// View
|
||||||
fgTie("/sim/view/axes/long", (double(*)())0, setViewAxisLong);
|
fgTie("/sim/view/axes/long", (double(*)())0, setViewAxisLong);
|
||||||
|
@ -1721,7 +1721,7 @@ FGBFI::setGPSTargetLongitude (double longitude)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current visible (units??).
|
* Get the current visibility (meters).
|
||||||
*/
|
*/
|
||||||
double
|
double
|
||||||
FGBFI::getVisibility ()
|
FGBFI::getVisibility ()
|
||||||
|
@ -1735,7 +1735,7 @@ FGBFI::getVisibility ()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the current visibility (units??).
|
* Set the current visibility (meters).
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
FGBFI::setVisibility (double visibility)
|
FGBFI::setVisibility (double visibility)
|
||||||
|
@ -1749,7 +1749,7 @@ FGBFI::setVisibility (double visibility)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current wind north velocity.
|
* Get the current wind north velocity (feet/second).
|
||||||
*/
|
*/
|
||||||
double
|
double
|
||||||
FGBFI::getWindNorth ()
|
FGBFI::getWindNorth ()
|
||||||
|
@ -1759,7 +1759,19 @@ FGBFI::getWindNorth ()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current wind east velocity.
|
* Set the current wind north velocity (feet/second).
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
FGBFI::setWindNorth (double speed)
|
||||||
|
{
|
||||||
|
current_aircraft.fdm_state->set_Velocities_Local_Airmass(speed,
|
||||||
|
getWindEast(),
|
||||||
|
getWindDown());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current wind east velocity (feet/second).
|
||||||
*/
|
*/
|
||||||
double
|
double
|
||||||
FGBFI::getWindEast ()
|
FGBFI::getWindEast ()
|
||||||
|
@ -1769,7 +1781,20 @@ FGBFI::getWindEast ()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current wind down velocity.
|
* Set the current wind east velocity (feet/second).
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
FGBFI::setWindEast (double speed)
|
||||||
|
{
|
||||||
|
cout << "Set wind-east to " << speed << endl;
|
||||||
|
current_aircraft.fdm_state->set_Velocities_Local_Airmass(getWindNorth(),
|
||||||
|
speed,
|
||||||
|
getWindDown());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current wind down velocity (feet/second).
|
||||||
*/
|
*/
|
||||||
double
|
double
|
||||||
FGBFI::getWindDown ()
|
FGBFI::getWindDown ()
|
||||||
|
@ -1778,6 +1803,18 @@ FGBFI::getWindDown ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current wind down velocity (feet/second).
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
FGBFI::setWindDown (double speed)
|
||||||
|
{
|
||||||
|
current_aircraft.fdm_state->set_Velocities_Local_Airmass(getWindNorth(),
|
||||||
|
getWindEast(),
|
||||||
|
speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// View.
|
// View.
|
||||||
|
|
169
src/Main/bfi.hxx
169
src/Main/bfi.hxx
|
@ -64,8 +64,8 @@ public:
|
||||||
|
|
||||||
// static time_t getTimeGMT ();
|
// static time_t getTimeGMT ();
|
||||||
// static void setTimeGMT (time_t time);
|
// static void setTimeGMT (time_t time);
|
||||||
static string getDateString ();
|
static string getDateString ();// ISO 8601 subset
|
||||||
static void setDateString (string time_string);
|
static void setDateString (string time_string); // ISO 8601 subset
|
||||||
|
|
||||||
// deprecated
|
// deprecated
|
||||||
static string getGMTString ();
|
static string getGMTString ();
|
||||||
|
@ -76,59 +76,59 @@ public:
|
||||||
static bool getPanelVisible ();
|
static bool getPanelVisible ();
|
||||||
static void setPanelVisible (bool panelVisible);
|
static void setPanelVisible (bool panelVisible);
|
||||||
|
|
||||||
static int getPanelXOffset ();
|
static int getPanelXOffset (); // pixels
|
||||||
static void setPanelXOffset (int i);
|
static void setPanelXOffset (int i); // pixels
|
||||||
|
|
||||||
static int getPanelYOffset ();
|
static int getPanelYOffset (); // pixels
|
||||||
static void setPanelYOffset (int i);
|
static void setPanelYOffset (int i); // pixels
|
||||||
|
|
||||||
|
|
||||||
// Position
|
// Position
|
||||||
static double getLatitude ();
|
static double getLatitude (); // degrees
|
||||||
static void setLatitude (double latitude);
|
static void setLatitude (double latitude); // degrees
|
||||||
|
|
||||||
static double getLongitude ();
|
static double getLongitude (); // degrees
|
||||||
static void setLongitude (double longitude);
|
static void setLongitude (double longitude); // degrees
|
||||||
|
|
||||||
static double getAltitude ();
|
static double getAltitude (); // feet
|
||||||
static void setAltitude (double altitude);
|
static void setAltitude (double altitude); // feet
|
||||||
|
|
||||||
static double getAGL ();
|
static double getAGL (); // feet
|
||||||
|
|
||||||
|
|
||||||
// Attitude
|
// Attitude
|
||||||
static double getHeading (); // true heading
|
static double getHeading (); // degrees
|
||||||
static void setHeading (double heading);
|
static void setHeading (double heading); // degrees
|
||||||
|
|
||||||
static double getHeadingMag (); // exact magnetic heading
|
static double getHeadingMag (); // degrees
|
||||||
|
|
||||||
static double getPitch ();
|
static double getPitch (); // degrees
|
||||||
static void setPitch (double pitch);
|
static void setPitch (double pitch); // degrees
|
||||||
|
|
||||||
static double getRoll ();
|
static double getRoll (); // degrees
|
||||||
static void setRoll (double roll);
|
static void setRoll (double roll); // degrees
|
||||||
|
|
||||||
// Engine
|
// Engine
|
||||||
static double getRPM ();
|
static double getRPM (); // revolutions/minute
|
||||||
static void setRPM ( double rpm );
|
static void setRPM ( double rpm ); // revolutions/minute
|
||||||
|
|
||||||
static double getEGT ();
|
static double getEGT (); // [unit??]
|
||||||
static double getCHT ();
|
static double getCHT (); // [unit??]
|
||||||
static double getMP ();
|
static double getMP (); // [unit??]
|
||||||
|
|
||||||
// Velocities
|
// Velocities
|
||||||
static double getAirspeed ();
|
static double getAirspeed (); // knots
|
||||||
static void setAirspeed (double speed);
|
static void setAirspeed (double speed); // knots
|
||||||
|
|
||||||
static double getSideSlip ();
|
static double getSideSlip (); // [unit??]
|
||||||
|
|
||||||
static double getVerticalSpeed ();
|
static double getVerticalSpeed (); // feet/second
|
||||||
|
|
||||||
static double getSpeedNorth ();
|
static double getSpeedNorth (); // feet/second
|
||||||
|
|
||||||
static double getSpeedEast ();
|
static double getSpeedEast (); // feet/second
|
||||||
|
|
||||||
static double getSpeedDown ();
|
static double getSpeedDown (); // feet/second
|
||||||
|
|
||||||
// static void setSpeedNorth (double speed);
|
// static void setSpeedNorth (double speed);
|
||||||
// static void setSpeedEast (double speed);
|
// static void setSpeedEast (double speed);
|
||||||
|
@ -136,58 +136,58 @@ public:
|
||||||
|
|
||||||
|
|
||||||
// Controls
|
// Controls
|
||||||
static double getThrottle ();
|
static double getThrottle (); // 0.0:1.0
|
||||||
static void setThrottle (double throttle);
|
static void setThrottle (double throttle); // 0.0:1.0
|
||||||
|
|
||||||
static double getMixture ();
|
static double getMixture (); // 0.0:1.0
|
||||||
static void setMixture (double mixture);
|
static void setMixture (double mixture); // 0.0:1.0
|
||||||
|
|
||||||
static double getPropAdvance ();
|
static double getPropAdvance (); // 0.0:1.0
|
||||||
static void setPropAdvance (double pitch);
|
static void setPropAdvance (double pitch); // 0.0:1.0
|
||||||
|
|
||||||
static double getFlaps ();
|
static double getFlaps (); // 0.0:1.0
|
||||||
static void setFlaps (double flaps);
|
static void setFlaps (double flaps); // 0.0:1.0
|
||||||
|
|
||||||
static double getAileron ();
|
static double getAileron (); // -1.0:1.0
|
||||||
static void setAileron (double aileron);
|
static void setAileron (double aileron); // -1.0:1.0
|
||||||
|
|
||||||
static double getRudder ();
|
static double getRudder (); // -1.0:1.0
|
||||||
static void setRudder (double rudder);
|
static void setRudder (double rudder); // -1.0:1.0
|
||||||
|
|
||||||
static double getElevator ();
|
static double getElevator (); // -1.0:1.0
|
||||||
static void setElevator (double elevator);
|
static void setElevator (double elevator); // -1.0:1.0
|
||||||
|
|
||||||
static double getElevatorTrim ();
|
static double getElevatorTrim (); // -1.0:1.0
|
||||||
static void setElevatorTrim (double trim);
|
static void setElevatorTrim (double trim); // -1.0:1.0
|
||||||
|
|
||||||
static double getBrakes ();
|
static double getBrakes (); // 0.0:1.0
|
||||||
static void setBrakes (double brake);
|
static void setBrakes (double brake); // 0.0:1.0
|
||||||
|
|
||||||
static double getLeftBrake ();
|
static double getLeftBrake (); // 0.0:1.0
|
||||||
static void setLeftBrake (double brake);
|
static void setLeftBrake (double brake); // 0.0:1.0
|
||||||
|
|
||||||
static double getRightBrake ();
|
static double getRightBrake (); // 0.0:1.0
|
||||||
static void setRightBrake (double brake);
|
static void setRightBrake (double brake); // 0.0:1.0
|
||||||
|
|
||||||
static double getCenterBrake ();
|
static double getCenterBrake (); // 0.0:1.0
|
||||||
static void setCenterBrake (double brake);
|
static void setCenterBrake (double brake); // 0.0:1.0
|
||||||
|
|
||||||
|
|
||||||
// Autopilot
|
// Autopilot
|
||||||
static bool getAPAltitudeLock ();
|
static bool getAPAltitudeLock ();
|
||||||
static void setAPAltitudeLock (bool lock);
|
static void setAPAltitudeLock (bool lock);
|
||||||
|
|
||||||
static double getAPAltitude ();
|
static double getAPAltitude (); // feet
|
||||||
static void setAPAltitude (double altitude);
|
static void setAPAltitude (double altitude); // feet
|
||||||
|
|
||||||
static bool getAPHeadingLock ();
|
static bool getAPHeadingLock ();
|
||||||
static void setAPHeadingLock (bool lock);
|
static void setAPHeadingLock (bool lock);
|
||||||
|
|
||||||
static double getAPHeading ();
|
static double getAPHeading (); // degrees
|
||||||
static void setAPHeading (double heading);
|
static void setAPHeading (double heading); // degrees
|
||||||
|
|
||||||
static double getAPHeadingMag ();
|
static double getAPHeadingMag (); // degrees
|
||||||
static void setAPHeadingMag (double heading);
|
static void setAPHeadingMag (double heading); // degrees
|
||||||
|
|
||||||
static bool getAPNAV1Lock ();
|
static bool getAPNAV1Lock ();
|
||||||
static void setAPNAV1Lock (bool lock);
|
static void setAPNAV1Lock (bool lock);
|
||||||
|
@ -199,12 +199,12 @@ public:
|
||||||
static double getNAV1AltFreq ();
|
static double getNAV1AltFreq ();
|
||||||
static void setNAV1AltFreq (double freq);
|
static void setNAV1AltFreq (double freq);
|
||||||
|
|
||||||
static double getNAV1Radial ();
|
static double getNAV1Radial (); // degrees
|
||||||
|
|
||||||
static double getNAV1SelRadial ();
|
static double getNAV1SelRadial (); // degrees
|
||||||
static void setNAV1SelRadial (double radial);
|
static void setNAV1SelRadial (double radial); // degrees
|
||||||
|
|
||||||
static double getNAV1DistDME ();
|
static double getNAV1DistDME (); // nautical miles
|
||||||
|
|
||||||
static bool getNAV1TO ();
|
static bool getNAV1TO ();
|
||||||
|
|
||||||
|
@ -220,12 +220,12 @@ public:
|
||||||
static double getNAV2AltFreq ();
|
static double getNAV2AltFreq ();
|
||||||
static void setNAV2AltFreq (double freq);
|
static void setNAV2AltFreq (double freq);
|
||||||
|
|
||||||
static double getNAV2Radial ();
|
static double getNAV2Radial (); // degrees
|
||||||
|
|
||||||
static double getNAV2SelRadial ();
|
static double getNAV2SelRadial (); // degrees
|
||||||
static void setNAV2SelRadial (double radial);
|
static void setNAV2SelRadial (double radial); // degrees
|
||||||
|
|
||||||
static double getNAV2DistDME ();
|
static double getNAV2DistDME (); // nautical miles
|
||||||
|
|
||||||
static bool getNAV2TO ();
|
static bool getNAV2TO ();
|
||||||
|
|
||||||
|
@ -241,8 +241,8 @@ public:
|
||||||
static double getADFAltFreq ();
|
static double getADFAltFreq ();
|
||||||
static void setADFAltFreq (double freq);
|
static void setADFAltFreq (double freq);
|
||||||
|
|
||||||
static double getADFRotation ();
|
static double getADFRotation (); // degrees
|
||||||
static void setADFRotation (double rot);
|
static void setADFRotation (double rot); // degrees
|
||||||
|
|
||||||
// GPS
|
// GPS
|
||||||
static string getTargetAirport ();
|
static string getTargetAirport ();
|
||||||
|
@ -251,26 +251,29 @@ public:
|
||||||
static bool getGPSLock ();
|
static bool getGPSLock ();
|
||||||
static void setGPSLock (bool lock);
|
static void setGPSLock (bool lock);
|
||||||
|
|
||||||
static double getGPSTargetLatitude ();
|
static double getGPSTargetLatitude (); // degrees
|
||||||
|
|
||||||
static double getGPSTargetLongitude ();
|
static double getGPSTargetLongitude (); // degrees
|
||||||
|
|
||||||
|
|
||||||
// Weather
|
// Weather
|
||||||
static double getVisibility ();
|
static double getVisibility ();// meters
|
||||||
static void setVisibility (double visiblity);
|
static void setVisibility (double visiblity); // meters
|
||||||
static double getWindNorth ();
|
static double getWindNorth (); // feet/second
|
||||||
static double getWindEast ();
|
static void setWindNorth (double speed); // feet/second
|
||||||
static double getWindDown ();
|
static double getWindEast (); // feet/second
|
||||||
|
static void setWindEast (double speed); // feet/second
|
||||||
|
static double getWindDown (); // feet/second
|
||||||
|
static void setWindDown (double speed); // feet/second
|
||||||
|
|
||||||
// View
|
// View
|
||||||
static void setViewAxisLong (double axis);
|
static void setViewAxisLong (double axis);// -1.0:1.0
|
||||||
static void setViewAxisLat (double axis);
|
static void setViewAxisLat (double axis); // -1.0:1.0
|
||||||
|
|
||||||
|
|
||||||
// Time (this varies with time) huh, huh
|
// Time (this varies with time) huh, huh
|
||||||
static double getMagVar ();
|
static double getMagVar (); // degrees
|
||||||
static double getMagDip ();
|
static double getMagDip (); // degrees
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -734,7 +734,6 @@ int FGOptions::parse_option( const string& arg ) {
|
||||||
} else {
|
} else {
|
||||||
vNorth = atof( arg.substr(9) ) * FEET_TO_METER;
|
vNorth = atof( arg.substr(9) ) * FEET_TO_METER;
|
||||||
}
|
}
|
||||||
globals->get_props()->setDoubleValue("/velocities/speed-north", vNorth);
|
|
||||||
} else if ( arg.find( "--vEast=" ) != string::npos ) {
|
} else if ( arg.find( "--vEast=" ) != string::npos ) {
|
||||||
speedset = FG_VTNED;
|
speedset = FG_VTNED;
|
||||||
if ( units == FG_UNITS_FEET ) {
|
if ( units == FG_UNITS_FEET ) {
|
||||||
|
@ -742,7 +741,6 @@ int FGOptions::parse_option( const string& arg ) {
|
||||||
} else {
|
} else {
|
||||||
vEast = atof( arg.substr(8) ) * FEET_TO_METER;
|
vEast = atof( arg.substr(8) ) * FEET_TO_METER;
|
||||||
}
|
}
|
||||||
globals->get_props()->setDoubleValue("/velocities/speed-east", vEast);
|
|
||||||
} else if ( arg.find( "--vDown=" ) != string::npos ) {
|
} else if ( arg.find( "--vDown=" ) != string::npos ) {
|
||||||
speedset = FG_VTNED;
|
speedset = FG_VTNED;
|
||||||
if ( units == FG_UNITS_FEET ) {
|
if ( units == FG_UNITS_FEET ) {
|
||||||
|
@ -750,11 +748,11 @@ int FGOptions::parse_option( const string& arg ) {
|
||||||
} else {
|
} else {
|
||||||
vDown = atof( arg.substr(8) ) * FEET_TO_METER;
|
vDown = atof( arg.substr(8) ) * FEET_TO_METER;
|
||||||
}
|
}
|
||||||
globals->get_props()->setDoubleValue("/velocities/speed-down", vDown);
|
|
||||||
} else if ( arg.find( "--vc=" ) != string::npos) {
|
} else if ( arg.find( "--vc=" ) != string::npos) {
|
||||||
speedset = FG_VC;
|
speedset = FG_VC;
|
||||||
vkcas=atof( arg.substr(5) );
|
vkcas=atof( arg.substr(5) );
|
||||||
cout << "Got vc: " << vkcas << endl;
|
cout << "Got vc: " << vkcas << endl;
|
||||||
|
globals->get_props()->setDoubleValue("/velocities/airspeed", vkcas);
|
||||||
} else if ( arg.find( "--mach=" ) != string::npos) {
|
} else if ( arg.find( "--mach=" ) != string::npos) {
|
||||||
speedset = FG_MACH;
|
speedset = FG_MACH;
|
||||||
mach=atof( arg.substr(7) );
|
mach=atof( arg.substr(7) );
|
||||||
|
@ -952,6 +950,27 @@ int FGOptions::parse_option( const string& arg ) {
|
||||||
visibility = atof( arg.substr( 19 ) ) * 5280.0 * FEET_TO_METER;
|
visibility = atof( arg.substr( 19 ) ) * 5280.0 * FEET_TO_METER;
|
||||||
globals->get_props()->setDoubleValue("/environment/visibility",
|
globals->get_props()->setDoubleValue("/environment/visibility",
|
||||||
visibility);
|
visibility);
|
||||||
|
} else if ( arg.find( "--wind=" ) == 0 ) {
|
||||||
|
string val = arg.substr(7);
|
||||||
|
int pos = val.find('@');
|
||||||
|
if (pos == string::npos) {
|
||||||
|
FG_LOG(FG_GENERAL, FG_ALERT, "bad wind value " << val);
|
||||||
|
return FG_OPTIONS_ERROR;
|
||||||
|
}
|
||||||
|
double dir = atof(val.substr(0,pos).c_str());
|
||||||
|
double speed = atof(val.substr(pos+1).c_str());
|
||||||
|
FG_LOG(FG_GENERAL, FG_INFO, "WIND: " << dir << '@' <<
|
||||||
|
speed << " knots" << endl);
|
||||||
|
// convert to fps
|
||||||
|
speed *= NM_TO_METER * METER_TO_FEET * (1.0/3600);
|
||||||
|
dir += 180;
|
||||||
|
if (dir >= 360)
|
||||||
|
dir -= 360;
|
||||||
|
dir *= DEG_TO_RAD;
|
||||||
|
globals->get_props()->setDoubleValue("/environment/wind-north",
|
||||||
|
speed * cos(dir));
|
||||||
|
globals->get_props()->setDoubleValue("/environment/wind-east",
|
||||||
|
speed * sin(dir));
|
||||||
} else if ( arg.find( "--wp=" ) != string::npos ) {
|
} else if ( arg.find( "--wp=" ) != string::npos ) {
|
||||||
parse_wp( arg.substr( 5 ) );
|
parse_wp( arg.substr( 5 ) );
|
||||||
} else if ( arg.find( "--flight-plan=") != string::npos) {
|
} else if ( arg.find( "--flight-plan=") != string::npos) {
|
||||||
|
@ -1133,6 +1152,7 @@ void FGOptions::usage ( void ) {
|
||||||
<< endl;
|
<< endl;
|
||||||
cout << "\t--speed=n: run the FDM this much faster than real time" << endl;
|
cout << "\t--speed=n: run the FDM this much faster than real time" << endl;
|
||||||
cout << "\t--notrim: Do NOT attempt to trim the model when initializing JSBsim" << endl;
|
cout << "\t--notrim: Do NOT attempt to trim the model when initializing JSBsim" << endl;
|
||||||
|
cout << "\t--wind=degrees@knots: specify a wind component." << endl;
|
||||||
cout << endl;
|
cout << endl;
|
||||||
//(UIUC)
|
//(UIUC)
|
||||||
cout <<"Aircraft model directory:" << endl;
|
cout <<"Aircraft model directory:" << endl;
|
||||||
|
|
Loading…
Add table
Reference in a new issue