// << 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;
}
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
//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;
}
}
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.