-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature/ATC-53 #89
feature/ATC-53 #89
Conversation
* Updates refs for new getters * Begins abstracting waypoint creation to individual methods * Adds _get for setting properties from passed in object in Leg and Waypoint models
* Adds aircraftConstants to Leg * Adds new method to get waypoint models for sid in AirportModel
StandardRouteCollections when dealing with sids and stars. * Removes inline string transformation logic from Leg
…he passed fixName before searching.
…eModel within the AircraftInstanceModel - Adds doc blocks to Leg - Adds new methods to Leg to reset the current waypoint array and for adding a new Waypoint to the waypoint array.
* Removes fms.clearedAsFiled() method * Consolidates runSID() and climbViaSid() logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@erikquinn a few questions for you on this feature
// set initial | ||
this.fp.altitude = clamp(1000, options.model.ceiling, 60000); | ||
|
||
if (options.aircraft.category === 'arrival') { | ||
// TODO: why KDBG? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this just an arbitrary icao? or is there some meaning here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct. back in the good old days, "KDBG", aka "Debug Airport" was the first airport in the game. When needing to fill the origin and destination airports in, "KDBG" was an arbitrary choice so it wasn't empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this is confusing. Perhaps we could update this to be a little clearer like UNASSIGNED
or something. I'll add an issue for future consideration #102.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's misleading. Something like that would be perfectly fine.
// arrival airport | ||
r.push(this.legs[l].route.split('.')[2]); | ||
flightPlanRoute.push(leg.route.exit); | ||
|
||
break; | ||
case FP_LEG_TYPE.IAP: | ||
// no need to include these in flightplan (because wouldn't happen in real life) | ||
break; | ||
case FP_LEG_TYPE.AWY: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are airways in use in the app yet or is that a future enhancement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes and no; they just have to be added to the airport files. They should work fine once airports have airways added in.
// add speeds to wp | ||
wp[i].speed = spd; | ||
waypoint.setAltitude(ctr_ceiling, cruise_alt); | ||
waypoint.setSpeed(cruise_spd); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so now I have model methods doing this logic, but I feel they should be run when the waypoints are set not here after the fact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not. Here's an example:
You can see there are altitude restrictions obviously, but aircraft not having been told to "descend via the KORRY3 arrival" would have last been told to "climb and maintain FL370" (or whatever their cruise altitude is. So they have to maintain that until being told to cvs
or dvs
.
So the setAltitude
and setSpeed
methods actually put the restrictions in the altitude
property of the given waypoints, and this should not be done until they are are cleared to descend via STAR or climb via SID. Currently, the former is done automatically on spawn, but the actions of storing the restrictions and instructing to comply with the restrictions should remain separate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What you're saying makes sense.
I guess what I was getting at here is that once we know an aircraft is going to fly the sid/star, we should set the restrictions then when we create the Waypoint
s. The fms doesnt care about future restrictions, only the restrictions for the current Waypoint
. Maybe that isn't practical in this case. ehh :-/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is that the restrictions are only ro be followed after they have been cleared to "descend via the GSLIN8 arrival" or "climb via SID".
If they aren't told to do this, they aren't allowed to do anything regarding those posted altitudes; they must just remain at the altitude last assigned.
So assigning the altitude
waypoint based on the fixRestrictions
should not be done until that cvs
/ dvs
command is given.
Is that more clear hopefully? I don't think I made much sense in the last comment.
* Adds .getStarLegWaypoints() * Removes dead code
} else if (firstRouteSegment === 'KDBG' && this.heading === null) { | ||
// FIXME: radial is not defined or set anywhere in this class | ||
// aim arrival @ middle of airspace | ||
this.heading = this.radial + Math.PI; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is radial
coming from? This is the only spot it exists within this class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block seems to be for arrivals that somehow got messed up and have no waypoint to fly to or no assigned heading. this.radial
is one of those old properties of the aircraft model that I had mentioned a while ago that should eventually be removed. Nonetheless, this.radial
is the bearing (radians) from the airport to the aircraft. Thus, line 160 is just telling the aircraft to fly on a heading to the airport so they don't get stuck out in the abyss outside the airspace boundary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
except this.radial
is never used in Waypoint
. This is the only spot its mentioned, which leads me to believe that when the game is being played, this section never gets hit. This would fail if it did or at least cause some weirdness
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The truth is, this.radial
predates the entire fms, and is no longer used for anything important. It is one of the many things I intend to clean out of the aircraft object at some point here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any qualms with me removing it from this block entirely? I'd like to try and remove stale code whenever possible :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There might be some airports that use it. Maybe MSP off the top of my head? But I'd have to check. In general, I have no qualms though; I'd love to see it gone.
const minAlt = parseInt(altitudeRestriction.replace(ABOVE_SYMBOL, ''), DECIMAL_RADIX); | ||
const minimumAltitudeWithoutSymbol = minAlt * FL_TO_THOUSANDS_MULTIPLIER; | ||
|
||
this.altitude = Math.min(minimumAltitudeWithoutSymbol, cruiseAltitude); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@erikquinn is Math.min
correct here? I would thin it should be cruiseAltitude
unless minimumAltitudeWithoutSymbol
is higher.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right; this should be max not min.
…ypoint * Adds tests and supporting fixutes and mocks for Waypoint
…TC-53 Conflicts: - src/assets/scripts/canvas/CanvasController.js - test/airport/fix/FixCollection.spec.js
…s, adds additional test case.
merged incorrectly causing failing tests.
….setAltitude() and .setSpeed(). removes ava.skip from skipped tests in Waypoint.spec
- Replaces KDGB with UNASSIGNED
|
||
// TODO: simplify this | ||
// FIXME: is this.legs an array? | ||
for (const l in this.legs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comments
const legs = []; | ||
const curr = this.currentWaypoint(); // save the current waypoint | ||
// const legs = this._generateLegsForFixOrStandardRoute(route); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment
|
||
if (Object.keys(window.airportController.airport_get().sids).indexOf(pieces[1]) > -1) { | ||
if (typeof currentAirport.sidCollection.findRouteByIcao(routeModel.procedure) !== 'undefined') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace with _isNil()
@@ -975,7 +921,8 @@ export default class AircraftFlightManagementSystem { | |||
return null; | |||
} | |||
|
|||
return `${this.following.sid}.${this.currentLeg().route.split('.')[2]}`; | |||
// TODO: use the `RouteModel` for this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment
* Refactors StandardRouteModel to use _entryCollection, _bodySegmentModel and _exitCollection for both SIDs and STARs * Updates tests * Adds istanbul-ignore to constructors inheriting one of the Base classes
@erikquinn ready for you. I had to modify how the |
this.legs = []; | ||
|
||
this.current = [0, 0]; // [current_Leg, current_Waypoint_within_that_Leg] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the nerdery conventions on whitespacing between properties like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usually, not cool. But there should be doc blocks for each property which is why, I think, I left the spacing here.
I'll add those now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -180,15 +206,17 @@ export default class AircraftFlightManagementSystem { | |||
* Insert a waypoint after the *current* waypoint | |||
*/ | |||
appendWaypoint(data) { | |||
this.currentLeg().waypoints.splice(this.current[WAYPOINT_WITHIN_LEG] + 1, 0, new Waypoint(data, this)); | |||
const airport = window.airportController.airport_get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point, we might want to change airport_get()
to a getter. Just a thought.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added #150 for this
I have questions for some of this stuff...