X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FExternalPipe%2FExternalPipe.cxx;h=abe6569601a4a98b81d943647a23eeff558c398d;hb=2ea50c63bbb95e143662de2f136c79898236e38d;hp=8f33df584c36c0b719a94b7b8bd333aa9c519a00;hpb=8be4e97f54121260feb292e1fcbe3d072d28c941;p=flightgear.git diff --git a/src/FDM/ExternalPipe/ExternalPipe.cxx b/src/FDM/ExternalPipe/ExternalPipe.cxx index 8f33df584..abe656960 100644 --- a/src/FDM/ExternalPipe/ExternalPipe.cxx +++ b/src/FDM/ExternalPipe/ExternalPipe.cxx @@ -31,6 +31,7 @@ # include // unlink() #endif +#include #include // FILE*, fopen(), fread(), fwrite(), et. al. #include // for cout, endl @@ -428,42 +429,48 @@ void FGExternalPipe::update_binary( double dt ) { // Process remote FDM "set" commands -static void process_set_command( const string_list &tokens ) { + +void FGExternalPipe::process_set_command( const string_list &tokens ) { if ( tokens[1] == "geodetic_position" ) { double lat_rad = atof( tokens[2].c_str() ); double lon_rad = atof( tokens[3].c_str() ); double alt_m = atof( tokens[4].c_str() ); - cur_fdm_state->_updateGeodeticPosition( lat_rad, lon_rad, + _updateGeodeticPosition( lat_rad, lon_rad, alt_m * SG_METER_TO_FEET ); - double agl_m = alt_m - cur_fdm_state->get_Runway_altitude_m(); - cur_fdm_state->_set_Altitude_AGL( agl_m * SG_METER_TO_FEET ); + double agl_m = alt_m - get_Runway_altitude_m(); + _set_Altitude_AGL( agl_m * SG_METER_TO_FEET ); } else if ( tokens[1] == "euler_angles" ) { double phi_rad = atof( tokens[2].c_str() ); double theta_rad = atof( tokens[3].c_str() ); double psi_rad = atof( tokens[4].c_str() ); - cur_fdm_state->_set_Euler_Angles( phi_rad, theta_rad, psi_rad ); + _set_Euler_Angles( phi_rad, theta_rad, psi_rad ); } else if ( tokens[1] == "euler_rates" ) { double phidot = atof( tokens[2].c_str() ); double thetadot = atof( tokens[3].c_str() ); double psidot = atof( tokens[4].c_str() ); - cur_fdm_state->_set_Euler_Rates( phidot, thetadot, psidot ); + _set_Euler_Rates( phidot, thetadot, psidot ); + } else if ( tokens[1] == "ned" ) { + double north_fps = atof( tokens[2].c_str() ); + double east_fps = atof( tokens[3].c_str() ); + double down_fps = atof( tokens[4].c_str() ); + _set_Velocities_Local( north_fps, east_fps, down_fps ); } else if ( tokens[1] == "alpha" ) { - cur_fdm_state->_set_Alpha( atof(tokens[2].c_str()) ); + _set_Alpha( atof(tokens[2].c_str()) ); } else if ( tokens[1] == "beta" ) { - cur_fdm_state->_set_Beta( atof(tokens[2].c_str()) ); + _set_Beta( atof(tokens[2].c_str()) ); #if 0 - 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, + _set_V_calibrated_kts( net->vcas ); + _set_Climb_Rate( net->climb_rate ); + _set_Velocities_Local( net->v_north, net->v_east, net->v_down ); - cur_fdm_state->_set_Velocities_Wind_Body( net->v_wind_body_north, + _set_Velocities_Wind_Body( net->v_wind_body_north, net->v_wind_body_east, net->v_wind_body_down ); - cur_fdm_state->_set_Accels_Pilot_Body( net->A_X_pilot, + _set_Accels_Pilot_Body( net->A_X_pilot, net->A_Y_pilot, net->A_Z_pilot ); #endif