diff --git a/src/AIModel/AIAircraft.cxx b/src/AIModel/AIAircraft.cxx index 6faaac6d3..db2340756 100644 --- a/src/AIModel/AIAircraft.cxx +++ b/src/AIModel/AIAircraft.cxx @@ -909,6 +909,10 @@ bool FGAIAircraft::leadPointReached(FGAIWaypoint* curr, FGAIWaypoint* next, int prev_dist_to_go = HUGE_VAL; return true; } else { + if (prev_dist_to_go == dist_to_go_m) { + //FIXME must be suppressed when parked + SG_LOG(SG_AI, SG_WARN, "Aircraft " << _callsign << " stuck. Speed " << speed); + } prev_dist_to_go = dist_to_go_m; return false; } @@ -1106,7 +1110,9 @@ void FGAIAircraft::updateHeading(double dt) { if (sign(groundTargetSpeed) != sign(tgt_speed)) { if (fabs(speed) < 2 ) { - SG_LOG(SG_AI, SG_DEBUG, "Oh dear we're stuck. Speed set to " << speed ); + // This seems to happen in case there is a change from forward to pushback. + // which should never happen. + SG_LOG(SG_AI, SG_BULK, "Oh dear we're stuck. Speed is " << speed ); } // Negative Cosinus means angle > 90° groundTargetSpeed = 0.21 * sign(tgt_speed); // to prevent speed getting stuck in 'negative' mode @@ -1509,9 +1515,11 @@ void FGAIAircraft::dumpCSVHeader(std::ofstream& o) { o << "Departuretime\t"; o << "Time\t"; o << "Startup diff\t"; + o << "dist_to_go_m\t"; o << "Leg\t"; o << "Num WP\t"; o << "Leaddistance\t"; + o << "no_roll"; o << endl; } @@ -1523,6 +1531,7 @@ void FGAIAircraft::dumpCSV(std::ofstream& o, int lineIndex) { } o << lineIndex << "\t"; + o << setprecision(12); o << this->getGeodPos().getLatitudeDeg() << "\t"; o << this->getGeodPos().getLongitudeDeg() << "\t"; o << this->getCallSign() << "\t"; @@ -1553,8 +1562,10 @@ void FGAIAircraft::dumpCSV(std::ofstream& o, int lineIndex) { o << this->GetFlightPlan()->getStartTime() << "\t"; o << globals->get_time_params()->get_cur_time() << "\t"; o << this->GetFlightPlan()->getStartTime() - globals->get_time_params()->get_cur_time() << "\t"; + double dist_to_go_m = fp->getDistanceToGo(pos.getLatitudeDeg(), pos.getLongitudeDeg(), currentWP); + o << dist_to_go_m << "\t"; } else { - o << "\t\t\t\t\t\t\t"; + o << "\t\t\t\t\t\t\t\t"; } if (fp->isValidPlan()) { o << fp->getLeg() << "\t"; @@ -1563,6 +1574,7 @@ void FGAIAircraft::dumpCSV(std::ofstream& o, int lineIndex) { } else { o << "NotValid\t\t"; } + o << this->onGround(); o << endl; } diff --git a/src/AIModel/AIFlightPlanCreate.cxx b/src/AIModel/AIFlightPlanCreate.cxx index aa3e75fe4..07acd585c 100644 --- a/src/AIModel/AIFlightPlanCreate.cxx +++ b/src/AIModel/AIFlightPlanCreate.cxx @@ -68,7 +68,13 @@ bool FGAIFlightPlan::create(FGAIAircraft * ac, FGAirport * dep, const string & aircraftType, const string & airline, double distance) { - SG_LOG(SG_AI, SG_BULK, "Create Leg " << legNr << " " << (firstFlight?"First":"") << " Old Leg " << getLeg() << " Departure Airport : " << dep->getId()); + if( legNr <= 3 ) + SG_LOG(SG_AI, SG_BULK, "Create Leg " << legNr << " " << (firstFlight?"First":"") << " Old Leg " << getLeg() << " Airport : " << dep->getId()); + else if( legNr<= 6 ) + SG_LOG(SG_AI, SG_BULK, "Create Leg " << legNr << " " << (firstFlight?"First":"") << " Old Leg " << getLeg() << " Departure Airport : " << dep->getId() << " Arrival Airport : " << arr->getId()); + else + SG_LOG(SG_AI, SG_BULK, "Create Leg " << legNr << " " << (firstFlight?"First":"") << " Old Leg " << getLeg() << " Airport : " << arr->getId()); + bool retVal = true; int currWpt = wpt_iterator - waypoints.begin(); switch (legNr) { @@ -964,7 +970,7 @@ static double runwayGlideslopeTouchdownDistance(FGRunway* rwy) } /******************************************************************* - * CreateLanding + * CreateLanding (Leg 7) * Create a flight path from the "permision to land" point (currently hardcoded at 5000 meters from the threshold) to the threshold, at a standard glide slope angle of 3 degrees. @@ -1048,7 +1054,8 @@ bool FGAIFlightPlan::createLanding(FGAIAircraft * ac, FGAirport * apt, FGGroundNetwork *gn = apt->groundNetwork(); if (!gn) { - return true; + SG_LOG(SG_AI, SG_DEBUG, "No groundnet " << apt->getId() << " no landing created."); + return true; } coord = rwy->pointOnCenterline(mindist); diff --git a/src/AIModel/AIFlightPlanCreatePushBack.cxx b/src/AIModel/AIFlightPlanCreatePushBack.cxx index 4af10f5da..b255169c5 100644 --- a/src/AIModel/AIFlightPlanCreatePushBack.cxx +++ b/src/AIModel/AIFlightPlanCreatePushBack.cxx @@ -95,6 +95,7 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac, FGParking *parking = gate.parking(); if (parking && parking->getPushBackPoint() != nullptr) { FGTaxiRoute route = groundNet->findShortestRoute(parking, parking->getPushBackPoint(), false); + SG_LOG(SG_AI, SG_BULK, "Creating Pushforward : \t" << parking->getPushBackPoint()->getIndex()); int size = route.size(); if (size < 2) { @@ -109,8 +110,8 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac, while (route.next(node, &rte)) { char buffer[10]; - snprintf (buffer, 10, "%d", node->getIndex()); - FGAIWaypoint *wpt = createOnGround(ac, string(buffer), node->geod(), dep->getElevation(), vTaxiBackward); + snprintf (buffer, 10, "pb %d", node->getIndex()); + FGAIWaypoint *wpt = createOnGround(ac, string(buffer), node->geod(), dep->getElevation(), -vTaxiBackward); /* if (previous) {