raw->elevator_trim = node->getDoubleValue( "elevator-trim" );
raw->rudder = node->getDoubleValue( "rudder" );
raw->flaps = node->getDoubleValue( "flaps" );
+ raw->flaps_power
+ = node->getDoubleValue( "/systems/electrical/outputs/flaps",
+ 1.0 ) >= 1.0;
raw->num_engines = FGRawCtrls::FG_MAX_ENGINES;
for ( i = 0; i < FGRawCtrls::FG_MAX_ENGINES; ++i ) {
raw->throttle[i] = node->getDoubleValue( "throttle", 0.0 );
raw->mixture[i] = node->getDoubleValue( "mixture", 0.0 );
+ raw->fuel_pump_power[i]
+ = node->getDoubleValue( "/systems/electrical/outputs/fuel-pump",
+ 1.0 ) >= 1.0;
raw->prop_advance[i] = node->getDoubleValue( "propeller-pitch", 0.0 );
raw->magnetos[i] = node->getIntValue( "magnetos", 0 );
if ( i == 0 ) {
// cout << "Magnetos -> " << node->getIntValue( "magnetos", 0 );
}
- raw->starter[i] = node->getBoolValue( "starter", false );
+ raw->starter_power[i]
+ = node->getDoubleValue( "/systems/electrical/outputs/starter",
+ 1.0 ) >= 1.0;
if ( i == 0 ) {
// cout << " Starter -> " << node->getIntValue( "stater", false )
// << endl;
raw->brake[i] = 0.0;
}
}
+
+ node = fgGetNode("/controls/switches", true);
+ raw->master_bat = node->getChild("master-bat")->getBoolValue();
+ raw->master_alt = node->getChild("master-alt")->getBoolValue();
+ raw->master_avionics = node->getChild("master-avionics")->getBoolValue();
+
raw->hground = fgGetDouble( "/environment/ground-elevation-m" );
raw->magvar = fgGetDouble("/environment/magnetic-variation-deg");
raw->speedup = fgGetInt("/sim/speed-up");
htond(raw->elevator_trim);
htond(raw->rudder);
htond(raw->flaps);
+ raw->flaps_power = htonl(raw->flaps_power);
for ( i = 0; i < FGRawCtrls::FG_MAX_ENGINES; ++i ) {
htond(raw->throttle[i]);
htond(raw->mixture[i]);
+ raw->fuel_pump_power[i] = htonl(raw->fuel_pump_power[i]);
htond(raw->prop_advance[i]);
raw->magnetos[i] = htonl(raw->magnetos[i]);
- raw->starter[i] = htonl(raw->starter[i]);
+ raw->starter_power[i] = htonl(raw->starter_power[i]);
}
raw->num_engines = htonl(raw->num_engines);
for ( i = 0; i < FGRawCtrls::FG_MAX_TANKS; ++i ) {
htond(raw->brake[i]);
}
raw->num_wheels = htonl(raw->num_wheels);
+ raw->gear_handle = htonl(raw->gear_handle);
+ raw->master_bat = htonl(raw->master_bat);
+ raw->master_alt = htonl(raw->master_alt);
+ raw->master_avionics = htonl(raw->master_avionics);
htond(raw->hground);
htond(raw->magvar);
raw->speedup = htonl(raw->speedup);
htond(net->psidot);
htond(net->vcas);
htond(net->climb_rate);
+ htond(net->v_north);
+ htond(net->v_east);
+ htond(net->v_down);
htond(net->A_X_pilot);
htond(net->A_Y_pilot);
net->psidot );
cur_fdm_state->_set_V_calibrated_kts( net->vcas );
cur_fdm_state->_set_Climb_Rate( net->climb_rate );
+ cur_fdm_state->_set_Velocities_Local( net->v_north,
+ net->v_east,
+ net->v_down );
cur_fdm_state->_set_Accels_Pilot_Body( net->A_X_pilot,
net->A_Y_pilot,
net->A_Z_pilot );
valid = false;
}
- // we want to block for incoming data in order to syncronize frame
- // rates.
- data_server.setBlocking( false /* don't block while testing */ );
- // data_server.setBlocking( true /* don't block while testing */ );
+ // disable blocking
+ data_server.setBlocking( false );
+
+ // allowed to read from a broadcast addr
+ // data_server.setBroadcast( true );
// if we bind to fdm_host = "" then we accept messages from
// anyone.
- if ( data_server.bind( fdm_host.c_str(), data_in_port ) == -1 ) {
+ if ( data_server.bind( "", data_in_port ) == -1 ) {
printf("error binding to port %d\n", data_in_port);
valid = false;
}
new HTTPClient( fdm_host.c_str(), cmd_port, cmd );
netChannel::loop(0);
+ SG_LOG( SG_IO, SG_INFO, "before sending reset command." );
+
sprintf( cmd, "/reset?value=ground" );
new HTTPClient( fdm_host.c_str(), cmd_port, cmd );
netChannel::loop(0);
+
+ SG_LOG( SG_IO, SG_INFO, "Remote FDM init() finished." );
}
length = sizeof(ctrls);
global2raw( &ctrls );
if ( data_client.send( (char *)(& ctrls), length, 0 ) != length ) {
- SG_LOG( SG_IO, SG_ALERT, "Error writing data." );
+ SG_LOG( SG_IO, SG_DEBUG, "Error writing data." );
} else {
- SG_LOG( SG_IO, SG_ALERT, "wrote control data." );
+ SG_LOG( SG_IO, SG_DEBUG, "wrote control data." );
}
// Read next set of FDM data (blocking enabled to maintain 'sync')