In next only, running an AI Scenario, not an AI Flightplan , can trigger logging at AIAircraft.cxx @ 990 :
SG_LOG(SG_AI, SG_WARN, getCallSign() << "| possible missed WP at " << trafficRef->getArrivalAirport()->getId() << " " << curr->getName());
An AI Scenario does not necessarily name an airport so calling getArrivalAirport() for an AI Scenario results in a null pointer and segfault;
Running next and replacing the source thus:
if (abs(headingDiffCurrent) > 80 && speed > 0) {
if (fp->getLeg() <= AILeg::CLIMB) {
SG_LOG(SG_AI, SG_WARN, getCallSign() << "| possible missed WP at " << trafficRef->getDepartureAirport()->getId() << " " << curr->getName());
} else {
//HP SG_LOG(SG_AI, SG_WARN, getCallSign() << "| possible missed WP at " << trafficRef->getArrivalAirport()->getId() << " " << curr->getName());
SG_LOG(SG_AI, SG_WARN, getCallSign() << "| possible missed WP named " << " " << curr->getName());
}
SG_LOG(SG_AI, SG_BULK, getCallSign() << "| headingDiffCurrent " << headingDiffCurrent << " headingDiffNext " << headingDiffNext);
}
Allows the scenario to run . Scenario file and flightplan are attached:
Edit: With the patched log message above, the failing WP is KEWG-xrol.
The logging was added with commit: a2b10c1ee39
Diff:
Diff:
The new tests in AIAircraft.cxx seem overly restrictive for an AI Scenario with a plane moving between a runway endpoint and its parallel taxiway: the right-angle turns fail at line 988:
if (abs(headingDiffCurrent) > 80 && speed > 0) {
and after that test is patched to
if (abs(headingDiffCurrent) > 90 && speed > 20) {
the test at 1245:
if (stuckCounter > AI_STUCK_LIMIT) { SG_LOG(SG_AI, SG_WARN, "Stuck flight " << _callsign << " killed on leg " << fp->getLeg() << " because point behind"); setDie(true); }fails, patching AI_STUCK_LIMIT to 500 allowed this test to pass.
That may be overly restrictive for some cases, but we have groundnets where aircraft get stuck because the nodes are too near to each other and the AI code can't handle overshooting. It's a bit of a compromise. I also currently have the STUCK_LIMIT pretty high because I'm creating real collision detection and that test can't differentiate between real waits and stuck. Needs improving.
Assigned to Keith to give some thoughts.
AIAircraft.cxx 'outOFSight' :
bool outOfSight = false;
197 updatePrimaryTargetValues(dt, flightplanActive, outOfSight); // target hdg, alt, speed
198 if (outOfSight) {
and :
void FGAIAircraft::updatePrimaryTargetValues(double dt, bool& flightplanActive, bool& aiOutOfSight)
1162 {
Does this work, not passing the boolean's address ? I had the impression outOfSight was not getting correctly set.
If I'm not mistaken it's a byReference call not an address. & is used for different purposes in C++
Fixed on 2024.1.1 and next
Thank You !