processes.
#include <simgear/debug/logstream.hxx>
#include <simgear/io/iochannel.hxx>
+#include <Scenery/scenery.hxx> // ground elevation
+
#include "native_ctrls.hxx"
for ( i = 0; i < FG_MAX_WHEELS; ++i ) {
raw->brake[i] = globals->get_controls()->get_brake(i);
}
+
+ raw->hground = scenery.cur_elev;
}
for ( i = 0; i < FG_MAX_WHEELS; ++i ) {
globals->get_controls()->set_brake( i, raw->brake[i] );
}
+ scenery.cur_elev = raw->hground;
} else {
SG_LOG( SG_IO, SG_ALERT, "Error: version mismatch in raw2global()" );
SG_LOG( SG_IO, SG_ALERT,
static void global2raw( const FGInterface *global, FGRawFDM *raw ) {
raw->version = FG_RAW_FDM_VERSION;
+
+ // positions
raw->longitude = cur_fdm_state->get_Longitude();
raw->latitude = cur_fdm_state->get_Latitude();
raw->altitude = cur_fdm_state->get_Altitude();
raw->phi = cur_fdm_state->get_Phi();
raw->theta = cur_fdm_state->get_Theta();
raw->psi = cur_fdm_state->get_Psi();
+
+ // velocities
+ raw->vcas = cur_fdm_state->get_V_calibrated_kts();
+ raw->climb_rate = cur_fdm_state->get_Climb_Rate();
}
cur_fdm_state->_set_Euler_Angles( raw->phi,
raw->theta,
raw->psi );
+ cur_fdm_state->_set_V_calibrated_kts( raw->vcas );
+ cur_fdm_state->_set_Climb_Rate( raw->climb_rate );
} else {
SG_LOG( SG_IO, SG_ALERT, "Error: version mismatch in raw2global()" );
SG_LOG( SG_IO, SG_ALERT,
# error This library requires C++
#endif
-const int FG_RAW_CTRLS_VERSION = 1;
+const int FG_RAW_CTRLS_VERSION = 2;
const int FG_MAX_ENGINES = 10;
const int FG_MAX_WHEELS = 3;
public:
int version; // increment when data values change
+
+ // Controls
double aileron; // -1 ... 1
double elevator; // -1 ... 1
double elevator_trim; // -1 ... 1
double prop_advance[FG_MAX_ENGINES]; // 0 ... 1
double brake[FG_MAX_WHEELS]; // 0 ... 1
+ // Other interesting/useful values
+ double hground; // ground elevation (meters)
};
# error This library requires C++
#endif
-const int FG_RAW_FDM_VERSION = 1;
+const int FG_RAW_FDM_VERSION = 3;
// Define a structure containing the top level flight dynamics model
// parameters
public:
int version; // increment when data values change
+
+ // Positions
double longitude; // radians
double latitude; // radians
double altitude; // meters (above sea level)
double phi; // radians
double theta; // radians
double psi; // radians
+
+ // Velocities
+ double vcas; // calibrated airspeed
+ double climb_rate; // feet per second
};