#include <Time/tmp.hxx>
#include <Main/fg_props.hxx>
#include <Main/globals.hxx>
+#include <Scenery/scenery.hxx>
#include "native_fdm.hxx"
net->longitude = cur_fdm_state->get_Longitude();
net->latitude = cur_fdm_state->get_Latitude();
net->altitude = cur_fdm_state->get_Altitude() * SG_FEET_TO_METER;
+ net->agl = cur_fdm_state->get_Altitude_AGL() * SG_FEET_TO_METER;
net->phi = cur_fdm_state->get_Phi();
net->theta = cur_fdm_state->get_Theta();
net->psi = cur_fdm_state->get_Psi();
+ net->alpha = cur_fdm_state->get_Alpha();
+ net->beta = cur_fdm_state->get_Beta();
net->phidot = cur_fdm_state->get_Phi_dot_degps() * SG_DEGREES_TO_RADIANS;
net->thetadot = cur_fdm_state->get_Theta_dot_degps()
* SG_DEGREES_TO_RADIANS;
net->v_wind_body_north = cur_fdm_state->get_uBody();
net->v_wind_body_east = cur_fdm_state->get_vBody();
net->v_wind_body_down = cur_fdm_state->get_wBody();
- net->stall_warning = fgGetDouble("/sim/alarms/stall-warning", 0.0);
net->A_X_pilot = cur_fdm_state->get_A_X_pilot();
net->A_Y_pilot = cur_fdm_state->get_A_Y_pilot();
net->A_Z_pilot = cur_fdm_state->get_A_Z_pilot();
+ net->stall_warning = fgGetDouble("/sim/alarms/stall-warning", 0.0);
+ net->slip_deg
+ = fgGetDouble("/instrumentation/slip-skid-ball/indicated-slip-skid");
+
// Engine parameters
net->num_engines = FGNetFDM::FG_MAX_ENGINES;
for ( i = 0; i < net->num_engines; ++i ) {
for (i = 0; i < net->num_wheels; ++i ) {
SGPropertyNode *node = fgGetNode("/gear/gear", i, true);
net->wow[i] = node->getDoubleValue("wow");
+ net->gear_pos[i] = node->getDoubleValue("position-norm");
+ net->gear_steer[i] = node->getDoubleValue("steering-norm");
+ net->gear_compression[i] = node->getDoubleValue("compression-norm");
}
// the following really aren't used in this context
net->left_aileron = node->getDoubleValue( "left-aileron-pos-norm" );
net->right_aileron = node->getDoubleValue( "right-aileron-pos-norm" );
net->rudder = node->getDoubleValue( "rudder-pos-norm" );
+ net->rudder = node->getDoubleValue( "nose-wheel-pos-norm" );
net->speedbrake = node->getDoubleValue( "speedbrake-pos-norm" );
net->spoilers = node->getDoubleValue( "spoilers-pos-norm" );
htonf(net->phi);
htonf(net->theta);
htonf(net->psi);
+ htonf(net->alpha);
+ htonf(net->beta);
htonf(net->phidot);
htonf(net->thetadot);
htonf(net->v_wind_body_north);
htonf(net->v_wind_body_east);
htonf(net->v_wind_body_down);
- htonf(net->stall_warning);
htonf(net->A_X_pilot);
htonf(net->A_Y_pilot);
htonf(net->A_Z_pilot);
+ htonf(net->stall_warning);
+ htonf(net->slip_deg);
+
for ( i = 0; i < net->num_engines; ++i ) {
- htonl(net->eng_state[i]);
+ net->eng_state[i] = htonl(net->eng_state[i]);
htonf(net->rpm[i]);
htonf(net->fuel_flow[i]);
htonf(net->EGT[i]);
for ( i = 0; i < net->num_wheels; ++i ) {
net->wow[i] = htonl(net->wow[i]);
+ htonf(net->gear_pos[i]);
+ htonf(net->gear_steer[i]);
+ htonf(net->gear_compression[i]);
}
net->num_wheels = htonl(net->num_wheels);
htonf(net->left_aileron);
htonf(net->right_aileron);
htonf(net->rudder);
+ htonf(net->nose_wheel);
htonf(net->speedbrake);
htonf(net->spoilers);
}
htonf(net->phi);
htonf(net->theta);
htonf(net->psi);
+ htonf(net->alpha);
+ htonf(net->beta);
htonf(net->phidot);
htonf(net->thetadot);
htonf(net->v_wind_body_north);
htonf(net->v_wind_body_east);
htonf(net->v_wind_body_down);
- htonf(net->stall_warning);
htonf(net->A_X_pilot);
htonf(net->A_Y_pilot);
htonf(net->A_Z_pilot);
+ htonf(net->stall_warning);
+ htonf(net->slip_deg);
+
net->num_engines = htonl(net->num_engines);
for ( i = 0; i < net->num_engines; ++i ) {
- htonl(net->eng_state[i]);
+ net->eng_state[i] = htonl(net->eng_state[i]);
htonf(net->rpm[i]);
htonf(net->fuel_flow[i]);
htonf(net->EGT[i]);
}
net->num_wheels = htonl(net->num_wheels);
- // I don't need to convert the Wow flags, since they are one
- // byte in size
+ for ( i = 0; i < net->num_wheels; ++i ) {
+ net->wow[i] = htonl(net->wow[i]);
+ htonf(net->gear_pos[i]);
+ htonf(net->gear_steer[i]);
+ htonf(net->gear_compression[i]);
+ }
net->cur_time = ntohl(net->cur_time);
net->warp = ntohl(net->warp);
htonf(net->left_aileron);
htonf(net->right_aileron);
htonf(net->rudder);
+ htonf(net->nose_wheel);
htonf(net->speedbrake);
htonf(net->spoilers);
}
net->longitude,
net->altitude
* SG_METER_TO_FEET );
+ if ( net->agl > -9000 ) {
+ cur_fdm_state->_set_Altitude_AGL( net->agl * SG_METER_TO_FEET );
+ } else {
+ double agl_m
+ = net->altitude - globals->get_scenery()->get_cur_elev();
+ cur_fdm_state->_set_Altitude_AGL( agl_m * SG_METER_TO_FEET );
+ }
cur_fdm_state->_set_Euler_Angles( net->phi,
net->theta,
net->psi );
+ cur_fdm_state->_set_Alpha( net->alpha );
+ cur_fdm_state->_set_Beta( net->beta );
cur_fdm_state->_set_Euler_Rates( net->phidot,
net->thetadot,
net->psidot );
net->v_wind_body_east,
net->v_wind_body_down );
- fgSetDouble( "/sim/alarms/stall-warning", net->stall_warning );
cur_fdm_state->_set_Accels_Pilot_Body( net->A_X_pilot,
net->A_Y_pilot,
net->A_Z_pilot );
+ fgSetDouble( "/sim/alarms/stall-warning", net->stall_warning );
+ fgSetDouble( "/instrumentation/slip-skid-ball/indicated-slip-skid",
+ net->slip_deg );
+ fgSetBool( "/instrumentation/slip-skid-ball/override", true );
+
for ( i = 0; i < net->num_engines; ++i ) {
SGPropertyNode *node = fgGetNode( "engines/engine", i, true );
}
for (i = 0; i < net->num_wheels; ++i ) {
- SGPropertyNode * node
- = fgGetNode("/gear/gear", i, true);
+ SGPropertyNode * node = fgGetNode("/gear/gear", i, true);
node->setDoubleValue("wow", net->wow[i] );
+ node->setDoubleValue("position-norm", net->gear_pos[i] );
+ node->setDoubleValue("steering-norm", net->gear_steer[i] );
+ node->setDoubleValue("compression-norm", net->gear_compression[i] );
}
/* these are ignored for now ... */
node->setDoubleValue("left-aileron-pos-norm", net->left_aileron);
node->setDoubleValue("right-aileron-pos-norm", net->right_aileron);
node->setDoubleValue("rudder-pos-norm", net->rudder);
+ node->setDoubleValue("nose-wheel-pos-norm", net->nose_wheel);
node->setDoubleValue("speedbrake-pos-norm", net->speedbrake);
node->setDoubleValue("spoilers-pos-norm", net->spoilers);
} else {