Menu

#2907 AIAircraft.cxx leadPointReached() logging causes segfault

2020.4
Fixed
None
Medium
2024-10-13
2024-08-09
No

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

2 Attachments

Discussion

  • Huntley Palmer

    Huntley Palmer - 2024-08-09
    • Attachments has changed:

    Diff:

    --- old
    +++ new
    @@ -1 +1,2 @@
    +KBOS-V.xml (585 Bytes; text/xml)
     KEWB-KBOS-RT.xml (10.6 kB; text/xml)
    
     
  • Huntley Palmer

    Huntley Palmer - 2024-08-09
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -16,6 +16,13 @@
     `
     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
    +
    +
    +
    +
    
     
  • Huntley Palmer

    Huntley Palmer - 2024-08-09

    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.

     
    • Keith Paterson

      Keith Paterson - 2024-08-15

      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.

       
  • James Turner

    James Turner - 2024-08-12
    • assigned_to: Keith Paterson
     
  • James Turner

    James Turner - 2024-08-12

    Assigned to Keith to give some thoughts.

     
  • Huntley Palmer

    Huntley Palmer - 2024-08-12

    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.

     
    • Keith Paterson

      Keith Paterson - 2024-08-15

      If I'm not mistaken it's a byReference call not an address. & is used for different purposes in C++

       
  • Keith Paterson

    Keith Paterson - 2024-10-13
    • status: New --> Fixed
     
  • Keith Paterson

    Keith Paterson - 2024-10-13

    Fixed on 2024.1.1 and next

     
  • Huntley Palmer

    Huntley Palmer - 2024-10-13

    Thank You !

     

Log in to post a comment.

MongoDB Logo MongoDB
Gen AI apps are built with MongoDB Atlas
Atlas offers built-in vector search and global availability across 125+ regions. Start building AI apps faster, all in one place.