1
0
Fork 0

- Trying to improve waypoint following.

This commit is contained in:
Durk Talsma 2010-07-24 09:19:37 +02:00
parent 10366f4f1b
commit 7313b8f1df
3 changed files with 14 additions and 9 deletions

View file

@ -629,12 +629,12 @@ bool FGAIAircraft::leadPointReached(FGAIFlightPlan::waypoint* curr) {
// << dist_to_go << ": Lead distance " // << dist_to_go << ": Lead distance "
// << lead_dist << " " << curr->name // << lead_dist << " " << curr->name
// << " Ground target speed " << groundTargetSpeed << endl; // << " Ground target speed " << groundTargetSpeed << endl;
if (trafficRef) { // if (trafficRef) {
if (trafficRef->getCallSign() == "Transavia7584") { // if (trafficRef->getCallSign() == "Transavia7584") {
cerr << trafficRef->getCallSign() << " " << tgt_altitude_ft << " " << _getSpeed() << " " // cerr << trafficRef->getCallSign() << " " << tgt_altitude_ft << " " << _getSpeed() << " "
<< _getAltitude() << " "<< _getLatitude() << " " << _getLongitude() << " " << dist_to_go << " " << lead_dist << curr->name << endl; // << _getAltitude() << " "<< _getLatitude() << " " << _getLongitude() << " " << dist_to_go << " " << lead_dist << curr->name << endl;
} // }
} // }
return dist_to_go < lead_dist; return dist_to_go < lead_dist;
} }

View file

@ -405,7 +405,7 @@ void FGAIFlightPlan::setLeadDistance(double speed, double bearing,
return; return;
} }
if (speed < 25) { if (speed < 25) {
turn_radius = ((360/30)*15) / (2*M_PI); turn_radius = ((360/30)*fabs(speed)) / (2*M_PI);
} else } else
turn_radius = 0.1911 * speed * speed; // an estimate for 25 degrees bank 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 * sin(leadInAngle * SG_DEGREES_TO_RADIANS);
lead_distance = turn_radius * tan((leadInAngle * SG_DEGREES_TO_RADIANS)/2); 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 // cerr << "Warning: Lead-in distance is large. Inbound = " << inbound
// << ". Outbound = " << outbound << ". Lead in angle = " << leadInAngle << ". Turn radius = " << turn_radius << endl; // << ". Outbound = " << outbound << ". Lead in angle = " << leadInAngle << ". Turn radius = " << turn_radius << endl;
lead_distance = 3 * turn_radius; 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;
} }
} }

View file

@ -510,7 +510,7 @@ void FGATCController::transmit(FGTrafficRecord *rec, AtcMsgId msgId, AtcMsgDir m
double onBoardRadioFreq1 = fgGetDouble("/instrumentation/comm[1]/frequencies/selected-mhz"); double onBoardRadioFreq1 = fgGetDouble("/instrumentation/comm[1]/frequencies/selected-mhz");
int onBoardRadioFreqI0 = (int) floor(onBoardRadioFreq0 * 100 + 0.5); int onBoardRadioFreqI0 = (int) floor(onBoardRadioFreq0 * 100 + 0.5);
int onBoardRadioFreqI1 = (int) floor(onBoardRadioFreq1 * 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 // Display ATC message only when one of the radios is tuned
// the relevant frequency. // the relevant frequency.