Skip to content
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

Staging #37

Open
wants to merge 73 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
5c0d503
update Cargo.lock
Jun 15, 2021
450aa92
introduce test failure
wucke13 May 24, 2021
4d77007
refine hydrajobs meta
wucke13 Jun 30, 2021
2339426
Revert "introduce test failure"
wucke13 Jul 29, 2021
7f5ad68
bump versions
wucke13 Jul 29, 2021
3a815b7
fix broken no_std build
wucke13 May 20, 2021
c5d2da5
update dependencies
wucke13 Oct 1, 2021
77aab58
major step forward
Nov 2, 2021
672f67f
solve #20: clean up trait usage in `kd_tree`
sevenautumns Nov 26, 2021
a394a36
solve #21 partially
wucke13 Nov 26, 2021
138f24f
allow test & coverage failure on pr to staging
wucke13 Nov 26, 2021
d0ca40c
add automatic download of airports.json
wucke13 Nov 26, 2021
0e1c94c
kd tree benchmark - solve #18 partially
sevenautumns Nov 26, 2021
b8fa162
Add fuzzy test and Readme; solves #18
sevenautumns Nov 29, 2021
a7df2ba
fix compilation with uom issue
wucke13 Jun 8, 2022
0024cee
update deps and flake.nix
Jun 9, 2022
768c64b
more updating + some test case fixing
Jun 9, 2022
5ecc02c
fix: update Cargo.lock
moritz-meier Aug 17, 2022
acfc1f9
fix(opentaws): Impl default trait for TawsConfig
moritz-meier Aug 17, 2022
53075b3
fix(PDA): invalid envelope
moritz-meier Aug 23, 2022
75e704e
Refactor cucumber tests
moritz-meier Aug 23, 2022
f3319a3
fix: use raw string literals for regexprs.
moritz-meier Aug 24, 2022
a73046b
fix: remove unused stuff
moritz-meier Aug 24, 2022
f7eada8
fix: remove cucumber steps with todos.
moritz-meier Aug 24, 2022
1f988ab
fix: regex version
moritz-meier Aug 24, 2022
115d69a
fix: constraint type bounds
moritz-meier Aug 24, 2022
6f77642
fix: removed the mould out out openTAWS
moritz-meier Aug 24, 2022
7ac071d
fix: remove todo/empty cucumber step
moritz-meier Aug 29, 2022
d284f2d
factor out ConstraintEnforcer impl from AircraftStateConstraints
moritz-meier Aug 29, 2022
cca0a5b
fix(taws_minimal): Refactor Constraint and AircraftStateConstraints
moritz-meier Sep 4, 2022
ee60b85
fix(integration tests): implement phases
moritz-meier Sep 5, 2022
5ae6da5
fix(Mode3): invalid envelope
moritz-meier Sep 5, 2022
e47a7dc
fix(AircraftStateConstraints): make boolean constraints optional
moritz-meier Sep 5, 2022
b907d5b
fix(integration tests): impl then_alert_armed
moritz-meier Sep 5, 2022
ee6fed9
cleanup
moritz-meier Sep 6, 2022
7b5d66c
fix staging build
wucke13 Nov 28, 2022
0fbd157
update github actions workflow
wucke13 Nov 28, 2022
a61ab97
fix
moritz-meier Sep 12, 2022
6908266
fix
moritz-meier Sep 13, 2022
d22ac89
revises PDA cucumber feature
moritz-meier Sep 22, 2022
ba562e7
revises Mode1 cucumber feature
moritz-meier Sep 22, 2022
35698af
fix
moritz-meier Sep 22, 2022
4e606b0
fix
moritz-meier Sep 22, 2022
b7d070b
fix
moritz-meier Sep 22, 2022
a81a657
revises Mode3 cucumber feature
moritz-meier Sep 23, 2022
b730e90
revises FFAC cucumber feature
moritz-meier Sep 23, 2022
561d564
rework opentaws implementation
moritz-meier Oct 10, 2022
ca3932a
rework opentaws implementation
moritz-meier Oct 11, 2022
3f2de8b
wip
moritz-meier Nov 1, 2022
35fe6fe
wip
moritz-meier Nov 1, 2022
9d6ffc2
fix
moritz-meier May 15, 2023
16bab21
fix
moritz-meier Jun 2, 2023
ff4e7ed
fix
moritz-meier Jun 2, 2023
c5a119f
Add armv7a-none-eabi target
Jun 7, 2023
fc5e4c5
Readd serde support
Jun 7, 2023
f711303
Readd import because it is needed when using the opentaws crate
Jun 7, 2023
569f06d
feat: update heapless
moritz-meier Sep 20, 2023
1b22715
feat: impl IntoIterator for TawsAlerts
moritz-meier Sep 20, 2023
0744334
fix: ClassC_Source::into_iter
moritz-meier Sep 20, 2023
867980a
fix: TawsAlertSources::NUM_ALERT_SOURCES
moritz-meier Sep 20, 2023
bea17e9
feat: alert prioritization
moritz-meier Sep 21, 2023
3acfcb1
docs
moritz-meier Sep 21, 2023
a794276
Update rust.yml
Oct 10, 2023
a0ec3b0
Revert "Readd import because it is needed when using the opentaws crate"
Jun 7, 2023
d0c236d
Revert "Readd serde support"
Jun 7, 2023
fcf8b4d
Revert "Add armv7a-none-eabi target"
Jun 7, 2023
19e029f
Add armv7a-none-eabi to nix flake
moritz-meier Sep 22, 2023
6a2b9f8
fix nix flake
moritz-meier Sep 22, 2023
09cd7c9
fix unused import
moritz-meier Sep 22, 2023
d488014
fix cargo resolver warning
moritz-meier Sep 22, 2023
7cb3206
feat: serde support for AircraftState and Alert
moritz-meier Sep 22, 2023
540e5df
remove use-serde from default features
moritz-meier Sep 22, 2023
cb90060
fix: update cargo.lock
moritz-meier Oct 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(taws_minimal): Refactor Constraint and AircraftStateConstraints
  • Loading branch information
moritz-meier authored and wucke13 committed Nov 1, 2022
commit cca0a5b3bc161d9f68823ec38d636594d276a3fe
30 changes: 15 additions & 15 deletions taws_minimal/tests/cucumber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ fn given_height_above_terrain(world: &mut MyWorld, height_above_terrain: Constra

let unit = Length::new::<length::foot>(1.0);
let height_above_terrain = match height_above_terrain {
Constraint::AtLeast(p, a) => Constraint::AtLeast(p, a * unit),
Constraint::AtMost(p, a) => Constraint::AtMost(p, a * unit),
Constraint::Equal(p, a) => Constraint::Equal(p, a * unit),
Constraint::InRange(p, a, b) => Constraint::InRange(p, a * unit, b * unit),
Constraint::NotInRange(p, a, b) => Constraint::NotInRange(p, a * unit, b * unit),
Constraint::AtLeast(a) => Constraint::AtLeast(a * unit),
Constraint::AtMost(a) => Constraint::AtMost(a * unit),
Constraint::Equal(a) => Constraint::Equal(a * unit),
Constraint::InRange(a, b) => Constraint::InRange(a * unit, b * unit),
Constraint::NotInRange(a, b) => Constraint::NotInRange(a * unit, b * unit),
};

world.constraints[world.phase].add_altitude_ground_constraint(height_above_terrain);
Expand All @@ -86,11 +86,11 @@ fn when_rate_of_descent(world: &mut MyWorld, rate_of_descent: ConstraintParamete

let unit = Velocity::new::<velocity::foot_per_minute>(-1.0);
let climb_rate = match rate_of_descent {
Constraint::AtLeast(p, a) => Constraint::AtMost(p, a * unit),
Constraint::AtMost(p, a) => Constraint::AtLeast(p, a * unit),
Constraint::Equal(p, a) => Constraint::Equal(p, a * unit),
Constraint::InRange(p, a, b) => Constraint::InRange(p, b * unit, a * unit),
Constraint::NotInRange(p, a, b) => Constraint::NotInRange(p, b * unit, a * unit),
Constraint::AtLeast(a) => Constraint::AtMost(a * unit),
Constraint::AtMost(a) => Constraint::AtLeast(a * unit),
Constraint::Equal(a) => Constraint::Equal(a * unit),
Constraint::InRange(a, b) => Constraint::InRange(b * unit, a * unit),
Constraint::NotInRange(a, b) => Constraint::NotInRange(b * unit, a * unit),
};

world.constraints[world.phase].add_climb_rate_constraint(climb_rate);
Expand All @@ -102,11 +102,11 @@ fn when_height_above_terrain(world: &mut MyWorld, height_above_ground: Constrain

let unit = Length::new::<length::foot>(1.0);
let height_above_ground = match height_above_ground {
Constraint::AtLeast(p, a) => Constraint::AtLeast(p, a * unit),
Constraint::AtMost(p, a) => Constraint::AtMost(p, a * unit),
Constraint::Equal(p, a) => Constraint::Equal(p, a * unit),
Constraint::InRange(p, a, b) => Constraint::InRange(p, a * unit, b * unit),
Constraint::NotInRange(p, a, b) => Constraint::NotInRange(p, a * unit, b * unit),
Constraint::AtLeast(a) => Constraint::AtLeast(a * unit),
Constraint::AtMost(a) => Constraint::AtMost(a * unit),
Constraint::Equal(a) => Constraint::Equal(a * unit),
Constraint::InRange(a, b) => Constraint::InRange(a * unit, b * unit),
Constraint::NotInRange(a, b) => Constraint::NotInRange(a * unit, b * unit),
};

world.constraints[world.phase].add_altitude_ground_constraint(height_above_ground);
Expand Down
214 changes: 0 additions & 214 deletions taws_minimal/tests/util/constraints/aircraft_state_constraint.rs

This file was deleted.

126 changes: 126 additions & 0 deletions taws_minimal/tests/util/constraints/aircraft_state_constraints.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
use opentaws::prelude::*;
use uom::si::f64::{Angle, Length, Velocity};

use super::{constraint_enforcement, Constraint, ConstraintEnforcer};

#[derive(Clone, Default, PartialEq)]
pub struct AircraftStateConstraints {
altitude: Option<Constraint<Length>>,
altitude_ground: Option<Constraint<Length>>,
climb_rate: Option<Constraint<Velocity>>,
speed_air: Option<Constraint<Velocity>>,
heading: Option<Constraint<Angle>>,
pitch: Option<Constraint<Angle>>,
roll: Option<Constraint<Angle>>,

steep_approach: bool,
precision_approach: bool,
go_around: bool,
take_off: bool,
}

impl AircraftStateConstraints {
fn apply<Q, TEnforcer>(constraint: &Option<Constraint<Q>>, state: &mut Q)
where
Q: Copy
+ PartialOrd
+ PartialEq<Q>
+ std::ops::Add<Output = Q>
+ std::ops::Rem<Output = Q>
+ std::ops::Sub<Output = Q>
+ constraint_enforcement::Abs
+ std::fmt::Debug,
TEnforcer: ConstraintEnforcer<Q> + Default,
{
if let Some(constraint) = constraint {
constraint.apply_to::<TEnforcer>(state);
constraint.check(*state);
}
}

pub fn apply_to<TEnforcer>(&self, state: &mut AircraftState)
where
TEnforcer: ConstraintEnforcer<Length>
+ ConstraintEnforcer<Velocity>
+ ConstraintEnforcer<Angle>
+ Default,
{
Self::apply::<Length, TEnforcer>(&self.altitude, &mut state.altitude);
Self::apply::<Length, TEnforcer>(&self.altitude_ground, &mut state.altitude_ground);
Self::apply::<Velocity, TEnforcer>(&self.climb_rate, &mut state.climb_rate);
Self::apply::<Velocity, TEnforcer>(&self.speed_air, &mut state.speed_air);
Self::apply::<Angle, TEnforcer>(&self.heading, &mut state.heading);
Self::apply::<Angle, TEnforcer>(&self.pitch, &mut state.pitch);
Self::apply::<Angle, TEnforcer>(&self.roll, &mut state.roll);

state.steep_approach = self.steep_approach;
state.precision_approach = self.precision_approach;
state.go_around = self.go_around;
state.take_off = self.take_off;
}

pub fn add_altitude_constraint(&mut self, c: Constraint<Length>) {
self.altitude = match &self.altitude {
Some(altitude) => Some(altitude.merge(&c).unwrap()),
None => Some(c),
}
}

pub fn add_altitude_ground_constraint(&mut self, c: Constraint<Length>) {
self.altitude_ground = match &self.altitude_ground {
Some(altitude_gnd) => Some(altitude_gnd.merge(&c).unwrap()),
None => Some(c),
}
}

pub fn add_climb_rate_constraint(&mut self, c: Constraint<Velocity>) {
self.climb_rate = match &self.climb_rate {
Some(climb_rate) => Some(climb_rate.merge(&c).unwrap()),
None => Some(c),
}
}

pub fn add_speed_air_constraint(&mut self, c: Constraint<Velocity>) {
self.speed_air = match &self.speed_air {
Some(speed_air) => Some(speed_air.merge(&c).unwrap()),
None => Some(c),
}
}

pub fn add_heading_constraint(&mut self, c: Constraint<Angle>) {
self.heading = match &self.heading {
Some(heading) => Some(heading.merge(&c).unwrap()),
None => Some(c),
}
}

pub fn add_pitch_constraint(&mut self, c: Constraint<Angle>) {
self.pitch = match &self.pitch {
Some(pitch) => Some(pitch.merge(&c).unwrap()),
None => Some(c),
}
}

pub fn add_roll_constraint(&mut self, c: Constraint<Angle>) {
self.roll = match &self.roll {
Some(roll) => Some(roll.merge(&c).unwrap()),
None => Some(c),
}
}

pub fn add_steep_approach_constraint(&mut self, c: bool) {
self.steep_approach = c;
}

pub fn add_precision_approach_constraint(&mut self, c: bool) {
self.precision_approach = c;
}

pub fn add_go_around_constraint(&mut self, c: bool) {
self.go_around = c;
}

pub fn add_take_off_constraint(&mut self, c: bool) {
self.take_off = c;
}
}
Loading