]> git.mxchange.org Git - flightgear.git/commitdiff
Finetuning of AI Aircraft landing performance. Aircraft slow down to taxi speeds...
authorDurk Talsma <durktals@gmail.com>
Mon, 10 Oct 2011 19:55:09 +0000 (21:55 +0200)
committerDurk Talsma <durktals@gmail.com>
Mon, 10 Oct 2011 19:55:09 +0000 (21:55 +0200)
src/AIModel/AIAircraft.cxx
src/AIModel/AIFlightPlanCreate.cxx
src/AIModel/performancedata.cxx

index 6abe6af54407f59c92f51519c6a448dc0abcd5ed..a87a94fe61492d9856ce5ba1b85f371f75621853 100644 (file)
@@ -887,17 +887,17 @@ bool FGAIAircraft::handleAirportEndPoints(FGAIWaypoint* prev, time_t now) {
     //        fp->shortenToFirst(2, "legend");
     //    }
     //}
-    /*if (prev->contains(string("final"))) {
-        
-         cerr << getCallSign() << " " 
-            << fp->getPreviousWaypoint()->getName() 
-            << ". Alt = " << altitude_ft 
-            << " vs " << vs 
-            << " horizontal speed " << speed 
-            << "Previous crossAT " << fp->getPreviousWaypoint()->getCrossat()
-            << "Airport elevation" << getTrafficRef()->getArrivalAirport()->getElevation() 
-            << "Altitude difference " << (altitude_ft -  fp->getPreviousWaypoint()->getCrossat()) << endl;
-    }*/
+    //if (prev->contains(string("final"))) {
+    //    
+    //     cerr << getCallSign() << " " 
+    //        << fp->getPreviousWaypoint()->getName() 
+    //        << ". Alt = " << altitude_ft 
+    //        << " vs " << vs 
+    //        << " horizontal speed " << speed 
+    //        << "Previous crossAT " << fp->getPreviousWaypoint()->getCrossat()
+    //        << "Airport elevation" << getTrafficRef()->getArrivalAirport()->getElevation() 
+    //        << "Altitude difference " << (altitude_ft -  fp->getPreviousWaypoint()->getCrossat()) << endl;
+    //q}
     // This is the last taxi waypoint, and marks the the end of the flight plan
     // so, the schedule should update and wait for the next departure time.
     if (prev->contains("END")) {
index 215d3fb17207e1c921bd2d9c0e713ffcb0484750..305125819e180392784dca1771f645aad6369623 100644 (file)
@@ -575,6 +575,7 @@ bool FGAIFlightPlan::createDescent(FGAIAircraft * ac, FGAirport * apt,
     FGAIWaypoint *wpt;
     double vDescent = ac->getPerformance()->vDescent();
     double vApproach = ac->getPerformance()->vApproach();
+    double vTouchdown = ac->getPerformance()->vTouchdown();
 
 
     //Beginning of Descent 
@@ -821,6 +822,7 @@ bool FGAIFlightPlan::createDescent(FGAIAircraft * ac, FGAirport * apt,
 
     // The approach leg should bring the aircraft to approximately 4-6 nm out, after which the landing phase should take over. 
     //cerr << "Phase 3: Approach" << endl;
+    double tgt_speed = vApproach;
     distanceOut -= distanceCovered;
     double touchDownPoint = 0; //(rwy->lengthM() * 0.1);
     for (int i = 1; i < nPoints; i++) {
@@ -831,7 +833,10 @@ bool FGAIFlightPlan::createDescent(FGAIAircraft * ac, FGAirport * apt,
         double alt = currentAltitude -  (i * 2000 / (nPoints - 1));
         snprintf(buffer, 16, "final%03d", i);
         result = rwy->pointOnCenterline((-distanceOut) + currentDist + touchDownPoint);
-        wpt = createInAir(ac, buffer, result, alt, vApproach);
+        if (i == nPoints - 30) {
+            tgt_speed = vTouchdown;
+        }
+        wpt = createInAir(ac, buffer, result, alt, tgt_speed);
         wpt->setCrossat(alt);
         wpt->setTrackLength((distanceOut / nPoints));
         // account for the extra distance due to an extended downwind leg
@@ -891,7 +896,7 @@ bool FGAIFlightPlan::createLanding(FGAIAircraft * ac, FGAirport * apt,
 {
     double vTouchdown = ac->getPerformance()->vTouchdown();
     double vTaxi      = ac->getPerformance()->vTaxi();
-    double decel     = ac->getPerformance()->deceleration() * 1.5;
+    double decel     = ac->getPerformance()->deceleration() * 1.4;
     
     double vTouchdownMetric = (vTouchdown  * SG_NM_TO_METER) / 3600;
     double vTaxiMetric      = (vTaxi       * SG_NM_TO_METER) / 3600;
@@ -936,16 +941,17 @@ bool FGAIFlightPlan::createLanding(FGAIAircraft * ac, FGAirport * apt,
     }*/
     double rolloutDistance =
         (vTouchdownMetric * vTouchdownMetric - vTaxiMetric * vTaxiMetric) / (2 * decelMetric);
-    //cerr << " touchdown speed = " << vTouchdown << ". Rollout distance " << rolloutDistance << endl;
+    cerr << " touchdown speed = " << vTouchdown << ". Rollout distance " << rolloutDistance << endl;
     int nPoints = 50;
     for (int i = 1; i < nPoints; i++) {
         snprintf(buffer, 12, "landing03%d", i);
         
         coord = rwy->pointOnCenterline((rolloutDistance * ((double) i / (double) nPoints)));
-        wpt = createOnGround(ac, buffer, coord, currElev, vTaxi);
+        wpt = createOnGround(ac, buffer, coord, currElev, 2*vTaxi);
         wpt->setCrossat(currElev);
         waypoints.push_back(wpt);
     }
+    wpt->setSpeed(vTaxi);
     double mindist = 1.1 * rolloutDistance;
     double maxdist = rwy->lengthM();
     //cerr << "Finding nearest exit" << endl;
index 2a291967143962a41ea492819f2ed0d067426fe9..1c7b02912852edd4dcabcfafbe319a54aaecba9a 100644 (file)
@@ -6,6 +6,13 @@
 #include "performancedata.hxx"
 #include "AIAircraft.hxx"
 
+
+// For now, make this a define
+// Later on, additional class variables can simulate settings such as braking power
+// also, the performance parameters can be tweaked a little to add some personality
+// to the AIAircraft.
+#define BRAKE_SETTING 1.6
+
 PerformanceData::PerformanceData(double acceleration,
                                 double deceleration,
                                 double climbRate,
@@ -59,7 +66,7 @@ double PerformanceData::actualSpeed(FGAIAircraft* ac, double tgt_speed, double d
     } else if (speed_diff < 0.0) { // decelerate
         if (ac->onGround()) {
             // deceleration performance is better due to wheel brakes.
-            speed -= 3 * _deceleration * dt;
+            speed -= BRAKE_SETTING * _deceleration * dt;
         } else {
             speed -= _deceleration * dt;
         }