Updates to put more internal JSBSim values on the "bus".
FDMExec.GetAtmosphere()->UseInternal();
- FG_LOG( FG_FLIGHT, FG_INFO, " Initializing JSBsim with:" );
+ FG_LOG( FG_FLIGHT, FG_INFO, " Initializing JSBSim with:" );
FGInitialCondition *fgic = new FGInitialCondition(&FDMExec);
fgic->SetAltitudeFtIC(get_Altitude());
FG_LOG( FG_FLIGHT, FG_INFO, " set dt" );
- FG_LOG( FG_FLIGHT, FG_INFO, "Finished initializing JSBsim" );
+ FG_LOG( FG_FLIGHT, FG_INFO, "Finished initializing JSBSim" );
copy_from_JSBsim();
FDMExec.GetFCS()->SetPitchTrimCmd(controls.get_elevator_trim());
FDMExec.GetFCS()->SetDrCmd( controls.get_rudder());
FDMExec.GetFCS()->SetDfCmd( controls.get_flaps() );
- FDMExec.GetFCS()->SetDsbCmd( 0.0 );
- FDMExec.GetFCS()->SetDspCmd( 0.0 );
+ FDMExec.GetFCS()->SetDsbCmd( 0.0 ); //speedbrakes
+ FDMExec.GetFCS()->SetDspCmd( 0.0 ); //spoilers
FDMExec.GetFCS()->SetThrottleCmd( FGControls::ALL_ENGINES,
controls.get_throttle( 0 ) * 100.0 );
int FGJSBsim::copy_from_JSBsim() {
+ set_Inertias( FDMExec.GetAircraft()->GetMass(),
+ FDMExec.GetAircraft()->GetIxx(),
+ FDMExec.GetAircraft()->GetIyy(),
+ FDMExec.GetAircraft()->GetIzz(),
+ FDMExec.GetAircraft()->GetIxz() );
+
+ set_CG_Position ( FDMExec.GetAircraft()->GetXYZcg()(1),
+ FDMExec.GetAircraft()->GetXYZcg()(2),
+ FDMExec.GetAircraft()->GetXYZcg()(3) );
+
+ set_Accels_Body ( FDMExec.GetTranslation()->GetUVWdot()(1),
+ FDMExec.GetTranslation()->GetUVWdot()(2),
+ FDMExec.GetTranslation()->GetUVWdot()(3) );
+
+ set_Accels_CG_Body ( FDMExec.GetTranslation()->GetUVWdot()(1),
+ FDMExec.GetTranslation()->GetUVWdot()(2),
+ FDMExec.GetTranslation()->GetUVWdot()(3) );
+
+ set_Accels_CG_Body_N ( FDMExec.GetTranslation()->GetNcg()(1),
+ FDMExec.GetTranslation()->GetNcg()(2),
+ FDMExec.GetTranslation()->GetNcg()(3) );
+
+ set_Accels_Pilot_Body( FDMExec.GetAuxiliary()->GetPilotAccel()(1),
+ FDMExec.GetAuxiliary()->GetPilotAccel()(2),
+ FDMExec.GetAuxiliary()->GetPilotAccel()(3) );
+
+ set_Accels_Pilot_Body_N( FDMExec.GetAuxiliary()->GetNpilot()(1),
+ FDMExec.GetAuxiliary()->GetNpilot()(2),
+ FDMExec.GetAuxiliary()->GetNpilot()(3) );
+
+
+
+ set_Nlf( FDMExec.GetAircraft()->GetNlf());
+
+
+
// Velocities
set_Velocities_Local( FDMExec.GetPosition()->GetVn(),
FDMExec.GetPosition()->GetVe(),
FDMExec.GetPosition()->GetVd() );
+ set_Velocities_Wind_Body( FDMExec.GetTranslation()->GetUVW()(1),
+ FDMExec.GetTranslation()->GetUVW()(2),
+ FDMExec.GetTranslation()->GetUVW()(3) );
+
set_V_equiv_kts( FDMExec.GetAuxiliary()->GetVequivalentKTS() );
//set_V_calibrated( FDMExec.GetAuxiliary()->GetVcalibratedFPS() );
set_V_calibrated_kts( FDMExec.GetAuxiliary()->GetVcalibratedKTS() );
+
+ set_V_ground_speed ( FDMExec.GetPosition()->GetVground() );
set_Omega_Body( FDMExec.GetState()->GetParameter(FG_ROLLRATE),
FDMExec.GetState()->GetParameter(FG_PITCHRATE),
FDMExec.GetState()->GetParameter(FG_YAWRATE) );
- set_Euler_Rates( FDMExec.GetRotation()->Getphi(),
+ /* HUH!?! */ set_Euler_Rates( FDMExec.GetRotation()->Getphi(),
FDMExec.GetRotation()->Gettht(),
FDMExec.GetRotation()->Getpsi() );
inline unsigned int GetNumEngines(void) { return numEngines; }
inline FGColumnVector GetXYZcg(void) { return vXYZcg; }
inline FGColumnVector GetXYZrp(void) { return vXYZrp; }
+ inline FGColumnVector GetXYZep(void) { return vXYZep; }
inline float GetNlf(void) { return nlf; }
inline float GetAlphaCLMax(void) { return alphaclmax; }
inline float GetAlphaCLMin(void) { return alphaclmin; }
#include "FGAircraft.h"
#include "FGPosition.h"
#include "FGOutput.h"
+#include "FGMatrix.h"
/*******************************************************************************
************************************ CODE **************************************
A = pow(((pt-p)/psl+1),0.28571);
vcas = sqrt(7*psl/rhosl*(A-1));
veas = sqrt(2*qbar/rhosl);
+
+ vPilotAccel = Translation->GetUVWdot() + Aircraft->GetXYZep() * Rotation->GetPQRdot();
INCLUDES
*******************************************************************************/
#include "FGModel.h"
+#include "FGMatrix.h"
/*******************************************************************************
DEFINES
inline float GetVcalibratedKTS(void) { return vcas*FPSTOKTS; }
inline float GetVequivalentFPS(void) { return veas; }
inline float GetVequivalentKTS(void) { return veas*FPSTOKTS; }
-
-
-
+
+ inline FGColumnVector GetPilotAccel(void) { return vPilotAccel; }
+ inline FGColumnVector GetNpilot(void) { return vPilotAccel*INVGRAVITY; }
+
+
protected:
private:
//if a general freestream total is needed, e-mail Tony Peden
// (apeden@earthlink.net) or you can add it your self using the
// isentropic flow equations
+
+
+
+ FGColumnVector vPilotAccel;
void GetState(void);
};
LongitudeDot = LatitudeDot = RadiusDot = 0.0;
lastLongitudeDot = lastLatitudeDot = lastRadiusDot = 0.0;
Longitude = Latitude = 0.0;
- gamma = Vt = 0.0;
+ gamma = Vt = Vground = 0.0;
h = 3.0; // Est. height of aircraft cg off runway
SeaLevelRadius = EARTHRAD; // For initialization ONLY
Radius = SeaLevelRadius + h;
if (!FGModel::Run()) {
GetState();
+ Vground = sqrt( vVel(eNorth)*vVel(eNorth) + vVel(eEast)*vVel(eEast) );
+
invMass = 1.0 / Aircraft->GetMass();
Radius = h + SeaLevelRadius;
invRadius = 1.0 / Radius;
double DistanceAGL;
double SeaLevelRadius;
double gamma;
- double Vt;
+ double Vt, Vground;
double hoverb,b;
void GetState(void);
inline double GetVn(void) { return vVel(eX); }
inline double GetVe(void) { return vVel(eY); }
inline double GetVd(void) { return vVel(eZ); }
+ inline double GetVground(void) { return Vground; }
inline double Geth(void) { return h; }
inline double Gethdot(void) { return RadiusDot; }
inline double GetLatitude(void) { return Latitude; }
}
FG_VECTOR_3 n_cg_body_v;
- // inline double * get_N_cg_body_v() { return n_cg_body_v; }
- // inline double get_N_X_cg() const { return n_cg_body_v[0]; }
- // inline double get_N_Y_cg() const { return n_cg_body_v[1]; }
- // inline double get_N_Z_cg() const { return n_cg_body_v[2]; }
- /* inline void set_Accels_CG_Body_N( double x, double y, double z ) {
+ inline double * get_N_cg_body_v() { return n_cg_body_v; }
+ inline double get_N_X_cg() const { return n_cg_body_v[0]; }
+ inline double get_N_Y_cg() const { return n_cg_body_v[1]; }
+ inline double get_N_Z_cg() const { return n_cg_body_v[2]; }
+ inline void set_Accels_CG_Body_N( double x, double y, double z ) {
n_cg_body_v[0] = x;
n_cg_body_v[1] = y;
n_cg_body_v[2] = z;
- } */
+ }
FG_VECTOR_3 n_pilot_body_v;
// inline double * get_N_pilot_body_v() { return n_pilot_body_v; }
- // inline double get_N_X_pilot() const { return n_pilot_body_v[0]; }
- // inline double get_N_Y_pilot() const { return n_pilot_body_v[1]; }
- // inline double get_N_Z_pilot() const { return n_pilot_body_v[2]; }
- /* inline void set_Accels_Pilot_Body_N( double x, double y, double z ) {
+ inline double get_N_X_pilot() const { return n_pilot_body_v[0]; }
+ inline double get_N_Y_pilot() const { return n_pilot_body_v[1]; }
+ inline double get_N_Z_pilot() const { return n_pilot_body_v[2]; }
+ inline void set_Accels_Pilot_Body_N( double x, double y, double z ) {
n_pilot_body_v[0] = x;
n_pilot_body_v[1] = y;
n_pilot_body_v[2] = z;
- } */
+ }
+
+ double nlf; //Normal Load Factor
+ double get_Nlf(void) { return nlf; }
+ void set_Nlf(double n) { nlf=n; }
FG_VECTOR_3 omega_dot_body_v;
// inline double * get_Omega_dot_body_v() { return omega_dot_body_v; }
#endif // _FLIGHT_HXX
-
-
f->set_Longitude( current_options.get_lon() * DEG_TO_RAD );
f->set_Latitude( current_options.get_lat() * DEG_TO_RAD );
- if ( scenery.cur_elev > current_options.get_altitude() - 2 ) {
- current_options.set_altitude( scenery.cur_elev + 2 );
+ if ( scenery.cur_elev > current_options.get_altitude() - 1) {
+ current_options.set_altitude( scenery.cur_elev + 1 );
}
FG_LOG( FG_GENERAL, FG_INFO,
f->set_Altitude( current_options.get_altitude() * METER_TO_FEET );
fgFDMSetGroundElevation( current_options.get_flight_model(),
- (f->get_Altitude() - 3.758099) * FEET_TO_METER );
+ f->get_Altitude() * FEET_TO_METER );
FG_LOG( FG_GENERAL, FG_INFO,
"Initial position is: ("