]> git.mxchange.org Git - flightgear.git/blobdiff - src/Network/native_fdm.cxx
Make the AI models a bit more intelligent. The Gear should be extended and retracted...
[flightgear.git] / src / Network / native_fdm.cxx
index 5a5fffa40901277ced1572a3152302d694874b8f..550fb49bbee69234934a48aafaa7bb6c387b6a93 100644 (file)
@@ -133,6 +133,8 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
     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;
@@ -147,12 +149,15 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
     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 ) {
@@ -201,6 +206,7 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
     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" );
 
@@ -215,6 +221,8 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
         htonf(net->phi);
         htonf(net->theta);
         htonf(net->psi);
+        htonf(net->alpha);
+        htonf(net->beta);
 
         htonf(net->phidot);
         htonf(net->thetadot);
@@ -227,14 +235,16 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
         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]);
@@ -249,7 +259,7 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
         net->num_tanks = htonl(net->num_tanks);
 
         for ( i = 0; i < net->num_wheels; ++i ) {
-            htonl(net->wow[i]);
+            net->wow[i] = htonl(net->wow[i]);
             htonf(net->gear_pos[i]);
             htonf(net->gear_steer[i]);
             htonf(net->gear_compression[i]);
@@ -265,6 +275,7 @@ void FGProps2NetFDM( FGNetFDM *net, bool net_byte_order ) {
         htonf(net->left_aileron);
         htonf(net->right_aileron);
         htonf(net->rudder);
+        htonf(net->nose_wheel);
         htonf(net->speedbrake);
         htonf(net->spoilers);
     }
@@ -285,6 +296,8 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
         htonf(net->phi);
         htonf(net->theta);
         htonf(net->psi);
+        htonf(net->alpha);
+        htonf(net->beta);
 
         htonf(net->phidot);
         htonf(net->thetadot);
@@ -297,15 +310,17 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
         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]);
@@ -320,7 +335,7 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
 
         net->num_wheels = htonl(net->num_wheels);
         for ( i = 0; i < net->num_wheels; ++i ) {
-            htonl(net->wow[i]);
+            net->wow[i] = htonl(net->wow[i]);
             htonf(net->gear_pos[i]);
             htonf(net->gear_steer[i]);
             htonf(net->gear_compression[i]);
@@ -335,6 +350,7 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
         htonf(net->left_aileron);
         htonf(net->right_aileron);
         htonf(net->rudder);
+        htonf(net->nose_wheel);
         htonf(net->speedbrake);
         htonf(net->spoilers);
     }
@@ -357,6 +373,8 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
         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 );
@@ -369,11 +387,15 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
                                                   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 );
            
@@ -429,6 +451,7 @@ void FGNetFDM2Props( FGNetFDM *net, bool net_byte_order ) {
         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 {