Maintenance: AIFlightPlanCreate
SPDX tags. resolve variable scoping contention. remove obsolete code. spelling.
This commit is contained in:
parent
b459348a60
commit
16f7291110
1 changed files with 339 additions and 376 deletions
|
@ -1,22 +1,8 @@
|
|||
/******************************************************************************
|
||||
* AIFlightPlanCreate.cxx
|
||||
* Written by Durk Talsma, started May, 2004.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
**************************************************************************/
|
||||
/*
|
||||
* SPDX-FileName: AIFlightPlanCreate.cxx
|
||||
* SPDX-FileCopyrightText: Written by Durk Talsma, started May, 2004
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
|
@ -24,33 +10,34 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "AIFlightPlan.hxx"
|
||||
#include <simgear/math/sg_geodesy.hxx>
|
||||
#include <simgear/props/props.hxx>
|
||||
#include <simgear/props/props_io.hxx>
|
||||
#include <simgear/timing/sg_time.hxx>
|
||||
|
||||
#include <Airports/airport.hxx>
|
||||
#include <Airports/runways.hxx>
|
||||
#include <Airports/dynamics.hxx>
|
||||
#include <Airports/groundnetwork.hxx>
|
||||
#include <Airports/runways.hxx>
|
||||
|
||||
#include "AIAircraft.hxx"
|
||||
#include "performancedata.hxx"
|
||||
#include "VectorMath.hxx"
|
||||
|
||||
#include <Main/fg_props.hxx>
|
||||
#include <Environment/environment_mgr.hxx>
|
||||
#include <Environment/environment.hxx>
|
||||
#include <Environment/environment_mgr.hxx>
|
||||
#include <FDM/LaRCsim/basic_aero.h>
|
||||
#include <Main/fg_props.hxx>
|
||||
#include <Navaids/navrecord.hxx>
|
||||
#include <Traffic/Schedule.hxx>
|
||||
|
||||
#include "AIAircraft.hxx"
|
||||
#include "AIFlightPlan.hxx"
|
||||
#include "VectorMath.hxx"
|
||||
#include "performancedata.hxx"
|
||||
|
||||
using std::string;
|
||||
|
||||
|
||||
/* FGAIFlightPlan::create()
|
||||
* dynamically create a flight plan for AI traffic, based on data provided by the
|
||||
* Traffic Manager, when reading a filed flightplan fails. (DT, 2004/07/10)
|
||||
|
@ -125,15 +112,12 @@ bool FGAIFlightPlan::create(FGAIAircraft * ac, FGAirport * dep,
|
|||
// to do so, mark the last waypoint with a special status flag
|
||||
if (retVal) {
|
||||
if (waypoints.empty()) {
|
||||
SG_LOG(SG_AI, SG_WARN, ac->getCallSign() << "|AIFlightPlan::create() Leg " << legNr <<
|
||||
" created empty waypoints." );
|
||||
SG_LOG(SG_AI, SG_WARN, ac->getCallSign() << "|AIFlightPlan::create() Leg " << legNr << " created empty waypoints.");
|
||||
return retVal;
|
||||
}
|
||||
wpt_iterator = waypoints.begin() + currWpt;
|
||||
if (waypoints.back()->getName().size() == 0) {
|
||||
SG_LOG(SG_AI, SG_WARN, ac->getCallSign() <<
|
||||
" Empty wpt name");
|
||||
|
||||
SG_LOG(SG_AI, SG_WARN, ac->getCallSign() << " Empty wpt name");
|
||||
}
|
||||
waypoints.back()->setName(waypoints.back()->getName() + string("legend"));
|
||||
// "It's pronounced Leg-end" (Roger Glover (Deep Purple): come Hell or High Water DvD, 1993)
|
||||
|
@ -160,11 +144,13 @@ FGAIWaypoint * FGAIFlightPlan::createOnGround(FGAIAircraft * ac,
|
|||
wpt->setFinished(false);
|
||||
wpt->setOn_ground(true);
|
||||
wpt->setRouteIndex(0);
|
||||
|
||||
if (aSpeed > 0.0f) {
|
||||
wpt->setGroundLights();
|
||||
} else {
|
||||
wpt->setPowerDownLights();
|
||||
}
|
||||
|
||||
return wpt;
|
||||
}
|
||||
|
||||
|
@ -179,10 +165,12 @@ FGAIWaypoint * FGAIFlightPlan::createOnRunway(FGAIAircraft * ac,
|
|||
}
|
||||
|
||||
void FGAIFlightPlan::createArc(FGAIAircraft* ac, const SGGeod& center, int startAngle,
|
||||
int endAngle, int increment, int radius, double aElev, double altDiff, double aSpeed, const char* pattern) {
|
||||
int endAngle, int increment, int radius, double aElev, double altDiff, double aSpeed, const char* pattern)
|
||||
{
|
||||
double trackSegmentLength = (2 * M_PI * radius) / 360.0;
|
||||
double dummyAz2;
|
||||
char buffer[20];
|
||||
|
||||
if (endAngle > startAngle && increment < 0) {
|
||||
endAngle -= 360;
|
||||
}
|
||||
|
@ -211,8 +199,8 @@ int endAngle, int increment, int radius, double aElev, double altDiff, double aS
|
|||
}
|
||||
}
|
||||
|
||||
void FGAIFlightPlan::createLine( FGAIAircraft *ac, const SGGeod& startPoint, double azimuth, double dist, double aElev, double dAlt, double vDescent, const char* pattern) {
|
||||
SGGeod dummyAz2;
|
||||
void FGAIFlightPlan::createLine(FGAIAircraft* ac, const SGGeod& startPoint, double azimuth, double dist, double aElev, double dAlt, double vDescent, const char* pattern)
|
||||
{
|
||||
double nPoints = dist / (vDescent * 2);
|
||||
char buffer[20];
|
||||
double distIncrement = (dist / nPoints);
|
||||
|
@ -227,7 +215,6 @@ void FGAIFlightPlan::createLine( FGAIAircraft *ac, const SGGeod& startPoint, dou
|
|||
wpt->setTrackLength((dist / nPoints));
|
||||
pushBackWaypoint(wpt);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FGAIWaypoint* FGAIFlightPlan::createInAir(FGAIAircraft* ac,
|
||||
|
@ -328,11 +315,7 @@ bool FGAIFlightPlan::createTakeoffTaxi(FGAIAircraft * ac, bool firstFlight,
|
|||
gate = apt->getDynamics()->getAvailableParking(radius, fltType,
|
||||
acType, airline);
|
||||
if (!gate.isValid()) {
|
||||
SG_LOG(SG_AI, SG_WARN, "Could not find parking for a " <<
|
||||
acType <<
|
||||
" of flight type " << fltType <<
|
||||
" of airline " << airline <<
|
||||
" at airport " << apt->getId());
|
||||
SG_LOG(SG_AI, SG_WARN, "Could not find parking for a " << acType << " of flight type " << fltType << " of airline " << airline << " at airport " << apt->getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -577,7 +560,7 @@ static double accelDistance(double v0, double v1, double accel)
|
|||
return t * 0.5 * (v1 + v0);
|
||||
}
|
||||
|
||||
// find the horizontal distance to gain the specific altiude, holding
|
||||
// find the horizontal distance to gain the specific altitude, holding
|
||||
// a constant pitch angle. Used to compute distance based on standard FD/AP
|
||||
// PITCH mode prior to VS or CLIMB engaging. Visually, we want to avoid
|
||||
// a dip in the nose angle after rotation, during initial climb-out.
|
||||
|
@ -628,9 +611,8 @@ bool FGAIFlightPlan::createTakeOff(FGAIAircraft * ac,
|
|||
// because the getActive runway function takes care of that.
|
||||
if (firstFlight) {
|
||||
const string& rwyClass = getRunwayClassFromTrafficType(fltType);
|
||||
double heading = ac->getTrafficRef()->getCourse();
|
||||
apt->getDynamics()->getActiveRunway(rwyClass, 1, activeRunway,
|
||||
heading);
|
||||
double dHeading = ac->getTrafficRef()->getCourse();
|
||||
apt->getDynamics()->getActiveRunway(rwyClass, 1, activeRunway, dHeading);
|
||||
}
|
||||
|
||||
// this is Sentry issue FLIGHTGEAR-DS : happens after reposition,
|
||||
|
@ -674,7 +656,7 @@ bool FGAIFlightPlan::createTakeOff(FGAIAircraft * ac,
|
|||
double vRef = vTakeoff + 20; // climb-out at v2 + 20kts
|
||||
|
||||
// We want gear-up to take place at ~400ft AGL. However, the flightplan
|
||||
// will move onto the next leg once it gets within 2xspeed of the next waypoint.
|
||||
// will move onto the next leg once it gets within 2x-speed of the next waypoint.
|
||||
// With closely spaced waypoints on climb-out this can occur almost immediately,
|
||||
// so we put the waypoint further away.
|
||||
double gearUpDist = t + 2 * vRef * SG_FEET_TO_METER + pitchDistance(INITIAL_PITCH_ANGLE, 400 * SG_FEET_TO_METER);
|
||||
|
@ -686,7 +668,7 @@ bool FGAIFlightPlan::createTakeOff(FGAIAircraft * ac,
|
|||
// limit climbout speed to 240kts below 10000'
|
||||
double vClimbBelow10000 = std::min(240.0, ac->getPerformance()->vClimb());
|
||||
|
||||
// create two climb-out points. This is important becuase the first climb point will
|
||||
// create two climb-out points. This is important because the first climb point will
|
||||
// be a (sometimes large) turn towards the destination, and we don't want to
|
||||
// commence that turn below 2000'
|
||||
double climbOut = t + 2 * vClimbBelow10000 * SG_FEET_TO_METER + pitchDistance(INITIAL_PITCH_ANGLE, 2000 * SG_FEET_TO_METER);
|
||||
|
@ -715,9 +697,8 @@ bool FGAIFlightPlan::createClimb(FGAIAircraft * ac, bool firstFlight,
|
|||
|
||||
if (firstFlight) {
|
||||
const string& rwyClass = getRunwayClassFromTrafficType(fltType);
|
||||
double heading = ac->getTrafficRef()->getCourse();
|
||||
apt->getDynamics()->getActiveRunway(rwyClass, 1, activeRunway,
|
||||
heading);
|
||||
double dHeading = ac->getTrafficRef()->getCourse();
|
||||
apt->getDynamics()->getActiveRunway(rwyClass, 1, activeRunway, dHeading);
|
||||
}
|
||||
|
||||
if (sid) {
|
||||
|
@ -736,7 +717,7 @@ bool FGAIFlightPlan::createClimb(FGAIAircraft * ac, bool firstFlight,
|
|||
|
||||
// compute course towards destination
|
||||
double course = SGGeodesy::courseDeg(cur, arrival->geod());
|
||||
double distance = SGGeodesy::distanceM(cur, arrival->geod());
|
||||
// double distance = SGGeodesy::distanceM(cur, arrival->geod());
|
||||
|
||||
const double headingDiffRunway = SGMiscd::normalizePeriodic(-180, 180, course - runway->headingDeg());
|
||||
|
||||
|
@ -750,10 +731,6 @@ bool FGAIFlightPlan::createClimb(FGAIAircraft * ac, bool firstFlight,
|
|||
pushBackWaypoint(wpt);
|
||||
} else {
|
||||
double initialTurnRadius = getTurnRadius(vClimb, true);
|
||||
double lateralOffset = initialTurnRadius;
|
||||
if (headingDiffRunway > 0.0) {
|
||||
lateralOffset *= -1.0;
|
||||
}
|
||||
SGGeod climb1 = SGGeodesy::direct(cur, runway->headingDeg(), 5 * SG_NM_TO_METER);
|
||||
FGAIWaypoint* wpt = createInAir(ac, "5000ft climb", climb1, 5000, vClimb);
|
||||
pushBackWaypoint(wpt);
|
||||
|
@ -766,7 +743,6 @@ bool FGAIFlightPlan::createClimb(FGAIAircraft * ac, bool firstFlight,
|
|||
wpt = createInAir(ac, "18000ft climb", waypoints.back()->getPos(), 18000, vClimb);
|
||||
pushBackWaypoint(wpt);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -790,19 +766,15 @@ bool FGAIFlightPlan::createDescent(FGAIAircraft * ac,
|
|||
// 2) a linear glide path from the initial position to
|
||||
// 3) a semi circle turn to final
|
||||
// 4) approach
|
||||
bool reposition = false;
|
||||
FGAIWaypoint *wpt;
|
||||
double vDescent = ac->getPerformance()->vDescent();
|
||||
double vApproach = ac->getPerformance()->vApproach();
|
||||
// double vApproach = ac->getPerformance()->vApproach();
|
||||
|
||||
//Beginning of Descent
|
||||
const string& rwyClass = getRunwayClassFromTrafficType(fltType);
|
||||
double heading = ac->getTrueHeadingDeg();
|
||||
apt->getDynamics()->getActiveRunway(rwyClass, 2, activeRunway,
|
||||
heading);
|
||||
apt->getDynamics()->getActiveRunway(rwyClass, 2, activeRunway, heading);
|
||||
if (!apt->hasRunwayWithIdent(activeRunway)) {
|
||||
SG_LOG(SG_AI, SG_WARN, ac->getCallSign() <<
|
||||
"| FGAIFlightPlan::createDescent: No such runway " << activeRunway << " at " << apt->ident());
|
||||
SG_LOG(SG_AI, SG_WARN, ac->getCallSign() << "| FGAIFlightPlan::createDescent: No such runway " << activeRunway << " at " << apt->ident());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -844,21 +816,13 @@ bool FGAIFlightPlan::createDescent(FGAIAircraft * ac,
|
|||
double azimuth = SGGeodesy::courseDeg(current, initialTarget);
|
||||
double secondaryAzimuth = SGGeodesy::courseDeg(current, secondaryTarget);
|
||||
double initialHeadingDiff = SGMiscd::normalizePeriodic(-180, 180, azimuth - secondaryAzimuth);
|
||||
double dummyAz2;
|
||||
double courseTowardsThreshold = SGGeodesy::courseDeg(current, rwy->pointOnCenterlineDisplaced(0));
|
||||
double courseTowardsRwyEnd = SGGeodesy::courseDeg(current, otherRwyEnd);
|
||||
// double courseTowardsRwyEnd = SGGeodesy::courseDeg(current, otherRwyEnd);
|
||||
double headingDiffToRunwayThreshold = SGMiscd::normalizePeriodic(-180, 180, ac->getTrueHeadingDeg() - courseTowardsThreshold);
|
||||
double headingDiffToRunwayEnd = SGMiscd::normalizePeriodic(-180, 180, ac->getTrueHeadingDeg() - courseTowardsRwyEnd);
|
||||
// double headingDiffToRunwayEnd = SGMiscd::normalizePeriodic(-180, 180, ac->getTrueHeadingDeg() - courseTowardsRwyEnd);
|
||||
|
||||
SG_LOG(SG_AI, SG_BULK, ac->getCallSign() <<
|
||||
"| " <<
|
||||
" WPs : " << waypoints.size() <<
|
||||
" Heading Diff (rwy) : " << headingDiffRunway <<
|
||||
" Distance : " << distance <<
|
||||
" Azimuth : " << azimuth <<
|
||||
" Heading : " << ac->getTrueHeadingDeg() <<
|
||||
" Initial Headingdiff " << initialHeadingDiff <<
|
||||
" Lateral : " << lateralOffset);
|
||||
SG_LOG(SG_AI, SG_BULK, ac->getCallSign() << "| "
|
||||
<< " WPs : " << waypoints.size() << " Heading Diff (rwy) : " << headingDiffRunway << " Distance : " << distance << " Azimuth : " << azimuth << " Heading : " << ac->getTrueHeadingDeg() << " Initial Headingdiff " << initialHeadingDiff << " Lateral : " << lateralOffset);
|
||||
// Erase the two bogus BOD points: Note check for conflicts with scripted AI flightPlans
|
||||
IncrementWaypoint(false);
|
||||
IncrementWaypoint(false);
|
||||
|
@ -889,11 +853,11 @@ bool FGAIFlightPlan::createDescent(FGAIAircraft * ac,
|
|||
newCurrent = SGGeodesy::direct(newCurrent, ac->getTrueHeadingDeg(), offset += 100);
|
||||
firstTurnCenter = SGGeodesy::direct(newCurrent, ac->getTrueHeadingDeg() + rightAngle, initialTurnRadius);
|
||||
}
|
||||
const double heading = VectorMath::outerTangentsAngle(firstTurnCenter, secondaryTarget, initialTurnRadius, initialTurnRadius )[0];
|
||||
createArc(ac, firstTurnCenter, ac->_getHeading()-rightAngle, heading-rightAngle, firstTurnIncrement, initialTurnRadius, waypoints.size()>0?waypoints.back()->getAltitude():alt, altDiff/4, vDescent, "near-initialturn%03d");
|
||||
const double dHeading = VectorMath::outerTangentsAngle(firstTurnCenter, secondaryTarget, initialTurnRadius, initialTurnRadius)[0];
|
||||
createArc(ac, firstTurnCenter, ac->_getHeading() - rightAngle, dHeading - rightAngle, firstTurnIncrement, initialTurnRadius, waypoints.size() > 0 ? waypoints.back()->getAltitude() : alt, altDiff / 4, vDescent, "near-initialturn%03d");
|
||||
double length = VectorMath::innerTangentsLength(firstTurnCenter, secondaryTarget, initialTurnRadius, initialTurnRadius);
|
||||
createLine(ac, waypoints.back()->getPos(), heading, length, waypoints.size()>0?waypoints.back()->getAltitude():alt, altDiff/2, vDescent, "descent%03d");
|
||||
int startVal = SGMiscd::normalizePeriodic(0, 360, heading-rightAngle);
|
||||
createLine(ac, waypoints.back()->getPos(), dHeading, length, waypoints.size() > 0 ? waypoints.back()->getAltitude() : alt, altDiff / 2, vDescent, "descent%03d");
|
||||
int startVal = SGMiscd::normalizePeriodic(0, 360, dHeading - rightAngle);
|
||||
int endVal = SGMiscd::normalizePeriodic(0, 360, rwy->headingDeg() - rightAngle);
|
||||
// Turn into runway
|
||||
createArc(ac, secondaryTarget, startVal, endVal, firstTurnIncrement, initialTurnRadius,
|
||||
|
@ -909,11 +873,11 @@ bool FGAIFlightPlan::createDescent(FGAIAircraft * ac,
|
|||
while (SGGeodesy::distanceM(firstTurnCenter, secondaryTarget) < 2 * initialTurnRadius) {
|
||||
secondaryTarget = rwy->pointOffCenterline(-2 * distanceOut + (offset += 1000), lateralOffset);
|
||||
}
|
||||
const double heading = VectorMath::innerTangentsAngle(firstTurnCenter, secondaryTarget, initialTurnRadius, initialTurnRadius )[innerTangent];
|
||||
createArc(ac, firstTurnCenter, ac->_getHeading()-rightAngle, heading-rightAngle, firstTurnIncrement, initialTurnRadius, waypoints.size()>0?waypoints.back()->getAltitude():alt, altDiff/8, vDescent, "far-initialturn%03d");
|
||||
const double dHeading = VectorMath::innerTangentsAngle(firstTurnCenter, secondaryTarget, initialTurnRadius, initialTurnRadius)[innerTangent];
|
||||
createArc(ac, firstTurnCenter, ac->_getHeading() - rightAngle, dHeading - rightAngle, firstTurnIncrement, initialTurnRadius, waypoints.size() > 0 ? waypoints.back()->getAltitude() : alt, altDiff / 8, vDescent, "far-initialturn%03d");
|
||||
double length = VectorMath::innerTangentsLength(firstTurnCenter, secondaryTarget, initialTurnRadius, initialTurnRadius);
|
||||
createLine(ac, waypoints.back()->getPos(), heading, length, waypoints.size()>0?waypoints.back()->getAltitude():alt, altDiff*0.75, vDescent, "descent%03d");
|
||||
int startVal = SGMiscd::normalizePeriodic(0, 360, heading+rightAngle);
|
||||
createLine(ac, waypoints.back()->getPos(), dHeading, length, waypoints.size() > 0 ? waypoints.back()->getAltitude() : alt, altDiff * 0.75, vDescent, "descent%03d");
|
||||
int startVal = SGMiscd::normalizePeriodic(0, 360, dHeading + rightAngle);
|
||||
int endVal = SGMiscd::normalizePeriodic(0, 360, rwy->headingDeg() + rightAngle);
|
||||
// Turn into runway
|
||||
createArc(ac, secondaryTarget, startVal, endVal, firstTurnIncrement * -1, initialTurnRadius,
|
||||
|
@ -956,11 +920,11 @@ bool FGAIFlightPlan::createDescent(FGAIAircraft * ac,
|
|||
int firstTurnIncrement = headingDiffRunway > 0 ? 2 : -2;
|
||||
int innerTangent = headingDiffRunway < 0 ? 0 : 1;
|
||||
SGGeod firstTurnCenter = SGGeodesy::direct(current, ac->getTrueHeadingDeg() + rightAngle, initialTurnRadius);
|
||||
const double heading = VectorMath::innerTangentsAngle(firstTurnCenter, secondaryTarget, initialTurnRadius, initialTurnRadius )[innerTangent];
|
||||
createArc(ac, firstTurnCenter, ac->_getHeading()-rightAngle, heading-rightAngle, firstTurnIncrement, initialTurnRadius, waypoints.size()>0?waypoints.back()->getAltitude():alt, altDiff/3, vDescent, "d-far-initialturn%03d");
|
||||
const double dHeading = VectorMath::innerTangentsAngle(firstTurnCenter, secondaryTarget, initialTurnRadius, initialTurnRadius)[innerTangent];
|
||||
createArc(ac, firstTurnCenter, ac->_getHeading() - rightAngle, dHeading - rightAngle, firstTurnIncrement, initialTurnRadius, waypoints.size() > 0 ? waypoints.back()->getAltitude() : alt, altDiff / 3, vDescent, "d-far-initialturn%03d");
|
||||
double length = VectorMath::innerTangentsLength(firstTurnCenter, secondaryTarget, initialTurnRadius, initialTurnRadius);
|
||||
createLine(ac, waypoints.back()->getPos(), heading, length, waypoints.size()>0?waypoints.back()->getAltitude():alt, altDiff/3, vDescent, "descent%03d");
|
||||
int startVal = SGMiscd::normalizePeriodic(0, 360, heading+rightAngle);
|
||||
createLine(ac, waypoints.back()->getPos(), dHeading, length, waypoints.size() > 0 ? waypoints.back()->getAltitude() : alt, altDiff / 3, vDescent, "descent%03d");
|
||||
int startVal = SGMiscd::normalizePeriodic(0, 360, dHeading + rightAngle);
|
||||
int endVal = SGMiscd::normalizePeriodic(0, 360, rwy->headingDeg() + rightAngle);
|
||||
// Turn into runway
|
||||
createArc(ac, secondaryTarget, startVal, endVal, -firstTurnIncrement, initialTurnRadius,
|
||||
|
@ -972,8 +936,8 @@ bool FGAIFlightPlan::createDescent(FGAIAircraft * ac,
|
|||
int rightAngle = headingDiffRunway > 0 ? 90 : -90;
|
||||
SGGeod firstTurnCenter = SGGeodesy::direct(current, ac->getTrueHeadingDeg() - rightAngle, initialTurnRadius);
|
||||
int firstTurnIncrement = headingDiffRunway > 0 ? -2 : 2;
|
||||
const double heading = rwy->headingDeg();
|
||||
createArc(ac, firstTurnCenter, ac->_getHeading()+rightAngle, heading+rightAngle, firstTurnIncrement, initialTurnRadius, ac->getAltitude(), altDiff/3, vDescent, "straight_turn_%03d");
|
||||
const double dHeading = rwy->headingDeg();
|
||||
createArc(ac, firstTurnCenter, ac->_getHeading() + rightAngle, dHeading + rightAngle, firstTurnIncrement, initialTurnRadius, ac->getAltitude(), altDiff / 3, vDescent, "straight_turn_%03d");
|
||||
}
|
||||
|
||||
time_t now = globals->get_time_params()->get_cur_time();
|
||||
|
@ -1001,14 +965,13 @@ bool FGAIFlightPlan::createHold(FGAIAircraft * ac,
|
|||
// Beginning of Descent
|
||||
const string& rwyClass = getRunwayClassFromTrafficType(fltType);
|
||||
double vDescent = ac->getPerformance()->vDescent();
|
||||
double vApproach = ac->getPerformance()->vApproach();
|
||||
// double vApproach = ac->getPerformance()->vApproach();
|
||||
double initialTurnRadius = getTurnRadius(vDescent, true);
|
||||
double heading = ac->getTrueHeadingDeg();
|
||||
double dHeading = ac->getTrueHeadingDeg();
|
||||
apt->getDynamics()->getActiveRunway(rwyClass, 2, activeRunway,
|
||||
heading);
|
||||
dHeading);
|
||||
if (!apt->hasRunwayWithIdent(activeRunway)) {
|
||||
SG_LOG(SG_AI, SG_WARN, ac->getCallSign() <<
|
||||
"| FGAIFlightPlan::createHold: No such runway " << activeRunway << " at " << apt->ident());
|
||||
SG_LOG(SG_AI, SG_WARN, ac->getCallSign() << "| FGAIFlightPlan::createHold: No such runway " << activeRunway << " at " << apt->ident());
|
||||
return false;
|
||||
}
|
||||
FGRunwayRef rwy = apt->getRunwayByIdent(activeRunway);
|
||||
|
@ -1050,7 +1013,7 @@ static double runwayGlideslopeTouchdownDistance(FGRunway* rwy)
|
|||
|
||||
/*******************************************************************
|
||||
* CreateLanding (Leg 7)
|
||||
* Create a flight path from the "permision to land" point (currently
|
||||
* Create a flight path from the "permission to land" point (currently
|
||||
hardcoded at 5000 meters from the threshold) to the threshold, at
|
||||
a standard glide slope angle of 3 degrees.
|
||||
Position : 50.0354 8.52592 384 364 11112
|
||||
|
@ -1250,10 +1213,10 @@ bool FGAIFlightPlan::createParking(FGAIAircraft * ac, FGAirport * apt,
|
|||
*
|
||||
* Currently valid traffic types for gate assignment:
|
||||
* - gate (commercial gate)
|
||||
* - cargo (commercial gargo),
|
||||
* - ga (general aviation) ,
|
||||
* - ul (ultralight),
|
||||
* - mil-fighter (military - fighter),
|
||||
* - cargo (commercial cargo)
|
||||
* - ga (general aviation)
|
||||
* - ul (ultralight)
|
||||
* - mil-fighter (military - fighter)
|
||||
* - mil-transport (military - transport)
|
||||
*
|
||||
* Valid runway classes:
|
||||
|
|
Loading…
Add table
Reference in a new issue