1
0
Fork 0

Logging for createPushBack, FlightPlan

createPushBack Logging
This commit is contained in:
portree_kid 2021-05-01 19:53:31 +02:00 committed by James Turner
parent 986d061004
commit bd96c767d5
5 changed files with 34 additions and 28 deletions

View file

@ -1466,6 +1466,7 @@ void FGAIAircraft::dumpCSVHeader(std::ofstream& o) {
o << "headingErr\t"; o << "headingErr\t";
o << "hdg\t"; o << "hdg\t";
o << "tgt_heading\t"; o << "tgt_heading\t";
o << "tgt_speed\t";
o << "minBearing\t"; o << "minBearing\t";
o << "speedFraction\t"; o << "speedFraction\t";
o << "groundOffset\t"; o << "groundOffset\t";
@ -1494,6 +1495,7 @@ void FGAIAircraft::dumpCSV(std::ofstream& o, int lineIndex) {
o << headingError << "\t"; o << headingError << "\t";
o << hdg << "\t"; o << hdg << "\t";
o << tgt_heading << "\t"; o << tgt_heading << "\t";
o << tgt_speed << "\t";
o << minBearing << "\t"; o << minBearing << "\t";
o << speedFraction << "\t"; o << speedFraction << "\t";
o << groundOffset << "\t"; o << groundOffset << "\t";

View file

@ -535,6 +535,7 @@ void FGAIFlightPlan::pushBackWaypoint(FGAIWaypoint *wpt)
size_t pos = wpt_iterator - waypoints.begin(); size_t pos = wpt_iterator - waypoints.begin();
waypoints.push_back(wpt); waypoints.push_back(wpt);
wpt_iterator = waypoints.begin() + pos; wpt_iterator = waypoints.begin() + pos;
SG_LOG(SG_AI, SG_BULK, "Added WP : \t" << wpt->getName() << "\t" << wpt->getPos());
} }
// Start flightplan over from the beginning // Start flightplan over from the beginning

View file

@ -188,7 +188,10 @@ public:
bool createPushBack(FGAIAircraft *, bool, FGAirport*, double radius, const std::string&, const std::string&, const std::string&); bool createPushBack(FGAIAircraft *, bool, FGAirport*, double radius, const std::string&, const std::string&, const std::string&);
bool createTakeOff(FGAIAircraft *, bool, FGAirport *, double, const std::string&); bool createTakeOff(FGAIAircraft *, bool, FGAirport *, double, const std::string&);
void setLeg(int val) { leg = val;} void setLeg(int val) {
SG_LOG(SG_AI, SG_BULK, "Set Leg " << leg);
leg = val;
}
void setTime(time_t st) { start_time = st; } void setTime(time_t st) { start_time = st; }
@ -205,7 +208,10 @@ public:
const std::string& getRunway() { return activeRunway; } const std::string& getRunway() { return activeRunway; }
bool isActive(time_t time) {return time >= this->getStartTime();} bool isActive(time_t time) {return time >= this->getStartTime();}
void incrementLeg() { leg++;}; void incrementLeg() {
SG_LOG(SG_AI, SG_BULK, "Increment Leg " << leg);
leg++;
};
void setRunway(const std::string& rwy) { activeRunway = rwy; }; void setRunway(const std::string& rwy) { activeRunway = rwy; };
const char* getRunwayClassFromTrafficType(const std::string& fltType); const char* getRunwayClassFromTrafficType(const std::string& fltType);

View file

@ -68,17 +68,13 @@ bool FGAIFlightPlan::create(FGAIAircraft * ac, FGAirport * dep,
const string & aircraftType, const string & aircraftType,
const string & airline, double distance) const string & airline, double distance)
{ {
SG_LOG(SG_AI, SG_BULK, "Create Leg " << legNr << " " << (firstFlight?"First":"") << " Old Leg " << getLeg() << " Departure Airport : " << dep->getId());
bool retVal = true; bool retVal = true;
int currWpt = wpt_iterator - waypoints.begin(); int currWpt = wpt_iterator - waypoints.begin();
switch (legNr) { switch (legNr) {
case 1: case 1:
retVal = createPushBack(ac, firstFlight, dep, retVal = createPushBack(ac, firstFlight, dep,
radius, fltType, aircraftType, airline); radius, fltType, aircraftType, airline);
// Pregenerate the taxi leg.
//if (retVal) {
// waypoints.back()->setName( waypoints.back()->getName() + string("legend"));
// retVal = createTakeoffTaxi(ac, false, dep, radius, fltType, aircraftType, airline);
//}
break; break;
case 2: case 2:
retVal = createTakeoffTaxi(ac, firstFlight, dep, radius, fltType, retVal = createTakeoffTaxi(ac, firstFlight, dep, radius, fltType,
@ -121,9 +117,6 @@ bool FGAIFlightPlan::create(FGAIAircraft * ac, FGAirport * dep,
waypoints.back()->setName( waypoints.back()->getName() + string("legend")); waypoints.back()->setName( waypoints.back()->getName() + string("legend"));
// "It's pronounced Leg-end" (Roger Glover (Deep Purple): come Hell or High Water DvD, 1993) // "It's pronounced Leg-end" (Roger Glover (Deep Purple): come Hell or High Water DvD, 1993)
} }
//leg++;
return retVal; return retVal;
} }
@ -280,6 +273,7 @@ bool FGAIFlightPlan::createTakeoffTaxi(FGAIAircraft * ac, bool firstFlight,
depHeading); depHeading);
} }
FGRunway * rwy = apt->getRunwayByIdent(activeRunway); FGRunway * rwy = apt->getRunwayByIdent(activeRunway);
SG_LOG(SG_AI, SG_BULK, "Taxi to " << apt->getId() << "/" << activeRunway);
assert( rwy != NULL ); assert( rwy != NULL );
SGGeod runwayTakeoff = rwy->pointOnCenterline(5.0); SGGeod runwayTakeoff = rwy->pointOnCenterline(5.0);
@ -369,12 +363,12 @@ bool FGAIFlightPlan::createTakeoffTaxi(FGAIAircraft * ac, bool firstFlight,
if (taxiRoute.nodesLeft() == 1) { if (taxiRoute.nodesLeft() == 1) {
// Note that we actually have hold points in the ground network, but this is just an initial test. // Note that we actually have hold points in the ground network, but this is just an initial test.
//cerr << "Setting departurehold point: " << endl; //cerr << "Setting departurehold point: " << endl;
wpt->setName( wpt->getName() + string("DepartureHold")); wpt->setName( wpt->getName() + string("_DepartureHold"));
wpt->setFlaps(0.5f); wpt->setFlaps(0.5f);
wpt->setTakeOffLights(); wpt->setTakeOffLights();
} }
if (taxiRoute.nodesLeft() == 0) { if (taxiRoute.nodesLeft() == 0) {
wpt->setName(wpt->getName() + string("Accel")); wpt->setName(wpt->getName() + string("_Accel"));
wpt->setTakeOffLights(); wpt->setTakeOffLights();
wpt->setFlaps(0.5f); wpt->setFlaps(0.5f);
} }
@ -424,7 +418,6 @@ bool FGAIFlightPlan::createLandingTaxi(FGAIAircraft * ac, FGAirport * apt,
int route; int route;
gate = apt->getDynamics()->getAvailableParking(radius, fltType, gate = apt->getDynamics()->getAvailableParking(radius, fltType,
acType, airline); acType, airline);
SGGeod lastWptPos = waypoints.back()->getPos(); SGGeod lastWptPos = waypoints.back()->getPos();
FGGroundNetwork *gn = apt->groundNetwork(); FGGroundNetwork *gn = apt->groundNetwork();
@ -470,6 +463,8 @@ bool FGAIFlightPlan::createLandingTaxi(FGAIAircraft * ac, FGAirport * apt,
wpt->setRouteIndex(route); wpt->setRouteIndex(route);
pushBackWaypoint(wpt); pushBackWaypoint(wpt);
} }
SG_LOG(SG_AI, SG_BULK, "Created taxi to " << gate.parking()->ident() << " at " << apt->getId());
return true; return true;
} }
@ -504,6 +499,7 @@ bool FGAIFlightPlan::createTakeOff(FGAIAircraft * ac, bool firstFlight,
FGAirport * apt, double speed, FGAirport * apt, double speed,
const string & fltType) const string & fltType)
{ {
SG_LOG(SG_AI, SG_BULK, "createTakeOff " << apt->getId() << "/" << activeRunway);
const double ACCEL_POINT = 105.0; const double ACCEL_POINT = 105.0;
// climb-out angle in degrees. could move this to the perf-db but this // climb-out angle in degrees. could move this to the perf-db but this
// value is pretty sane // value is pretty sane
@ -538,6 +534,7 @@ bool FGAIFlightPlan::createTakeOff(FGAIAircraft * ac, bool firstFlight,
SG_LOG(SG_AI, SG_WARN, "FGAIFlightPlan::createTakeOff: invalid active runway:" << activeRunway); SG_LOG(SG_AI, SG_WARN, "FGAIFlightPlan::createTakeOff: invalid active runway:" << activeRunway);
return false; return false;
} }
SG_LOG(SG_AI, SG_BULK, "Takeoff from airport " << apt->getId() << "/" << activeRunway);
FGRunway * rwy = apt->getRunwayByIdent(activeRunway); FGRunway * rwy = apt->getRunwayByIdent(activeRunway);
if (!rwy) if (!rwy)
@ -931,6 +928,7 @@ bool FGAIFlightPlan::createDescent(FGAIAircraft * ac, FGAirport * apt,
//cerr << "Repositioning to waypoint " << (*waypoints.begin())->name << endl; //cerr << "Repositioning to waypoint " << (*waypoints.begin())->name << endl;
ac->resetPositionFromFlightPlan(); ac->resetPositionFromFlightPlan();
} }
SG_LOG(SG_AI, SG_BULK, "Setting Node " << waypoints[1]->getName() << " to a leg end");
waypoints[1]->setName( (waypoints[1]->getName() + string("legend"))); waypoints[1]->setName( (waypoints[1]->getName() + string("legend")));
return true; return true;
} }

View file

@ -66,7 +66,7 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac,
// establish the parking position / gate if required // establish the parking position / gate if required
if (firstFlight) { if (firstFlight) {
// if the airprot has no parking positions defined, don't log // if the airport has no parking positions defined, don't log
// the warning below. // the warning below.
if (!dep->getDynamics()->hasParkings()) { if (!dep->getDynamics()->hasParkings()) {
return false; return false;
@ -127,6 +127,7 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac,
//previous = node; //previous = node;
} }
// some special considerations for the last point: // some special considerations for the last point:
// This will trigger the release of parking
waypoints.back()->setName(string("PushBackPoint")); waypoints.back()->setName(string("PushBackPoint"));
waypoints.back()->setSpeed(vTaxi); waypoints.back()->setSpeed(vTaxi);
ac->setTaxiClearanceRequest(true); ac->setTaxiClearanceRequest(true);
@ -138,9 +139,8 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac,
if (!pushForwardSegment) { if (!pushForwardSegment) {
// there aren't any routes for this parking, so create a simple segment straight ahead for 2 meters based on the parking heading // there aren't any routes for this parking, so create a simple segment straight ahead for 2 meters based on the parking heading
SG_LOG(SG_AI, SG_DEV_WARN, "Gate " << parking->ident() << "/" << parking->getName() SG_LOG(SG_AI, SG_DEV_WARN, "Gate " << parking->ident() << " at " << dep->getId()
<< " at " << dep->getId() << " doesn't seem to have pushforward routes associated with it.");
<< " doesn't seem to have routes associated with it.");
FGAIWaypoint *wpt = createOnGround(ac, string("park"), dep->geod(), dep->getElevation(), vTaxiReduced); FGAIWaypoint *wpt = createOnGround(ac, string("park"), dep->geod(), dep->getElevation(), vTaxiReduced);
pushBackWaypoint(wpt); pushBackWaypoint(wpt);
@ -159,7 +159,7 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac,
SG_LOG(SG_AI, SG_BULK, "Creating Pushforward : \t" << pushForwardSegment->getEnd()->getIndex() << " Length : \t" << distance); SG_LOG(SG_AI, SG_BULK, "Creating Pushforward : \t" << pushForwardSegment->getEnd()->getIndex() << " Length : \t" << distance);
int numSegments = distance/3.0; int numSegments = distance/2.0;
for (int i = 1; i < numSegments; i++) { for (int i = 1; i < numSegments; i++) {
SGGeod pushForwardPt; SGGeod pushForwardPt;
SGGeodesy::direct(parking->geod(), parkingHeading, SGGeodesy::direct(parking->geod(), parkingHeading,
@ -167,14 +167,13 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac,
char buffer[16]; char buffer[16];
snprintf(buffer, 16, "pushforward-%02d", i); snprintf(buffer, 16, "pushforward-%02d", i);
FGAIWaypoint *wpt = createOnGround(ac, string(buffer), pushForwardPt, dep->getElevation(), vTaxiReduced); FGAIWaypoint *wpt = createOnGround(ac, string(buffer), pushForwardPt, dep->getElevation(), vTaxiReduced);
SG_LOG(SG_AI, SG_BULK, "Created WP : \t" << wpt->getName() << "\t" << wpt->getPos());
wpt->setRouteIndex(pushForwardSegment->getIndex()); wpt->setRouteIndex(pushForwardSegment->getIndex());
pushBackWaypoint(wpt); pushBackWaypoint(wpt);
} }
waypoints.back()->setName(string("PushBackPoint")); // This will trigger the release of parking
// cerr << "Done assinging new name" << endl; waypoints.back()->setName(string("PushBackPoint-pushforward"));
} }
return true; return true;