Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add rough support for ILS approaches (#12)
* Add hacky initial approach steering implementation Currently we just steer directly toward the airport when we've intercepted the localizer, which *may* look okay but is certainly hacky. Still need to implement localizer math, altitude adjustments, and then finally detect landing * Begin work to detect whether an aircraft is intercepting the localizer * Include elevation in runway-coords * Attempt to detect glide slope * Attempt to update altitude when on glide slope to approach runway We probably want to do something smarter here, like compute the *expected altitude* for the glideslope, and apply that instead. * Implement "cancel approach clearance" command * Fix runway parsing * Add *rough* support for handling aircraft landing * Fix cancel-approach grammar to avoid false positives if unparseable * Fix local linting CI seems fine with this but it's struggling locally
- Loading branch information
Showing
14 changed files
with
245 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
(ns atc.data.airports | ||
(:require | ||
[atc.data.core :refer [local-xy]] | ||
[atc.data.units :refer [ft->m]] | ||
[atc.engine.model :refer [vec3]])) | ||
|
||
(defn runway-coords [airport runway] | ||
(when-let [runway-object (->> airport | ||
:runways | ||
(filter #(or (= runway (:start-id %)) | ||
(= runway (:end-id %)))) | ||
first)] | ||
(let [elevation (-> (:position airport) | ||
(nth 2) | ||
ft->m) | ||
start (-> (local-xy (:start-threshold runway-object) airport) | ||
(vec3 elevation)) | ||
end (-> (local-xy (:end-threshold runway-object) airport) | ||
(vec3 elevation))] | ||
(if (= (:start-id runway-object) runway) | ||
[start end] | ||
[end start])))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
(ns atc.data.units | ||
(:require | ||
[clojure.math :refer [floor]])) | ||
|
||
(defn m->ft [meters] | ||
; NOTE: We probably *never* need to do this except for displaying | ||
; or verbally reporting an aircraft's altitude in feet, so let's | ||
; just make it clean: | ||
(floor (* 3.28084 meters))) | ||
|
||
(defn m->nm [meters] | ||
(* 0.000539957 meters)) | ||
|
||
(defn ft->m [feet] | ||
(* 0.3048 feet)) | ||
|
||
(defn nm->m [nautical-miles] | ||
(* 1852 nautical-miles)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
(ns atc.engine.config) | ||
(ns atc.engine.config | ||
(:require | ||
[atc.data.units :as units])) | ||
|
||
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]} | ||
(defrecord AircraftConfig [turn-rate]) | ||
(defrecord AircraftConfig [turn-rate climb-rate descent-rate]) | ||
|
||
(defn create [kvs] | ||
(map->AircraftConfig kvs)) | ||
(-> kvs | ||
(update :climb-rate units/ft->m) | ||
(update :descent-rate units/ft->m) | ||
(map->AircraftConfig))) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.