1
0
Fork 0

Tweaks to the LaRCsim interface to get wind working.

Corresponding tweaks to bfi.[ch]xx and options.cxx.
This commit is contained in:
curt 2001-01-08 17:59:54 +00:00
parent 690d2ac3e8
commit 7a235abecd
5 changed files with 186 additions and 111 deletions

View file

@ -2193,6 +2193,36 @@ SOURCE=.\src\Main\fg_io.cxx
# End 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
!IF "$(CFG)" == "FlightGear - Win32 Release"
@ -2238,21 +2268,6 @@ SOURCE=.\src\Main\options.cxx
# End 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
!IF "$(CFG)" == "FlightGear - Win32 Release"

View file

@ -426,8 +426,8 @@ bool FGLaRCsim::copy_from_LaRCsim() {
_set_Velocities_Local( V_north, V_east, V_down );
// set_Velocities_Ground( V_north_rel_ground, V_east_rel_ground,
// V_down_rel_ground );
// set_Velocities_Local_Airmass( V_north_airmass, V_east_airmass,
// V_down_airmass );
_set_Velocities_Local_Airmass( V_north_airmass, V_east_airmass,
V_down_airmass );
// set_Velocities_Local_Rel_Airmass( V_north_rel_airmass,
// V_east_rel_airmass, V_down_rel_airmass );
// set_Velocities_Gust( U_gust, V_gust, W_gust );

View file

@ -315,9 +315,9 @@ FGBFI::init ()
// Weather
fgTie("/environment/visibility", getVisibility, setVisibility);
fgTie("/environment/wind-north", getWindNorth);
fgTie("/environment/wind-east", getWindEast);
fgTie("/environment/wind-down", getWindDown);
fgTie("/environment/wind-north", getWindNorth, setWindNorth);
fgTie("/environment/wind-east", getWindEast, setWindEast);
fgTie("/environment/wind-down", getWindDown, setWindDown);
// View
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
FGBFI::getVisibility ()
@ -1735,7 +1735,7 @@ FGBFI::getVisibility ()
/**
* Set the current visibility (units??).
* Set the current visibility (meters).
*/
void
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
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
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
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 file

@ -64,8 +64,8 @@ public:
// static time_t getTimeGMT ();
// static void setTimeGMT (time_t time);
static string getDateString ();
static void setDateString (string time_string);
static string getDateString ();// ISO 8601 subset
static void setDateString (string time_string); // ISO 8601 subset
// deprecated
static string getGMTString ();
@ -76,59 +76,59 @@ public:
static bool getPanelVisible ();
static void setPanelVisible (bool panelVisible);
static int getPanelXOffset ();
static void setPanelXOffset (int i);
static int getPanelXOffset (); // pixels
static void setPanelXOffset (int i); // pixels
static int getPanelYOffset ();
static void setPanelYOffset (int i);
static int getPanelYOffset (); // pixels
static void setPanelYOffset (int i); // pixels
// Position
static double getLatitude ();
static void setLatitude (double latitude);
static double getLatitude (); // degrees
static void setLatitude (double latitude); // degrees
static double getLongitude ();
static void setLongitude (double longitude);
static double getLongitude (); // degrees
static void setLongitude (double longitude); // degrees
static double getAltitude ();
static void setAltitude (double altitude);
static double getAltitude (); // feet
static void setAltitude (double altitude); // feet
static double getAGL ();
static double getAGL (); // feet
// Attitude
static double getHeading (); // true heading
static void setHeading (double heading);
static double getHeading (); // degrees
static void setHeading (double heading); // degrees
static double getHeadingMag (); // exact magnetic heading
static double getHeadingMag (); // degrees
static double getPitch ();
static void setPitch (double pitch);
static double getPitch (); // degrees
static void setPitch (double pitch); // degrees
static double getRoll ();
static void setRoll (double roll);
static double getRoll (); // degrees
static void setRoll (double roll); // degrees
// Engine
static double getRPM ();
static void setRPM ( double rpm );
static double getRPM (); // revolutions/minute
static void setRPM ( double rpm ); // revolutions/minute
static double getEGT ();
static double getCHT ();
static double getMP ();
static double getEGT (); // [unit??]
static double getCHT (); // [unit??]
static double getMP (); // [unit??]
// Velocities
static double getAirspeed ();
static void setAirspeed (double speed);
static double getAirspeed (); // knots
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 setSpeedEast (double speed);
@ -136,58 +136,58 @@ public:
// Controls
static double getThrottle ();
static void setThrottle (double throttle);
static double getThrottle (); // 0.0:1.0
static void setThrottle (double throttle); // 0.0:1.0
static double getMixture ();
static void setMixture (double mixture);
static double getMixture (); // 0.0:1.0
static void setMixture (double mixture); // 0.0:1.0
static double getPropAdvance ();
static void setPropAdvance (double pitch);
static double getPropAdvance (); // 0.0:1.0
static void setPropAdvance (double pitch); // 0.0:1.0
static double getFlaps ();
static void setFlaps (double flaps);
static double getFlaps (); // 0.0:1.0
static void setFlaps (double flaps); // 0.0:1.0
static double getAileron ();
static void setAileron (double aileron);
static double getAileron (); // -1.0:1.0
static void setAileron (double aileron); // -1.0:1.0
static double getRudder ();
static void setRudder (double rudder);
static double getRudder (); // -1.0:1.0
static void setRudder (double rudder); // -1.0:1.0
static double getElevator ();
static void setElevator (double elevator);
static double getElevator (); // -1.0:1.0
static void setElevator (double elevator); // -1.0:1.0
static double getElevatorTrim ();
static void setElevatorTrim (double trim);
static double getElevatorTrim (); // -1.0:1.0
static void setElevatorTrim (double trim); // -1.0:1.0
static double getBrakes ();
static void setBrakes (double brake);
static double getBrakes (); // 0.0:1.0
static void setBrakes (double brake); // 0.0:1.0
static double getLeftBrake ();
static void setLeftBrake (double brake);
static double getLeftBrake (); // 0.0:1.0
static void setLeftBrake (double brake); // 0.0:1.0
static double getRightBrake ();
static void setRightBrake (double brake);
static double getRightBrake (); // 0.0:1.0
static void setRightBrake (double brake); // 0.0:1.0
static double getCenterBrake ();
static void setCenterBrake (double brake);
static double getCenterBrake (); // 0.0:1.0
static void setCenterBrake (double brake); // 0.0:1.0
// Autopilot
static bool getAPAltitudeLock ();
static void setAPAltitudeLock (bool lock);
static double getAPAltitude ();
static void setAPAltitude (double altitude);
static double getAPAltitude (); // feet
static void setAPAltitude (double altitude); // feet
static bool getAPHeadingLock ();
static void setAPHeadingLock (bool lock);
static double getAPHeading ();
static void setAPHeading (double heading);
static double getAPHeading (); // degrees
static void setAPHeading (double heading); // degrees
static double getAPHeadingMag ();
static void setAPHeadingMag (double heading);
static double getAPHeadingMag (); // degrees
static void setAPHeadingMag (double heading); // degrees
static bool getAPNAV1Lock ();
static void setAPNAV1Lock (bool lock);
@ -199,12 +199,12 @@ public:
static double getNAV1AltFreq ();
static void setNAV1AltFreq (double freq);
static double getNAV1Radial ();
static double getNAV1Radial (); // degrees
static double getNAV1SelRadial ();
static void setNAV1SelRadial (double radial);
static double getNAV1SelRadial (); // degrees
static void setNAV1SelRadial (double radial); // degrees
static double getNAV1DistDME ();
static double getNAV1DistDME (); // nautical miles
static bool getNAV1TO ();
@ -220,12 +220,12 @@ public:
static double getNAV2AltFreq ();
static void setNAV2AltFreq (double freq);
static double getNAV2Radial ();
static double getNAV2Radial (); // degrees
static double getNAV2SelRadial ();
static void setNAV2SelRadial (double radial);
static double getNAV2SelRadial (); // degrees
static void setNAV2SelRadial (double radial); // degrees
static double getNAV2DistDME ();
static double getNAV2DistDME (); // nautical miles
static bool getNAV2TO ();
@ -241,8 +241,8 @@ public:
static double getADFAltFreq ();
static void setADFAltFreq (double freq);
static double getADFRotation ();
static void setADFRotation (double rot);
static double getADFRotation (); // degrees
static void setADFRotation (double rot); // degrees
// GPS
static string getTargetAirport ();
@ -251,26 +251,29 @@ public:
static bool getGPSLock ();
static void setGPSLock (bool lock);
static double getGPSTargetLatitude ();
static double getGPSTargetLatitude (); // degrees
static double getGPSTargetLongitude ();
static double getGPSTargetLongitude (); // degrees
// Weather
static double getVisibility ();
static void setVisibility (double visiblity);
static double getWindNorth ();
static double getWindEast ();
static double getWindDown ();
static double getVisibility ();// meters
static void setVisibility (double visiblity); // meters
static double getWindNorth (); // feet/second
static void setWindNorth (double speed); // feet/second
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
static void setViewAxisLong (double axis);
static void setViewAxisLat (double axis);
static void setViewAxisLong (double axis);// -1.0:1.0
static void setViewAxisLat (double axis); // -1.0:1.0
// Time (this varies with time) huh, huh
static double getMagVar ();
static double getMagDip ();
static double getMagVar (); // degrees
static double getMagDip (); // degrees
private:

View file

@ -734,7 +734,6 @@ int FGOptions::parse_option( const string& arg ) {
} else {
vNorth = atof( arg.substr(9) ) * FEET_TO_METER;
}
globals->get_props()->setDoubleValue("/velocities/speed-north", vNorth);
} else if ( arg.find( "--vEast=" ) != string::npos ) {
speedset = FG_VTNED;
if ( units == FG_UNITS_FEET ) {
@ -742,7 +741,6 @@ int FGOptions::parse_option( const string& arg ) {
} else {
vEast = atof( arg.substr(8) ) * FEET_TO_METER;
}
globals->get_props()->setDoubleValue("/velocities/speed-east", vEast);
} else if ( arg.find( "--vDown=" ) != string::npos ) {
speedset = FG_VTNED;
if ( units == FG_UNITS_FEET ) {
@ -750,11 +748,11 @@ int FGOptions::parse_option( const string& arg ) {
} else {
vDown = atof( arg.substr(8) ) * FEET_TO_METER;
}
globals->get_props()->setDoubleValue("/velocities/speed-down", vDown);
} else if ( arg.find( "--vc=" ) != string::npos) {
speedset = FG_VC;
vkcas=atof( arg.substr(5) );
cout << "Got vc: " << vkcas << endl;
globals->get_props()->setDoubleValue("/velocities/airspeed", vkcas);
} else if ( arg.find( "--mach=" ) != string::npos) {
speedset = FG_MACH;
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;
globals->get_props()->setDoubleValue("/environment/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 ) {
parse_wp( arg.substr( 5 ) );
} else if ( arg.find( "--flight-plan=") != string::npos) {
@ -1133,6 +1152,7 @@ void FGOptions::usage ( void ) {
<< 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--wind=degrees@knots: specify a wind component." << endl;
cout << endl;
//(UIUC)
cout <<"Aircraft model directory:" << endl;