]> git.mxchange.org Git - flightgear.git/commitdiff
- Trying to improve waypoint following.
authorDurk Talsma <durk@linux-iue5.site>
Sat, 24 Jul 2010 07:19:37 +0000 (09:19 +0200)
committerDurk Talsma <durk@linux-iue5.site>
Sat, 24 Jul 2010 07:19:37 +0000 (09:19 +0200)
src/AIModel/AIAircraft.cxx
src/AIModel/AIFlightPlan.cxx
src/ATC/trafficcontrol.cxx

index 3440290d1789d8b3bf5e6a2e0ad561ee9368b8f8..92f458427fc6c9d4add7ee9dbb764b5b8d03aa9d 100644 (file)
@@ -629,12 +629,12 @@ bool FGAIAircraft::leadPointReached(FGAIFlightPlan::waypoint* curr) {
     //          << dist_to_go << ": Lead distance " 
     //          << lead_dist << " " << curr->name 
     //          << " Ground target speed " << groundTargetSpeed << endl;
-    if (trafficRef) {
-         if (trafficRef->getCallSign() == "Transavia7584") {
-              cerr << trafficRef->getCallSign() << " " << tgt_altitude_ft << " " << _getSpeed() << " " 
-                   << _getAltitude() << " "<< _getLatitude() << " " << _getLongitude() << " " << dist_to_go << " " << lead_dist << curr->name << endl; 
-         }
-     }
+   // if (trafficRef) {
+   //      if (trafficRef->getCallSign() == "Transavia7584") {
+   //           cerr << trafficRef->getCallSign() << " " << tgt_altitude_ft << " " << _getSpeed() << " " 
+   //                << _getAltitude() << " "<< _getLatitude() << " " << _getLongitude() << " " << dist_to_go << " " << lead_dist << curr->name << endl; 
+   //      }
+   //  }
     return dist_to_go < lead_dist;
 }
 
index 1ad358e0eb6ecd2b58be01e21491620ae778102e..d3b042bbe4c31760aa520ef6906b406d9f622f11 100644 (file)
@@ -405,7 +405,7 @@ void FGAIFlightPlan::setLeadDistance(double speed, double bearing,
         return;
   }
   if (speed < 25) {
-       turn_radius = ((360/30)*15) / (2*M_PI);
+       turn_radius = ((360/30)*fabs(speed)) / (2*M_PI);
   } else 
       turn_radius = 0.1911 * speed * speed; // an estimate for 25 degrees bank
 
@@ -419,10 +419,15 @@ void FGAIFlightPlan::setLeadDistance(double speed, double bearing,
   
   //lead_distance = turn_radius * sin(leadInAngle * SG_DEGREES_TO_RADIANS); 
   lead_distance = turn_radius * tan((leadInAngle * SG_DEGREES_TO_RADIANS)/2);
-  if (lead_distance > (3*turn_radius)) {
+  if ((lead_distance > (3*turn_radius)) && (current->on_ground == false)) {
       // cerr << "Warning: Lead-in distance is large. Inbound = " << inbound
       //      << ". Outbound = " << outbound << ". Lead in angle = " << leadInAngle  << ". Turn radius = " << turn_radius << endl;
        lead_distance = 3 * turn_radius;
+       return;
+  }
+  if ((leadInAngle > 90) && (current->on_ground == true)) {
+      lead_distance = turn_radius * tan((90 * SG_DEGREES_TO_RADIANS)/2);
+      return;
   }
 }
 
index ba00b60194f2288f4d3c6c1dc927983706867095..998f350a9c8f0d459e3ed2bc19f896b2baa04e4c 100644 (file)
@@ -510,7 +510,7 @@ void FGATCController::transmit(FGTrafficRecord *rec, AtcMsgId msgId, AtcMsgDir m
     double onBoardRadioFreq1 = fgGetDouble("/instrumentation/comm[1]/frequencies/selected-mhz");
     int onBoardRadioFreqI0 = (int) floor(onBoardRadioFreq0 * 100 + 0.5);
     int onBoardRadioFreqI1 = (int) floor(onBoardRadioFreq1 * 100 + 0.5);
-    //cerr << "Using " << onBoardRadioFreq0 << ", " << onBoardRadioFreq1 << " and " << stationFreq << endl;
+    cerr << "Using " << onBoardRadioFreq0 << ", " << onBoardRadioFreq1 << " and " << stationFreq << " for " << text << endl;
 
     // Display ATC message only when one of the radios is tuned
     // the relevant frequency.