- Trying to improve waypoint following.
This commit is contained in:
parent
10366f4f1b
commit
7313b8f1df
3 changed files with 14 additions and 9 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Reference in a new issue