step one
This commit is contained in:
parent
7a8d5d13fa
commit
9e663db9dc
68 changed files with 5647 additions and 2958 deletions
47
internal/engine/constraints.go
Normal file
47
internal/engine/constraints.go
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
package engine
|
||||
|
||||
// MaxAltitude triggers when altitude rises above Limit (in metres).
|
||||
// Used as the burst condition for ascent stages.
|
||||
type MaxAltitude struct {
|
||||
Limit float64
|
||||
On Action
|
||||
}
|
||||
|
||||
func (c MaxAltitude) Name() string { return "max_altitude" }
|
||||
func (c MaxAltitude) Violated(_ float64, s State) bool { return s.Altitude >= c.Limit }
|
||||
func (c MaxAltitude) Action() Action { return c.On }
|
||||
|
||||
// MinAltitude triggers when altitude falls at or below Limit (in metres).
|
||||
// With Limit=0 this is the "sea level" terminator.
|
||||
type MinAltitude struct {
|
||||
Limit float64
|
||||
On Action
|
||||
}
|
||||
|
||||
func (c MinAltitude) Name() string { return "min_altitude" }
|
||||
func (c MinAltitude) Violated(_ float64, s State) bool { return s.Altitude <= c.Limit }
|
||||
func (c MinAltitude) Action() Action { return c.On }
|
||||
|
||||
// MaxTime triggers when t exceeds Limit (UNIX seconds). Used as a stop
|
||||
// condition for float profiles.
|
||||
type MaxTime struct {
|
||||
Limit float64
|
||||
On Action
|
||||
}
|
||||
|
||||
func (c MaxTime) Name() string { return "max_time" }
|
||||
func (c MaxTime) Violated(t float64, _ State) bool { return t > c.Limit }
|
||||
func (c MaxTime) Action() Action { return c.On }
|
||||
|
||||
// TerrainContact triggers when altitude has dropped at or below ground level.
|
||||
// Equivalent to Tawhiri's elevation termination.
|
||||
type TerrainContact struct {
|
||||
Provider TerrainProvider
|
||||
On Action
|
||||
}
|
||||
|
||||
func (c TerrainContact) Name() string { return "terrain_contact" }
|
||||
func (c TerrainContact) Violated(_ float64, s State) bool {
|
||||
return c.Provider.Elevation(s.Lat, s.Lng) > s.Altitude
|
||||
}
|
||||
func (c TerrainContact) Action() Action { return c.On }
|
||||
Loading…
Add table
Add a link
Reference in a new issue