* A new algorithm for determining hold position instructions. This version still needs some finetuning, but already appears to be more solid than the old version.
* Some tweaks to the traffic scheduling algorithm. * Misc cleanup.
This commit is contained in:
parent
ab84ff5904
commit
4640f5bb02
9 changed files with 1301 additions and 878 deletions
|
@ -773,10 +773,10 @@ bool FGAIAircraft::leadPointReached(FGAIWaypoint* curr) {
|
|||
}
|
||||
if (trafficRef) {
|
||||
//cerr << "Tracking callsign : \"" << fgGetString("/ai/track-callsign") << "\"" << endl;
|
||||
/* if (trafficRef->getCallSign() == fgGetString("/ai/track-callsign")) {
|
||||
if (trafficRef->getCallSign() == fgGetString("/ai/track-callsign")) {
|
||||
cerr << trafficRef->getCallSign() << " " << tgt_altitude_ft << " " << _getSpeed() << " "
|
||||
<< _getAltitude() << " "<< _getLatitude() << " " << _getLongitude() << " " << dist_to_go << " " << lead_dist << " " << curr->name << " " << vs << " " << tgt_vs << " " << bearing << " " << minBearing << " " << speedFraction << endl;
|
||||
}*/
|
||||
<< _getAltitude() << " "<< _getLatitude() << " " << _getLongitude() << " " << dist_to_go << " " << lead_dist << " " << curr->getName() << " " << vs << " " << tgt_vs << " " << bearing << " " << minBearing << " " << speedFraction << " " << invisible << endl;
|
||||
}
|
||||
}
|
||||
if ((dist_to_go < lead_dist) || (bearing > (minBearing * 1.1))) {
|
||||
minBearing = 360;
|
||||
|
@ -1223,20 +1223,20 @@ bool FGAIAircraft::reachedEndOfCruise(double &distance) {
|
|||
double distanceCovered = descentSpeed * descentTimeNeeded;
|
||||
|
||||
//cerr << "Tracking : " << fgGetString("/ai/track-callsign");
|
||||
if (trafficRef->getCallSign() == fgGetString("/ai/track-callsign")) {
|
||||
cerr << "Checking for end of cruise stage for :" << trafficRef->getCallSign() << endl;
|
||||
cerr << "Descent rate : " << descentRate << endl;
|
||||
cerr << "Descent speed : " << descentSpeed << endl;
|
||||
cerr << "VerticalDistance : " << verticalDistance << ". Altitude : " << altitude_ft << ". Elevation " << trafficRef->getArrivalAirport()->getElevation() << endl;
|
||||
cerr << "DecentTimeNeeded : " << descentTimeNeeded << endl;
|
||||
cerr << "DistanceCovered : " << distanceCovered << endl;
|
||||
}
|
||||
// if (trafficRef->getCallSign() == fgGetString("/ai/track-callsign")) {
|
||||
// cerr << "Checking for end of cruise stage for :" << trafficRef->getCallSign() << endl;
|
||||
// cerr << "Descent rate : " << descentRate << endl;
|
||||
// cerr << "Descent speed : " << descentSpeed << endl;
|
||||
// cerr << "VerticalDistance : " << verticalDistance << ". Altitude : " << altitude_ft << ". Elevation " << trafficRef->getArrivalAirport()->getElevation() << endl;
|
||||
// cerr << "DecentTimeNeeded : " << descentTimeNeeded << endl;
|
||||
// cerr << "DistanceCovered : " << distanceCovered << endl;
|
||||
// }
|
||||
//cerr << "Distance = " << distance << endl;
|
||||
distance = distanceCovered;
|
||||
if (dist < distanceCovered) {
|
||||
if (trafficRef->getCallSign() == fgGetString("/ai/track-callsign")) {
|
||||
//exit(1);
|
||||
}
|
||||
// if (trafficRef->getCallSign() == fgGetString("/ai/track-callsign")) {
|
||||
// //exit(1);
|
||||
// }
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -1290,8 +1290,8 @@ time_t FGAIAircraft::checkForArrivalTime(string wptName) {
|
|||
|
||||
time_t ete = tracklength / ((speed * SG_NM_TO_METER) / 3600.0);
|
||||
time_t secondsToGo = arrivalTime - now;
|
||||
if (trafficRef->getCallSign() == fgGetString("/ai/track-callsign")) {
|
||||
cerr << "Checking arrival time: ete " << ete << ". Time to go : " << secondsToGo << ". Track length = " << tracklength << endl;
|
||||
}
|
||||
// if (trafficRef->getCallSign() == fgGetString("/ai/track-callsign")) {
|
||||
// cerr << "Checking arrival time: ete " << ete << ". Time to go : " << secondsToGo << ". Track length = " << tracklength << endl;
|
||||
// }
|
||||
return (ete - secondsToGo); // Positive when we're too slow...
|
||||
}
|
||||
|
|
|
@ -62,6 +62,11 @@ bool FGAIFlightPlan::create(FGAIAircraft * ac, FGAirport * dep,
|
|||
case 1:
|
||||
retVal = createPushBack(ac, firstFlight, dep, latitude, longitude,
|
||||
radius, fltType, aircraftType, airline);
|
||||
// Pregenerate the
|
||||
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,
|
||||
|
|
|
@ -247,5 +247,7 @@ void FGATCManager::update ( double time ) {
|
|||
//cerr << "Adding groundnetWork to the scenegraph::update" << endl;
|
||||
prevController = controller;
|
||||
}
|
||||
//globals->get_scenery()->get_scene_graph()->addChild(node);
|
||||
for (AtcVecIterator atc = activeStations.begin(); atc != activeStations.end(); atc++) {
|
||||
(*atc)->update(time);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,13 +144,15 @@ time_t ActiveRunway::requestTimeSlot(time_t eta)
|
|||
* FGTrafficRecord
|
||||
**************************************************************************/
|
||||
FGTrafficRecord::FGTrafficRecord():
|
||||
id(0), waitsForId(0),
|
||||
currentPos(0),
|
||||
leg(0),
|
||||
frequencyId(0),
|
||||
state(0),
|
||||
allowTransmission(true),
|
||||
latitude(0), longitude(0), heading(0), speed(0), altitude(0), radius(0)
|
||||
id(0), waitsForId(0),
|
||||
currentPos(0),
|
||||
leg(0),
|
||||
frequencyId(0),
|
||||
state(0),
|
||||
allowTransmission(true),
|
||||
allowPushback(true),
|
||||
priority(0),
|
||||
latitude(0), longitude(0), heading(0), speed(0), altitude(0), radius(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -400,6 +402,14 @@ bool FGTrafficRecord::isOpposing(FGGroundNetwork * net,
|
|||
return false;
|
||||
}
|
||||
|
||||
bool FGTrafficRecord::isActive(int margin)
|
||||
{
|
||||
time_t now = time(NULL) + fgGetLong("/sim/time/warp");
|
||||
time_t deptime = aircraft->getTrafficRef()->getDepartureTime();
|
||||
return ((now + margin) > deptime);
|
||||
}
|
||||
|
||||
|
||||
void FGTrafficRecord::setSpeedAdjustment(double spd)
|
||||
{
|
||||
instruction.setChangeSpeed(true);
|
||||
|
@ -414,31 +424,12 @@ void FGTrafficRecord::setHeadingAdjustment(double heading)
|
|||
|
||||
bool FGTrafficRecord::pushBackAllowed()
|
||||
{
|
||||
// With the user ATC / AI integration, checking whether the user's aircraft is near no longer works, because
|
||||
// this will effectively block the user's aircraft itself from receiving pushback clearance.
|
||||
// So, what can we do?
|
||||
/*
|
||||
double course, az2, dist;
|
||||
SGGeod curr(SGGeod::fromDegM(getLongitude(),
|
||||
getLatitude(), getAltitude()));
|
||||
|
||||
double userLatitude = fgGetDouble("/position/latitude-deg");
|
||||
double userLongitude = fgGetDouble("/position/longitude-deg");
|
||||
SGGeod user(SGGeod::fromDeg(userLongitude, userLatitude));
|
||||
SGGeodesy::inverse(curr, user, course, az2, dist);
|
||||
//cerr << "Distance to user : " << dist << endl;
|
||||
return (dist > 250);
|
||||
*/
|
||||
|
||||
|
||||
// In essence, we should check whether the pusbback route itself, as well as the associcated
|
||||
// taxiways near the pushback point are free of traffic.
|
||||
// To do so, we need to
|
||||
return true;
|
||||
return allowPushback;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* FGATCInstruction
|
||||
*
|
||||
|
@ -770,7 +761,7 @@ void FGATCController::init()
|
|||
*
|
||||
**************************************************************************/
|
||||
FGTowerController::FGTowerController(FGAirportDynamics *par) :
|
||||
FGATCController()
|
||||
FGATCController()
|
||||
{
|
||||
parent = par;
|
||||
}
|
||||
|
@ -899,6 +890,8 @@ void FGTowerController::updateAircraftInformation(int id, double lat, double lon
|
|||
rwy->setCleared(id);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1006,6 +999,11 @@ string FGTowerController::getName() {
|
|||
return string(parent->getId() + "-tower");
|
||||
}
|
||||
|
||||
void FGTowerController::update(double dt)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -1285,6 +1283,7 @@ void FGStartupController::render(bool visible)
|
|||
//for ( FGTaxiSegmentVectorIterator i = segments.begin(); i != segments.end(); i++) {
|
||||
double dx = 0;
|
||||
for (TrafficVectorIterator i = activeTraffic.begin(); i != activeTraffic.end(); i++) {
|
||||
if (i->isActive(300)) {
|
||||
// Handle start point
|
||||
int pos = i->getCurrentPosition();
|
||||
//cerr << "rendering for " << i->getAircraft()->getCallSign() << "pos = " << pos << endl;
|
||||
|
@ -1312,7 +1311,7 @@ void FGStartupController::render(bool visible)
|
|||
if (isUserAircraft((i)->getAircraft())) {
|
||||
elevationStart = fgGetDouble("/position/ground-elev-m");
|
||||
} else {
|
||||
elevationStart = ((i)->getAircraft()->_getAltitude());
|
||||
elevationStart = ((i)->getAircraft()->_getAltitude() * SG_FEET_TO_METER);
|
||||
}
|
||||
double elevationEnd = segment->getEnd()->getElevation();
|
||||
if ((elevationEnd == 0) || (elevationEnd == parent->getElevation())) {
|
||||
|
@ -1335,8 +1334,8 @@ void FGStartupController::render(bool visible)
|
|||
|
||||
//cerr << "1. Using mean elevation : " << elevationMean << " and " << slope << endl;
|
||||
|
||||
WorldCoordinate( obj_pos, center.getLatitudeDeg(), center.getLongitudeDeg(), elevationMean + 0.5, -(heading), slope );
|
||||
;
|
||||
WorldCoordinate( obj_pos, center.getLatitudeDeg(), center.getLongitudeDeg(), elevationMean + 0.5 + dx, -(heading), slope );
|
||||
;
|
||||
|
||||
obj_trans->setMatrix( obj_pos );
|
||||
//osg::Vec3 center(0, 0, 0)
|
||||
|
@ -1351,7 +1350,12 @@ void FGStartupController::render(bool visible)
|
|||
geode->setName("test");
|
||||
geode->addDrawable(geometry);
|
||||
//osg::Node *custom_obj;
|
||||
SGMaterial *mat = matlib->find("UnidirectionalTaper");
|
||||
SGMaterial *mat;
|
||||
if (segment->hasBlock()) {
|
||||
mat = matlib->find("UnidirectionalTaperRed");
|
||||
} else {
|
||||
mat = matlib->find("UnidirectionalTaperGreen");
|
||||
}
|
||||
if (mat)
|
||||
geode->setEffect(mat->get_effect());
|
||||
obj_trans->addChild(geode);
|
||||
|
@ -1362,7 +1366,7 @@ void FGStartupController::render(bool visible)
|
|||
} else {
|
||||
//cerr << "BIG FAT WARNING: current position is here : " << pos << endl;
|
||||
}
|
||||
for(intVecIterator j = (i)->getIntentions().begin(); j != (i)->getIntentions().end(); j++) {
|
||||
for (intVecIterator j = (i)->getIntentions().begin(); j != (i)->getIntentions().end(); j++) {
|
||||
osg::Matrix obj_pos;
|
||||
int k = (*j);
|
||||
if (k > 0) {
|
||||
|
@ -1406,7 +1410,7 @@ void FGStartupController::render(bool visible)
|
|||
//cerr << "2. Using mean elevation : " << elevationMean << " and " << slope << endl;
|
||||
|
||||
|
||||
WorldCoordinate( obj_pos, segment->getLatitude(), segment->getLongitude(), elevationMean + 0.5, -(segment->getHeading()), slope );
|
||||
WorldCoordinate( obj_pos, segment->getLatitude(), segment->getLongitude(), elevationMean + 0.5 + dx, -(segment->getHeading()), slope );
|
||||
|
||||
//WorldCoordinate( obj_pos, segment->getLatitude(), segment->getLongitude(), parent->getElevation()+8+dx, -(segment->getHeading()) );
|
||||
|
||||
|
@ -1423,7 +1427,12 @@ void FGStartupController::render(bool visible)
|
|||
geode->setName("test");
|
||||
geode->addDrawable(geometry);
|
||||
//osg::Node *custom_obj;
|
||||
SGMaterial *mat = matlib->find("UnidirectionalTaper");
|
||||
SGMaterial *mat;
|
||||
if (segment->hasBlock()) {
|
||||
mat = matlib->find("UnidirectionalTaperRed");
|
||||
} else {
|
||||
mat = matlib->find("UnidirectionalTaperGreen");
|
||||
}
|
||||
if (mat)
|
||||
geode->setEffect(mat->get_effect());
|
||||
obj_trans->addChild(geode);
|
||||
|
@ -1434,7 +1443,8 @@ void FGStartupController::render(bool visible)
|
|||
//cerr << "BIG FAT WARNING: k is here : " << pos << endl;
|
||||
}
|
||||
}
|
||||
//dx += 0.1;
|
||||
dx += 0.2;
|
||||
}
|
||||
}
|
||||
globals->get_scenery()->get_scene_graph()->addChild(group);
|
||||
}
|
||||
|
@ -1444,13 +1454,19 @@ string FGStartupController::getName() {
|
|||
return string(parent->getId() + "-startup");
|
||||
}
|
||||
|
||||
void FGStartupController::update(double dt)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* class FGApproachController
|
||||
*
|
||||
**************************************************************************/
|
||||
FGApproachController::FGApproachController(FGAirportDynamics *par):
|
||||
FGATCController()
|
||||
FGATCController()
|
||||
{
|
||||
parent = par;
|
||||
}
|
||||
|
@ -1567,6 +1583,10 @@ void FGApproachController::signOff(int id)
|
|||
}
|
||||
}
|
||||
|
||||
void FGApproachController::update(double dt)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -38,11 +38,14 @@
|
|||
#include <simgear/structure/SGReferenced.hxx>
|
||||
#include <simgear/structure/SGSharedPtr.hxx>
|
||||
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::list;
|
||||
|
||||
|
||||
typedef vector<int> intVec;
|
||||
|
@ -76,29 +79,65 @@ public:
|
|||
|
||||
FGATCInstruction();
|
||||
bool hasInstruction ();
|
||||
bool getHoldPattern () { return holdPattern; };
|
||||
bool getHoldPosition () { return holdPosition; };
|
||||
bool getChangeSpeed () { return changeSpeed; };
|
||||
bool getChangeHeading () { return changeHeading; };
|
||||
bool getChangeAltitude() { return changeAltitude; };
|
||||
bool getHoldPattern () {
|
||||
return holdPattern;
|
||||
};
|
||||
bool getHoldPosition () {
|
||||
return holdPosition;
|
||||
};
|
||||
bool getChangeSpeed () {
|
||||
return changeSpeed;
|
||||
};
|
||||
bool getChangeHeading () {
|
||||
return changeHeading;
|
||||
};
|
||||
bool getChangeAltitude() {
|
||||
return changeAltitude;
|
||||
};
|
||||
|
||||
double getSpeed () { return speed; };
|
||||
double getHeading () { return heading; };
|
||||
double getAlt () { return alt; };
|
||||
double getSpeed () {
|
||||
return speed;
|
||||
};
|
||||
double getHeading () {
|
||||
return heading;
|
||||
};
|
||||
double getAlt () {
|
||||
return alt;
|
||||
};
|
||||
|
||||
bool getCheckForCircularWait() { return resolveCircularWait; };
|
||||
bool getCheckForCircularWait() {
|
||||
return resolveCircularWait;
|
||||
};
|
||||
|
||||
void setHoldPattern (bool val) { holdPattern = val; };
|
||||
void setHoldPosition (bool val) { holdPosition = val; };
|
||||
void setChangeSpeed (bool val) { changeSpeed = val; };
|
||||
void setChangeHeading (bool val) { changeHeading = val; };
|
||||
void setChangeAltitude(bool val) { changeAltitude = val; };
|
||||
void setHoldPattern (bool val) {
|
||||
holdPattern = val;
|
||||
};
|
||||
void setHoldPosition (bool val) {
|
||||
holdPosition = val;
|
||||
};
|
||||
void setChangeSpeed (bool val) {
|
||||
changeSpeed = val;
|
||||
};
|
||||
void setChangeHeading (bool val) {
|
||||
changeHeading = val;
|
||||
};
|
||||
void setChangeAltitude(bool val) {
|
||||
changeAltitude = val;
|
||||
};
|
||||
|
||||
void setResolveCircularWait (bool val) { resolveCircularWait = val; };
|
||||
void setResolveCircularWait (bool val) {
|
||||
resolveCircularWait = val;
|
||||
};
|
||||
|
||||
void setSpeed (double val) { speed = val; };
|
||||
void setHeading (double val) { heading = val; };
|
||||
void setAlt (double val) { alt = val; };
|
||||
void setSpeed (double val) {
|
||||
speed = val;
|
||||
};
|
||||
void setHeading (double val) {
|
||||
heading = val;
|
||||
};
|
||||
void setAlt (double val) {
|
||||
alt = val;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
@ -117,6 +156,8 @@ private:
|
|||
int frequencyId;
|
||||
int state;
|
||||
bool allowTransmission;
|
||||
bool allowPushback;
|
||||
int priority;
|
||||
time_t timer;
|
||||
intVec intentions;
|
||||
FGATCInstruction instruction;
|
||||
|
@ -129,70 +170,155 @@ private:
|
|||
public:
|
||||
FGTrafficRecord();
|
||||
|
||||
void setId(int val) { id = val; };
|
||||
void setRadius(double rad) { radius = rad;};
|
||||
void setId(int val) {
|
||||
id = val;
|
||||
};
|
||||
void setRadius(double rad) {
|
||||
radius = rad;
|
||||
};
|
||||
void setPositionAndIntentions(int pos, FGAIFlightPlan *route);
|
||||
void setRunway(string rwy) { runway = rwy;};
|
||||
void setLeg(int lg) { leg = lg;};
|
||||
int getId() { return id;};
|
||||
int getState() { return state;};
|
||||
void setState(int s) { state = s;}
|
||||
FGATCInstruction getInstruction() { return instruction;};
|
||||
bool hasInstruction() { return instruction.hasInstruction(); };
|
||||
void setRunway(string rwy) {
|
||||
runway = rwy;
|
||||
};
|
||||
void setLeg(int lg) {
|
||||
leg = lg;
|
||||
};
|
||||
int getId() {
|
||||
return id;
|
||||
};
|
||||
int getState() {
|
||||
return state;
|
||||
};
|
||||
void setState(int s) {
|
||||
state = s;
|
||||
}
|
||||
FGATCInstruction getInstruction() {
|
||||
return instruction;
|
||||
};
|
||||
bool hasInstruction() {
|
||||
return instruction.hasInstruction();
|
||||
};
|
||||
void setPositionAndHeading(double lat, double lon, double hdg, double spd, double alt);
|
||||
bool checkPositionAndIntentions(FGTrafficRecord &other);
|
||||
int crosses (FGGroundNetwork *, FGTrafficRecord &other);
|
||||
bool isOpposing (FGGroundNetwork *, FGTrafficRecord &other, int node);
|
||||
|
||||
bool isActive(int margin);
|
||||
|
||||
bool onRoute(FGGroundNetwork *, FGTrafficRecord &other);
|
||||
|
||||
bool getSpeedAdjustment() { return instruction.getChangeSpeed(); };
|
||||
bool getSpeedAdjustment() {
|
||||
return instruction.getChangeSpeed();
|
||||
};
|
||||
|
||||
double getLatitude () { return latitude ; };
|
||||
double getLongitude() { return longitude; };
|
||||
double getHeading () { return heading ; };
|
||||
double getSpeed () { return speed ; };
|
||||
double getAltitude () { return altitude ; };
|
||||
double getRadius () { return radius ; };
|
||||
double getLatitude () {
|
||||
return latitude ;
|
||||
};
|
||||
double getLongitude() {
|
||||
return longitude;
|
||||
};
|
||||
double getHeading () {
|
||||
return heading ;
|
||||
};
|
||||
double getSpeed () {
|
||||
return speed ;
|
||||
};
|
||||
double getAltitude () {
|
||||
return altitude ;
|
||||
};
|
||||
double getRadius () {
|
||||
return radius ;
|
||||
};
|
||||
|
||||
int getWaitsForId () { return waitsForId; };
|
||||
int getWaitsForId () {
|
||||
return waitsForId;
|
||||
};
|
||||
|
||||
void setSpeedAdjustment(double spd);
|
||||
void setHeadingAdjustment(double heading);
|
||||
void clearSpeedAdjustment () { instruction.setChangeSpeed (false); };
|
||||
void clearHeadingAdjustment() { instruction.setChangeHeading(false); };
|
||||
void clearSpeedAdjustment () {
|
||||
instruction.setChangeSpeed (false);
|
||||
};
|
||||
void clearHeadingAdjustment() {
|
||||
instruction.setChangeHeading(false);
|
||||
};
|
||||
|
||||
bool hasHeadingAdjustment() { return instruction.getChangeHeading(); };
|
||||
bool hasHoldPosition() { return instruction.getHoldPosition(); };
|
||||
void setHoldPosition (bool inst) { instruction.setHoldPosition(inst); };
|
||||
bool hasHeadingAdjustment() {
|
||||
return instruction.getChangeHeading();
|
||||
};
|
||||
bool hasHoldPosition() {
|
||||
return instruction.getHoldPosition();
|
||||
};
|
||||
void setHoldPosition (bool inst) {
|
||||
instruction.setHoldPosition(inst);
|
||||
};
|
||||
|
||||
void setWaitsForId(int id) { waitsForId = id; };
|
||||
void setWaitsForId(int id) {
|
||||
waitsForId = id;
|
||||
};
|
||||
|
||||
void setResolveCircularWait() { instruction.setResolveCircularWait(true); };
|
||||
void clearResolveCircularWait() { instruction.setResolveCircularWait(false); };
|
||||
void setResolveCircularWait() {
|
||||
instruction.setResolveCircularWait(true);
|
||||
};
|
||||
void clearResolveCircularWait() {
|
||||
instruction.setResolveCircularWait(false);
|
||||
};
|
||||
|
||||
string getRunway() { return runway; };
|
||||
string getRunway() {
|
||||
return runway;
|
||||
};
|
||||
//void setCallSign(string clsgn) { callsign = clsgn; };
|
||||
void setAircraft(FGAIAircraft *ref) { aircraft = ref;};
|
||||
void updateState() { state++; allowTransmission=true; };
|
||||
void setAircraft(FGAIAircraft *ref) {
|
||||
aircraft = ref;
|
||||
};
|
||||
void updateState() {
|
||||
state++;
|
||||
allowTransmission=true;
|
||||
};
|
||||
//string getCallSign() { return callsign; };
|
||||
FGAIAircraft *getAircraft() { return aircraft;};
|
||||
int getTime() { return timer; };
|
||||
int getLeg() { return leg; };
|
||||
void setTime(time_t time) { timer = time; };
|
||||
FGAIAircraft *getAircraft() {
|
||||
return aircraft;
|
||||
};
|
||||
int getTime() {
|
||||
return timer;
|
||||
};
|
||||
int getLeg() {
|
||||
return leg;
|
||||
};
|
||||
void setTime(time_t time) {
|
||||
timer = time;
|
||||
};
|
||||
|
||||
bool pushBackAllowed();
|
||||
bool allowTransmissions() { return allowTransmission; };
|
||||
void suppressRepeatedTransmissions () { allowTransmission=false; };
|
||||
void allowRepeatedTransmissions () { allowTransmission=true; };
|
||||
void nextFrequency() { frequencyId++; };
|
||||
int getNextFrequency() { return frequencyId; };
|
||||
intVec& getIntentions() { return intentions; };
|
||||
int getCurrentPosition() { return currentPos; };
|
||||
bool allowTransmissions() {
|
||||
return allowTransmission;
|
||||
};
|
||||
void allowPushBack() { allowPushback =true;};
|
||||
void denyPushBack () { allowPushback = false;};
|
||||
void suppressRepeatedTransmissions () {
|
||||
allowTransmission=false;
|
||||
};
|
||||
void allowRepeatedTransmissions () {
|
||||
allowTransmission=true;
|
||||
};
|
||||
void nextFrequency() {
|
||||
frequencyId++;
|
||||
};
|
||||
int getNextFrequency() {
|
||||
return frequencyId;
|
||||
};
|
||||
intVec& getIntentions() {
|
||||
return intentions;
|
||||
};
|
||||
int getCurrentPosition() {
|
||||
return currentPos;
|
||||
};
|
||||
void setPriority(int p) { priority = p; };
|
||||
int getPriority() { return priority; };
|
||||
};
|
||||
|
||||
typedef vector<FGTrafficRecord> TrafficVector;
|
||||
typedef vector<FGTrafficRecord>::iterator TrafficVectorIterator;
|
||||
typedef list<FGTrafficRecord> TrafficVector;
|
||||
typedef list<FGTrafficRecord>::iterator TrafficVectorIterator;
|
||||
|
||||
typedef vector<time_t> TimeVector;
|
||||
typedef vector<time_t>::iterator TimeVectorIterator;
|
||||
|
@ -214,21 +340,41 @@ private:
|
|||
AircraftVec departureCue;
|
||||
|
||||
public:
|
||||
ActiveRunway(string r, int cc) { rwy = r; currentlyCleared = cc; distanceToFinal = 6.0 * SG_NM_TO_METER; };
|
||||
ActiveRunway(string r, int cc) {
|
||||
rwy = r;
|
||||
currentlyCleared = cc;
|
||||
distanceToFinal = 6.0 * SG_NM_TO_METER;
|
||||
};
|
||||
|
||||
string getRunwayName() { return rwy; };
|
||||
int getCleared () { return currentlyCleared; };
|
||||
double getApproachDistance() { return distanceToFinal; };
|
||||
string getRunwayName() {
|
||||
return rwy;
|
||||
};
|
||||
int getCleared () {
|
||||
return currentlyCleared;
|
||||
};
|
||||
double getApproachDistance() {
|
||||
return distanceToFinal;
|
||||
};
|
||||
//time_t getEstApproachTime() { return estimatedArrival; };
|
||||
|
||||
//void setEstApproachTime(time_t time) { estimatedArrival = time; };
|
||||
void addToDepartureCue(FGAIAircraft *ac) { departureCue.push_back(ac); };
|
||||
void setCleared(int number) { currentlyCleared = number; };
|
||||
void addToDepartureCue(FGAIAircraft *ac) {
|
||||
departureCue.push_back(ac);
|
||||
};
|
||||
void setCleared(int number) {
|
||||
currentlyCleared = number;
|
||||
};
|
||||
time_t requestTimeSlot(time_t eta);
|
||||
|
||||
int getDepartureCueSize() { return departureCue.size(); };
|
||||
FGAIAircraft* getFirstAircraftInDepartureCue() { return departureCue.size() ? *(departureCue.begin()) : NULL; };
|
||||
void updateDepartureCue() { departureCue.erase(departureCue.begin()); }
|
||||
int getDepartureCueSize() {
|
||||
return departureCue.size();
|
||||
};
|
||||
FGAIAircraft* getFirstAircraftInDepartureCue() {
|
||||
return departureCue.size() ? *(departureCue.begin()) : NULL;
|
||||
};
|
||||
void updateDepartureCue() {
|
||||
departureCue.erase(departureCue.begin());
|
||||
}
|
||||
};
|
||||
|
||||
typedef vector<ActiveRunway> ActiveRunwayVec;
|
||||
|
@ -283,7 +429,8 @@ public:
|
|||
|
||||
typedef enum {
|
||||
ATC_AIR_TO_GROUND,
|
||||
ATC_GROUND_TO_AIR } AtcMsgDir;
|
||||
ATC_GROUND_TO_AIR
|
||||
} AtcMsgDir;
|
||||
FGATCController();
|
||||
virtual ~FGATCController();
|
||||
void init();
|
||||
|
@ -298,13 +445,19 @@ public:
|
|||
virtual bool hasInstruction(int id) = 0;
|
||||
virtual FGATCInstruction getInstruction(int id) = 0;
|
||||
|
||||
double getDt() { return dt_count; };
|
||||
void setDt(double dt) { dt_count = dt;};
|
||||
double getDt() {
|
||||
return dt_count;
|
||||
};
|
||||
void setDt(double dt) {
|
||||
dt_count = dt;
|
||||
};
|
||||
void transmit(FGTrafficRecord *rec, AtcMsgId msgId, AtcMsgDir msgDir, bool audible);
|
||||
string getGateName(FGAIAircraft *aircraft);
|
||||
virtual void render(bool) = 0;
|
||||
virtual string getName() = 0;
|
||||
|
||||
virtual void update(double) = 0;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
@ -336,8 +489,13 @@ public:
|
|||
|
||||
virtual void render(bool);
|
||||
virtual string getName();
|
||||
bool hasActiveTraffic() { return activeTraffic.size() != 0; };
|
||||
TrafficVector &getActiveTraffic() { return activeTraffic; };
|
||||
virtual void update(double dt);
|
||||
bool hasActiveTraffic() {
|
||||
return activeTraffic.size() != 0;
|
||||
};
|
||||
TrafficVector &getActiveTraffic() {
|
||||
return activeTraffic;
|
||||
};
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -367,9 +525,14 @@ public:
|
|||
|
||||
virtual void render(bool);
|
||||
virtual string getName();
|
||||
virtual void update(double dt);
|
||||
|
||||
bool hasActiveTraffic() { return activeTraffic.size() != 0; };
|
||||
TrafficVector &getActiveTraffic() { return activeTraffic; };
|
||||
bool hasActiveTraffic() {
|
||||
return activeTraffic.size() != 0;
|
||||
};
|
||||
TrafficVector &getActiveTraffic() {
|
||||
return activeTraffic;
|
||||
};
|
||||
|
||||
// Hpoefully, we can move this function to the base class, but I need to verify what is needed for the other controllers before doing so.
|
||||
bool checkTransmissionState(int st, time_t now, time_t startTime, TrafficVectorIterator i, AtcMsgId msgId,
|
||||
|
@ -402,11 +565,16 @@ public:
|
|||
|
||||
virtual void render(bool);
|
||||
virtual string getName();
|
||||
virtual void update(double dt);
|
||||
|
||||
ActiveRunway* getRunway(string name);
|
||||
|
||||
bool hasActiveTraffic() { return activeTraffic.size() != 0; };
|
||||
TrafficVector &getActiveTraffic() { return activeTraffic; };
|
||||
bool hasActiveTraffic() {
|
||||
return activeTraffic.size() != 0;
|
||||
};
|
||||
TrafficVector &getActiveTraffic() {
|
||||
return activeTraffic;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -71,12 +71,24 @@ public:
|
|||
FGAirportDynamics(FGAirport* ap);
|
||||
~FGAirportDynamics();
|
||||
|
||||
void addAwosFreq (int val) { freqAwos.push_back(val); };
|
||||
void addUnicomFreq (int val) { freqUnicom.push_back(val); };
|
||||
void addClearanceFreq(int val) { freqClearance.push_back(val); };
|
||||
void addGroundFreq (int val) { freqGround.push_back(val); };
|
||||
void addTowerFreq (int val) { freqTower.push_back(val); };
|
||||
void addApproachFreq (int val) { freqApproach.push_back(val); };
|
||||
void addAwosFreq (int val) {
|
||||
freqAwos.push_back(val);
|
||||
};
|
||||
void addUnicomFreq (int val) {
|
||||
freqUnicom.push_back(val);
|
||||
};
|
||||
void addClearanceFreq(int val) {
|
||||
freqClearance.push_back(val);
|
||||
};
|
||||
void addGroundFreq (int val) {
|
||||
freqGround.push_back(val);
|
||||
};
|
||||
void addTowerFreq (int val) {
|
||||
freqTower.push_back(val);
|
||||
};
|
||||
void addApproachFreq (int val) {
|
||||
freqApproach.push_back(val);
|
||||
};
|
||||
|
||||
void init();
|
||||
double getLongitude() const;
|
||||
|
@ -96,21 +108,33 @@ public:
|
|||
FGParking *getParking(int i);
|
||||
void releaseParking(int id);
|
||||
string getParkingName(int i);
|
||||
int getNrOfParkings() { return parkings.size(); };
|
||||
int getNrOfParkings() {
|
||||
return parkings.size();
|
||||
};
|
||||
//FGAirport *getAddress() { return this; };
|
||||
//const string &getName() const { return _name;};
|
||||
// Returns degrees
|
||||
|
||||
// Departure / Arrival procedures
|
||||
FGSidStar * getSIDs() { return &SIDs; };
|
||||
FGSidStar * getSIDs() {
|
||||
return &SIDs;
|
||||
};
|
||||
FGAIFlightPlan * getSID(string activeRunway, double heading);
|
||||
|
||||
|
||||
// ATC related functions.
|
||||
FGStartupController *getStartupController() { return &startupController; };
|
||||
FGGroundNetwork *getGroundNetwork() { return &groundNetwork; };
|
||||
FGTowerController *getTowerController() { return &towerController; };
|
||||
FGApproachController *getApproachController() { return &approachController; };
|
||||
FGStartupController *getStartupController() {
|
||||
return &startupController;
|
||||
};
|
||||
FGGroundNetwork *getGroundNetwork() {
|
||||
return &groundNetwork;
|
||||
};
|
||||
FGTowerController *getTowerController() {
|
||||
return &towerController;
|
||||
};
|
||||
FGApproachController *getApproachController() {
|
||||
return &approachController;
|
||||
};
|
||||
|
||||
int getGroundFrequency(unsigned leg);
|
||||
int getTowerFrequency (unsigned nr);
|
||||
|
|
|
@ -205,6 +205,11 @@ bool compare_segments(FGTaxiSegment * a, FGTaxiSegment * b)
|
|||
return (*a) < (*b);
|
||||
}
|
||||
|
||||
bool compare_trafficrecords(FGTrafficRecord a, FGTrafficRecord b)
|
||||
{
|
||||
return (a.getIntentions().size() < b.getIntentions().size());
|
||||
}
|
||||
|
||||
FGGroundNetwork::FGGroundNetwork()
|
||||
{
|
||||
hasNetwork = false;
|
||||
|
@ -623,7 +628,8 @@ void FGGroundNetwork::announcePosition(int id,
|
|||
rec.setPositionAndHeading(lat, lon, heading, speed, alt);
|
||||
rec.setRadius(radius); // only need to do this when creating the record.
|
||||
rec.setAircraft(aircraft);
|
||||
activeTraffic.push_back(rec);
|
||||
activeTraffic.push_front(rec);
|
||||
|
||||
} else {
|
||||
i->setPositionAndIntentions(currentPosition, intendedRoute);
|
||||
i->setPositionAndHeading(lat, lon, heading, speed, alt);
|
||||
|
@ -747,9 +753,9 @@ void FGGroundNetwork::updateAircraftInformation(int id, double lat, double lon,
|
|||
bool needsTaxiClearance = current->getAircraft()->getTaxiClearanceRequest();
|
||||
if (!needsTaxiClearance) {
|
||||
checkHoldPosition(id, lat, lon, heading, speed, alt);
|
||||
if (checkForCircularWaits(id)) {
|
||||
i->setResolveCircularWait();
|
||||
}
|
||||
//if (checkForCircularWaits(id)) {
|
||||
// i->setResolveCircularWait();
|
||||
//}
|
||||
} else {
|
||||
current->setHoldPosition(true);
|
||||
int state = current->getState();
|
||||
|
@ -795,7 +801,7 @@ void FGGroundNetwork::checkSpeedAdjustment(int id, double lat,
|
|||
double speed, double alt)
|
||||
{
|
||||
|
||||
TrafficVectorIterator current, closest;
|
||||
TrafficVectorIterator current, closest, closestOnNetwork;
|
||||
TrafficVectorIterator i = activeTraffic.begin();
|
||||
bool otherReasonToSlowDown = false;
|
||||
bool previousInstruction;
|
||||
|
@ -840,7 +846,9 @@ void FGGroundNetwork::checkSpeedAdjustment(int id, double lat,
|
|||
if ((dist < mindist) && (bearing < 60.0)) {
|
||||
mindist = dist;
|
||||
closest = i;
|
||||
closestOnNetwork = i;
|
||||
minbearing = bearing;
|
||||
|
||||
}
|
||||
}
|
||||
//Check traffic at the tower controller
|
||||
|
@ -887,7 +895,7 @@ void FGGroundNetwork::checkSpeedAdjustment(int id, double lat,
|
|||
}
|
||||
*/
|
||||
current->clearSpeedAdjustment();
|
||||
|
||||
bool needBraking = false;
|
||||
if (current->checkPositionAndIntentions(*closest)
|
||||
|| otherReasonToSlowDown) {
|
||||
double maxAllowableDistance =
|
||||
|
@ -901,6 +909,7 @@ void FGGroundNetwork::checkSpeedAdjustment(int id, double lat,
|
|||
if (closest->getId() != current->getId()) {
|
||||
current->setSpeedAdjustment(closest->getSpeed() *
|
||||
(mindist / 100));
|
||||
needBraking = true;
|
||||
if (
|
||||
closest->getAircraft()->getTakeOffStatus() &&
|
||||
(current->getAircraft()->getTrafficRef()->getDepartureAirport() == closest->getAircraft()->getTrafficRef()->getDepartureAirport()) &&
|
||||
|
@ -920,6 +929,9 @@ void FGGroundNetwork::checkSpeedAdjustment(int id, double lat,
|
|||
}
|
||||
}
|
||||
}
|
||||
if ((closest == closestOnNetwork) && (current->getPriority() < closest->getPriority()) && needBraking) {
|
||||
swap(current, closest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -956,8 +968,28 @@ void FGGroundNetwork::checkHoldPosition(int id, double lat,
|
|||
bool origStatus = current->hasHoldPosition();
|
||||
current->setHoldPosition(false);
|
||||
SGGeod curr(SGGeod::fromDegM(lon, lat, alt));
|
||||
int currentRoute = i->getCurrentPosition();
|
||||
int nextRoute;
|
||||
if (i->getIntentions().size()) {
|
||||
nextRoute = (*(i->getIntentions().begin()));
|
||||
} else {
|
||||
nextRoute = 0;
|
||||
}
|
||||
if (currentRoute > 0) {
|
||||
FGTaxiSegment *tx = findSegment(currentRoute);
|
||||
FGTaxiSegment *nx;
|
||||
if (nextRoute) {
|
||||
nx = findSegment(nextRoute);
|
||||
} else {
|
||||
nx = tx;
|
||||
}
|
||||
if (tx->hasBlock() || nx->hasBlock() ) {
|
||||
current->setHoldPosition(true);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = activeTraffic.begin(); i != activeTraffic.end(); i++) {
|
||||
|
||||
/* for (i = activeTraffic.begin(); i != activeTraffic.end(); i++) {
|
||||
if (i->getId() != current->getId()) {
|
||||
int node = current->crosses(this, *i);
|
||||
if (node != -1) {
|
||||
|
@ -1029,7 +1061,7 @@ void FGGroundNetwork::checkHoldPosition(int id, double lat,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} */
|
||||
bool currStatus = current->hasHoldPosition();
|
||||
current->setHoldPosition(origStatus);
|
||||
// Either a Hold Position or a resume taxi transmission has been issued
|
||||
|
@ -1350,7 +1382,12 @@ void FGGroundNetwork::render(bool visible)
|
|||
geode->setName("test");
|
||||
geode->addDrawable(geometry);
|
||||
//osg::Node *custom_obj;
|
||||
SGMaterial *mat = matlib->find("UnidirectionalTaper");
|
||||
SGMaterial *mat;
|
||||
if (segments[pos]->hasBlock()) {
|
||||
mat = matlib->find("UnidirectionalTaperRed");
|
||||
} else {
|
||||
mat = matlib->find("UnidirectionalTaperGreen");
|
||||
}
|
||||
if (mat)
|
||||
geode->setEffect(mat->get_effect());
|
||||
obj_trans->addChild(geode);
|
||||
|
@ -1361,7 +1398,7 @@ void FGGroundNetwork::render(bool visible)
|
|||
} else {
|
||||
//cerr << "BIG FAT WARNING: current position is here : " << pos << endl;
|
||||
}
|
||||
for(intVecIterator j = (i)->getIntentions().begin(); j != (i)->getIntentions().end(); j++) {
|
||||
for (intVecIterator j = (i)->getIntentions().begin(); j != (i)->getIntentions().end(); j++) {
|
||||
osg::Matrix obj_pos;
|
||||
int k = (*j)-1;
|
||||
if (k >= 0) {
|
||||
|
@ -1419,7 +1456,12 @@ void FGGroundNetwork::render(bool visible)
|
|||
geode->setName("test");
|
||||
geode->addDrawable(geometry);
|
||||
//osg::Node *custom_obj;
|
||||
SGMaterial *mat = matlib->find("UnidirectionalTaper");
|
||||
SGMaterial *mat;
|
||||
if (segments[k]->hasBlock()) {
|
||||
mat = matlib->find("UnidirectionalTaperRed");
|
||||
} else {
|
||||
mat = matlib->find("UnidirectionalTaperGreen");
|
||||
}
|
||||
if (mat)
|
||||
geode->setEffect(mat->get_effect());
|
||||
obj_trans->addChild(geode);
|
||||
|
@ -1437,3 +1479,96 @@ void FGGroundNetwork::render(bool visible)
|
|||
string FGGroundNetwork::getName() {
|
||||
return string(parent->getId() + "-ground");
|
||||
}
|
||||
|
||||
void FGGroundNetwork::update(double dt)
|
||||
{
|
||||
for (FGTaxiSegmentVectorIterator tsi = segments.begin(); tsi != segments.end(); tsi++) {
|
||||
(*tsi)->unblock();
|
||||
}
|
||||
int priority = 1;
|
||||
//sort(activeTraffic.begin(), activeTraffic.end(), compare_trafficrecords);
|
||||
// Handle traffic that is under ground control first; this way we'll prevent clutter at the gate areas.
|
||||
// Don't allow an aircraft to pushback when a taxiing aircraft is currently using part of the intended route.
|
||||
for (TrafficVectorIterator i = parent->getDynamics()->getStartupController()->getActiveTraffic().begin();
|
||||
i != parent->getDynamics()->getStartupController()->getActiveTraffic().end(); i++) {
|
||||
i->allowPushBack();
|
||||
i->setPriority(priority++);
|
||||
if (i->isActive(60)) {
|
||||
|
||||
// Check for all active aircraft whether it's current pos segment is
|
||||
// an opposite of one of the departing aircraft's intentions
|
||||
for (TrafficVectorIterator j = activeTraffic.begin(); j != activeTraffic.end(); j++) {
|
||||
int pos = j->getCurrentPosition();
|
||||
if (pos > 0) {
|
||||
FGTaxiSegment *seg = segments[pos-1]->opposite();
|
||||
if (seg) {
|
||||
int posReverse = seg->getIndex();
|
||||
for (intVecIterator k = i->getIntentions().begin(); k != i->getIntentions().end(); k++) {
|
||||
if ((*k) == posReverse) {
|
||||
i->denyPushBack();
|
||||
segments[posReverse-1]->block();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if the current aircraft is still allowed to pushback, we can start reserving a route for if by blocking all the entry taxiways.
|
||||
if (i->pushBackAllowed()) {
|
||||
int pos = i->getCurrentPosition();
|
||||
if (pos > 0) {
|
||||
FGTaxiSegment *seg = segments[pos-1];
|
||||
FGTaxiNode *node = seg->getEnd();
|
||||
for (FGTaxiSegmentVectorIterator tsi = segments.begin(); tsi != segments.end(); tsi++) {
|
||||
if (((*tsi)->getEnd() == node) && ((*tsi) != seg)) {
|
||||
(*tsi)->block();
|
||||
}
|
||||
}
|
||||
}
|
||||
for (intVecIterator j = i->getIntentions().begin(); j != i->getIntentions().end(); j++) {
|
||||
int pos = (*j);
|
||||
if (pos > 0) {
|
||||
FGTaxiSegment *seg = segments[pos-1];
|
||||
FGTaxiNode *node = seg->getEnd();
|
||||
for (FGTaxiSegmentVectorIterator tsi = segments.begin(); tsi != segments.end(); tsi++) {
|
||||
if (((*tsi)->getEnd() == node) && ((*tsi) != seg)) {
|
||||
(*tsi)->block();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (TrafficVectorIterator i = activeTraffic.begin(); i != activeTraffic.end(); i++) {
|
||||
i->setPriority(priority++);
|
||||
int pos = i->getCurrentPosition();
|
||||
if (pos > 0) {
|
||||
if (segments[pos-1]->hasBlock()) {
|
||||
SG_LOG(SG_GENERAL, SG_ALERT, "Taxiway incursion for AI aircraft" << i->getAircraft()->getCallSign());
|
||||
}
|
||||
|
||||
}
|
||||
intVecIterator ivi;
|
||||
for (ivi = i->getIntentions().begin(); ivi != i->getIntentions().end(); ivi++) {
|
||||
int segIndex = (*ivi);
|
||||
if (segIndex > 0) {
|
||||
if (segments[segIndex-1]->hasBlock())
|
||||
break;
|
||||
}
|
||||
}
|
||||
//after this, ivi points just behind the last valid unblocked taxi segment.
|
||||
for (intVecIterator j = i->getIntentions().begin(); j != ivi; j++) {
|
||||
int pos = (*j);
|
||||
if (pos > 0) {
|
||||
FGTaxiSegment *seg = segments[pos-1];
|
||||
FGTaxiNode *node = seg->getEnd();
|
||||
for (FGTaxiSegmentVectorIterator tsi = segments.begin(); tsi != segments.end(); tsi++) {
|
||||
if (((*tsi)->getEnd() == node) && ((*tsi) != seg)) {
|
||||
(*tsi)->block();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ private:
|
|||
SGGeod center;
|
||||
bool isActive;
|
||||
bool isPushBackRoute;
|
||||
bool isBlocked;
|
||||
FGTaxiNode *start;
|
||||
FGTaxiNode *end;
|
||||
int index;
|
||||
|
@ -82,6 +83,7 @@ public:
|
|||
heading(0),
|
||||
isActive(0),
|
||||
isPushBackRoute(0),
|
||||
isBlocked(0),
|
||||
start(0),
|
||||
end(0),
|
||||
index(0),
|
||||
|
@ -97,6 +99,7 @@ public:
|
|||
center (other.center),
|
||||
isActive (other.isActive),
|
||||
isPushBackRoute (other.isPushBackRoute),
|
||||
isBlocked (other.isBlocked),
|
||||
start (other.start),
|
||||
end (other.end),
|
||||
index (other.index),
|
||||
|
@ -113,6 +116,7 @@ public:
|
|||
center = other.center;
|
||||
isActive = other.isActive;
|
||||
isPushBackRoute = other.isPushBackRoute;
|
||||
isBlocked = other.isBlocked;
|
||||
start = other.start;
|
||||
end = other.end;
|
||||
index = other.index;
|
||||
|
@ -120,33 +124,74 @@ public:
|
|||
return *this;
|
||||
};
|
||||
|
||||
void setIndex (int val) { index = val; };
|
||||
void setStartNodeRef (int val) { startNode = val; };
|
||||
void setEndNodeRef (int val) { endNode = val; };
|
||||
void setIndex (int val) {
|
||||
index = val;
|
||||
};
|
||||
void setStartNodeRef (int val) {
|
||||
startNode = val;
|
||||
};
|
||||
void setEndNodeRef (int val) {
|
||||
endNode = val;
|
||||
};
|
||||
|
||||
void setOpposite(FGTaxiSegment *opp) { oppositeDirection = opp; };
|
||||
void setOpposite(FGTaxiSegment *opp) {
|
||||
oppositeDirection = opp;
|
||||
};
|
||||
|
||||
void setStart(FGTaxiNodeVector *nodes);
|
||||
void setEnd (FGTaxiNodeVector *nodes);
|
||||
void setPushBackType(bool val) { isPushBackRoute = val; };
|
||||
void setPushBackType(bool val) {
|
||||
isPushBackRoute = val;
|
||||
};
|
||||
void setDimensions(double elevation);
|
||||
void block() {
|
||||
isBlocked = true;
|
||||
}
|
||||
void unblock() {
|
||||
isBlocked = false;
|
||||
};
|
||||
bool hasBlock() {
|
||||
return isBlocked;
|
||||
};
|
||||
|
||||
FGTaxiNode * getEnd() { return end;};
|
||||
FGTaxiNode * getStart() { return start; };
|
||||
double getLength() { return length; };
|
||||
int getIndex() { return index; };
|
||||
double getLatitude() { return center.getLatitudeDeg(); };
|
||||
double getLongitude() { return center.getLongitudeDeg(); };
|
||||
double getHeading() { return heading; };
|
||||
bool isPushBack() { return isPushBackRoute; };
|
||||
FGTaxiNode * getEnd() {
|
||||
return end;
|
||||
};
|
||||
FGTaxiNode * getStart() {
|
||||
return start;
|
||||
};
|
||||
double getLength() {
|
||||
return length;
|
||||
};
|
||||
int getIndex() {
|
||||
return index;
|
||||
};
|
||||
double getLatitude() {
|
||||
return center.getLatitudeDeg();
|
||||
};
|
||||
double getLongitude() {
|
||||
return center.getLongitudeDeg();
|
||||
};
|
||||
double getHeading() {
|
||||
return heading;
|
||||
};
|
||||
bool isPushBack() {
|
||||
return isPushBackRoute;
|
||||
};
|
||||
|
||||
int getPenalty(int nGates);
|
||||
|
||||
FGTaxiSegment *getAddress() { return this;};
|
||||
FGTaxiSegment *getAddress() {
|
||||
return this;
|
||||
};
|
||||
|
||||
bool operator<(const FGTaxiSegment &other) const { return index < other.index; };
|
||||
bool operator<(const FGTaxiSegment &other) const {
|
||||
return index < other.index;
|
||||
};
|
||||
//bool hasSmallerHeadingDiff (const FGTaxiSegment &other) const { return headingDiff < other.headingDiff; };
|
||||
FGTaxiSegment *opposite() { return oppositeDirection; };
|
||||
FGTaxiSegment *opposite() {
|
||||
return oppositeDirection;
|
||||
};
|
||||
void setCourseDiff(double crse);
|
||||
|
||||
|
||||
|
@ -176,7 +221,11 @@ private:
|
|||
intVecIterator currRoute;
|
||||
|
||||
public:
|
||||
FGTaxiRoute() { distance = 0; currNode = nodes.begin(); currRoute = routes.begin();};
|
||||
FGTaxiRoute() {
|
||||
distance = 0;
|
||||
currNode = nodes.begin();
|
||||
currRoute = routes.begin();
|
||||
};
|
||||
FGTaxiRoute(intVec nds, intVec rts, double dist, int dpth) {
|
||||
nodes = nds;
|
||||
routes = rts;
|
||||
|
@ -205,15 +254,26 @@ public:
|
|||
currRoute(routes.begin())
|
||||
{};
|
||||
|
||||
bool operator< (const FGTaxiRoute &other) const {return distance < other.distance; };
|
||||
bool empty () { return nodes.begin() == nodes.end(); };
|
||||
bool operator< (const FGTaxiRoute &other) const {
|
||||
return distance < other.distance;
|
||||
};
|
||||
bool empty () {
|
||||
return nodes.begin() == nodes.end();
|
||||
};
|
||||
bool next(int *nde);
|
||||
bool next(int *nde, int *rte);
|
||||
void rewind(int legNr);
|
||||
|
||||
void first() { currNode = nodes.begin(); currRoute = routes.begin(); };
|
||||
int size() { return nodes.size(); };
|
||||
int nodesLeft() { return nodes.end() - currNode; };
|
||||
void first() {
|
||||
currNode = nodes.begin();
|
||||
currRoute = routes.begin();
|
||||
};
|
||||
int size() {
|
||||
return nodes.size();
|
||||
};
|
||||
int nodesLeft() {
|
||||
return nodes.end() - currNode;
|
||||
};
|
||||
|
||||
// int getDepth() { return depth; };
|
||||
};
|
||||
|
@ -266,8 +326,12 @@ public:
|
|||
void addSegment(const FGTaxiSegment& seg);
|
||||
|
||||
void init();
|
||||
bool exists() { return hasNetwork; };
|
||||
void setTowerController(FGTowerController *twrCtrlr) { towerController = twrCtrlr; };
|
||||
bool exists() {
|
||||
return hasNetwork;
|
||||
};
|
||||
void setTowerController(FGTowerController *twrCtrlr) {
|
||||
towerController = twrCtrlr;
|
||||
};
|
||||
|
||||
int findNearestNode(double lat, double lon);
|
||||
int findNearestNode(const SGGeod& aGeod);
|
||||
|
@ -277,9 +341,13 @@ public:
|
|||
FGTaxiRoute findShortestRoute(int start, int end, bool fullSearch=true);
|
||||
//void trace(FGTaxiNode *, int, int, double dist);
|
||||
|
||||
int getNrOfNodes() { return nodes.size(); };
|
||||
int getNrOfNodes() {
|
||||
return nodes.size();
|
||||
};
|
||||
|
||||
void setParent(FGAirport *par) { parent = par; };
|
||||
void setParent(FGAirport *par) {
|
||||
parent = par;
|
||||
};
|
||||
|
||||
virtual void announcePosition(int id, FGAIFlightPlan *intendedRoute, int currentRoute,
|
||||
double lat, double lon, double hdg, double spd, double alt,
|
||||
|
@ -294,6 +362,7 @@ public:
|
|||
bool checkForCircularWaits(int id);
|
||||
virtual void render(bool);
|
||||
virtual string getName();
|
||||
virtual void update(double dt);
|
||||
|
||||
void saveElevationCache();
|
||||
};
|
||||
|
|
|
@ -380,7 +380,7 @@ void FGAISchedule::scheduleFlights(time_t now)
|
|||
FGScheduledFlight *flight = NULL;
|
||||
do {
|
||||
if (currentDestination.empty()) {
|
||||
flight = findAvailableFlight(userPort, flightIdentifier, now, (now+6400));
|
||||
//flight = findAvailableFlight(userPort, flightIdentifier, now, (now+1800));
|
||||
if (!flight)
|
||||
flight = findAvailableFlight(currentDestination, flightIdentifier);
|
||||
} else {
|
||||
|
@ -423,7 +423,7 @@ void FGAISchedule::scheduleFlights(time_t now)
|
|||
<< " " << arrT << ":");
|
||||
|
||||
flights.push_back(flight);
|
||||
} while (currentDestination != startingPort);
|
||||
} while (1); //(currentDestination != startingPort);
|
||||
SG_LOG(SG_GENERAL, SG_BULK, " Done ");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue