Logging for createPushBack, FlightPlan
createPushBack Logging
This commit is contained in:
parent
986d061004
commit
bd96c767d5
5 changed files with 34 additions and 28 deletions
|
@ -519,7 +519,7 @@ const char * FGAIAircraft::_getTransponderCode() const {
|
|||
bool FGAIAircraft::loadNextLeg(double distance) {
|
||||
|
||||
int leg;
|
||||
if ((leg = fp->getLeg()) == 9) {
|
||||
if ((leg = fp->getLeg()) == 9) {
|
||||
if (!trafficRef->next()) {
|
||||
//FIXME I'm on leg 9 and don't even reach parking.
|
||||
return false;
|
||||
|
@ -1466,6 +1466,7 @@ void FGAIAircraft::dumpCSVHeader(std::ofstream& o) {
|
|||
o << "headingErr\t";
|
||||
o << "hdg\t";
|
||||
o << "tgt_heading\t";
|
||||
o << "tgt_speed\t";
|
||||
o << "minBearing\t";
|
||||
o << "speedFraction\t";
|
||||
o << "groundOffset\t";
|
||||
|
@ -1494,6 +1495,7 @@ void FGAIAircraft::dumpCSV(std::ofstream& o, int lineIndex) {
|
|||
o << headingError << "\t";
|
||||
o << hdg << "\t";
|
||||
o << tgt_heading << "\t";
|
||||
o << tgt_speed << "\t";
|
||||
o << minBearing << "\t";
|
||||
o << speedFraction << "\t";
|
||||
o << groundOffset << "\t";
|
||||
|
|
|
@ -535,6 +535,7 @@ void FGAIFlightPlan::pushBackWaypoint(FGAIWaypoint *wpt)
|
|||
size_t pos = wpt_iterator - waypoints.begin();
|
||||
waypoints.push_back(wpt);
|
||||
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
|
||||
|
|
|
@ -188,7 +188,10 @@ public:
|
|||
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&);
|
||||
|
||||
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; }
|
||||
|
||||
|
||||
|
@ -205,7 +208,10 @@ public:
|
|||
const std::string& getRunway() { return activeRunway; }
|
||||
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; };
|
||||
const char* getRunwayClassFromTrafficType(const std::string& fltType);
|
||||
|
|
|
@ -68,20 +68,16 @@ 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());
|
||||
bool retVal = true;
|
||||
int currWpt = wpt_iterator - waypoints.begin();
|
||||
switch (legNr) {
|
||||
case 1:
|
||||
retVal = createPushBack(ac, firstFlight, dep,
|
||||
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;
|
||||
case 2:
|
||||
retVal = createTakeoffTaxi(ac, firstFlight, dep, radius, fltType,
|
||||
retVal = createTakeoffTaxi(ac, firstFlight, dep, radius, fltType,
|
||||
aircraftType, airline);
|
||||
break;
|
||||
case 3:
|
||||
|
@ -105,7 +101,7 @@ bool FGAIFlightPlan::create(FGAIAircraft * ac, FGAirport * dep,
|
|||
retVal = createLandingTaxi(ac, arr, radius, fltType, aircraftType, airline);
|
||||
break;
|
||||
case 9:
|
||||
retVal = createParking(ac, arr, radius);
|
||||
retVal = createParking(ac, arr, radius);
|
||||
break;
|
||||
default:
|
||||
//exit(1);
|
||||
|
@ -117,13 +113,10 @@ bool FGAIFlightPlan::create(FGAIAircraft * ac, FGAirport * dep,
|
|||
wpt_iterator = waypoints.begin() + currWpt;
|
||||
//don't increment leg right away, but only once we pass the actual last waypoint that was created.
|
||||
// to do so, mark the last waypoint with a special status flag
|
||||
if (retVal) {
|
||||
if (retVal) {
|
||||
waypoints.back()->setName( waypoints.back()->getName() + string("legend"));
|
||||
// "It's pronounced Leg-end" (Roger Glover (Deep Purple): come Hell or High Water DvD, 1993)
|
||||
}
|
||||
|
||||
|
||||
//leg++;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
@ -280,6 +273,7 @@ bool FGAIFlightPlan::createTakeoffTaxi(FGAIAircraft * ac, bool firstFlight,
|
|||
depHeading);
|
||||
}
|
||||
FGRunway * rwy = apt->getRunwayByIdent(activeRunway);
|
||||
SG_LOG(SG_AI, SG_BULK, "Taxi to " << apt->getId() << "/" << activeRunway);
|
||||
assert( rwy != NULL );
|
||||
SGGeod runwayTakeoff = rwy->pointOnCenterline(5.0);
|
||||
|
||||
|
@ -369,12 +363,12 @@ bool FGAIFlightPlan::createTakeoffTaxi(FGAIAircraft * ac, bool firstFlight,
|
|||
if (taxiRoute.nodesLeft() == 1) {
|
||||
// Note that we actually have hold points in the ground network, but this is just an initial test.
|
||||
//cerr << "Setting departurehold point: " << endl;
|
||||
wpt->setName( wpt->getName() + string("DepartureHold"));
|
||||
wpt->setName( wpt->getName() + string("_DepartureHold"));
|
||||
wpt->setFlaps(0.5f);
|
||||
wpt->setTakeOffLights();
|
||||
}
|
||||
if (taxiRoute.nodesLeft() == 0) {
|
||||
wpt->setName(wpt->getName() + string("Accel"));
|
||||
wpt->setName(wpt->getName() + string("_Accel"));
|
||||
wpt->setTakeOffLights();
|
||||
wpt->setFlaps(0.5f);
|
||||
}
|
||||
|
@ -423,8 +417,7 @@ bool FGAIFlightPlan::createLandingTaxi(FGAIAircraft * ac, FGAirport * apt,
|
|||
{
|
||||
int route;
|
||||
gate = apt->getDynamics()->getAvailableParking(radius, fltType,
|
||||
acType, airline);
|
||||
|
||||
acType, airline);
|
||||
SGGeod lastWptPos = waypoints.back()->getPos();
|
||||
FGGroundNetwork *gn = apt->groundNetwork();
|
||||
|
||||
|
@ -470,6 +463,8 @@ bool FGAIFlightPlan::createLandingTaxi(FGAIAircraft * ac, FGAirport * apt,
|
|||
wpt->setRouteIndex(route);
|
||||
pushBackWaypoint(wpt);
|
||||
}
|
||||
SG_LOG(SG_AI, SG_BULK, "Created taxi to " << gate.parking()->ident() << " at " << apt->getId());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -504,6 +499,7 @@ bool FGAIFlightPlan::createTakeOff(FGAIAircraft * ac, bool firstFlight,
|
|||
FGAirport * apt, double speed,
|
||||
const string & fltType)
|
||||
{
|
||||
SG_LOG(SG_AI, SG_BULK, "createTakeOff " << apt->getId() << "/" << activeRunway);
|
||||
const double ACCEL_POINT = 105.0;
|
||||
// climb-out angle in degrees. could move this to the perf-db but this
|
||||
// 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);
|
||||
return false;
|
||||
}
|
||||
SG_LOG(SG_AI, SG_BULK, "Takeoff from airport " << apt->getId() << "/" << activeRunway);
|
||||
|
||||
FGRunway * rwy = apt->getRunwayByIdent(activeRunway);
|
||||
if (!rwy)
|
||||
|
@ -931,6 +928,7 @@ bool FGAIFlightPlan::createDescent(FGAIAircraft * ac, FGAirport * apt,
|
|||
//cerr << "Repositioning to waypoint " << (*waypoints.begin())->name << endl;
|
||||
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")));
|
||||
return true;
|
||||
}
|
||||
|
@ -1081,7 +1079,7 @@ bool FGAIFlightPlan::createParking(FGAIAircraft * ac, FGAirport * apt,
|
|||
pushBackWaypoint(wpt);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
FGParking* parking = gate.parking();
|
||||
double heading = SGMiscd::normalizePeriodic(0, 360, parking->getHeading() + 180.0);
|
||||
double az; // unused
|
||||
|
|
|
@ -66,7 +66,7 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac,
|
|||
|
||||
// establish the parking position / gate if required
|
||||
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.
|
||||
if (!dep->getDynamics()->hasParkings()) {
|
||||
return false;
|
||||
|
@ -127,6 +127,7 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac,
|
|||
//previous = node;
|
||||
}
|
||||
// some special considerations for the last point:
|
||||
// This will trigger the release of parking
|
||||
waypoints.back()->setName(string("PushBackPoint"));
|
||||
waypoints.back()->setSpeed(vTaxi);
|
||||
ac->setTaxiClearanceRequest(true);
|
||||
|
@ -138,9 +139,8 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac,
|
|||
|
||||
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
|
||||
SG_LOG(SG_AI, SG_DEV_WARN, "Gate " << parking->ident() << "/" << parking->getName()
|
||||
<< " at " << dep->getId()
|
||||
<< " doesn't seem to have routes associated with it.");
|
||||
SG_LOG(SG_AI, SG_DEV_WARN, "Gate " << parking->ident() << " at " << dep->getId()
|
||||
<< " doesn't seem to have pushforward routes associated with it.");
|
||||
|
||||
FGAIWaypoint *wpt = createOnGround(ac, string("park"), dep->geod(), dep->getElevation(), vTaxiReduced);
|
||||
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);
|
||||
|
||||
int numSegments = distance/3.0;
|
||||
int numSegments = distance/2.0;
|
||||
for (int i = 1; i < numSegments; i++) {
|
||||
SGGeod pushForwardPt;
|
||||
SGGeodesy::direct(parking->geod(), parkingHeading,
|
||||
|
@ -167,14 +167,13 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac,
|
|||
char buffer[16];
|
||||
snprintf(buffer, 16, "pushforward-%02d", i);
|
||||
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());
|
||||
pushBackWaypoint(wpt);
|
||||
}
|
||||
|
||||
waypoints.back()->setName(string("PushBackPoint"));
|
||||
// cerr << "Done assinging new name" << endl;
|
||||
// This will trigger the release of parking
|
||||
waypoints.back()->setName(string("PushBackPoint-pushforward"));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue