diff --git a/pkg/radar/radar.go b/pkg/radar/radar.go index 230ea5a2..3c996924 100644 --- a/pkg/radar/radar.go +++ b/pkg/radar/radar.go @@ -320,17 +320,19 @@ func (s *scope) handleGarbageCollection() { // isValidTrack checks if the trackfile is valid. This means the following conditions are met: // - Last known position is not (0, 0) -// - Speed is above 50 knots +// - If AGL is known, AGL is above 10 meters +// - If AGL is unknown, speed is above 50 knots func isValidTrack(trackfile *trackfiles.Trackfile) bool { - isValidPosition := !spatial.IsZero(trackfile.LastKnown().Point) - isAboveSpeedFilter := trackfile.Speed() > 50*unit.Knot + if spatial.IsZero(trackfile.LastKnown().Point) { + return false + } + agl := trackfile.LastKnown().AGL - isAboveTerrainFilter := agl != nil && *agl > 10*unit.Meter if agl != nil { - return isValidPosition && isAboveTerrainFilter - } else { - return isValidPosition && isAboveSpeedFilter + return *agl > 10*unit.Meter } + + return trackfile.Speed() > 50*unit.Knot } // isMatch checks: diff --git a/pkg/telemetry/client.go b/pkg/telemetry/client.go index 0b5de78b..20f66818 100644 --- a/pkg/telemetry/client.go +++ b/pkg/telemetry/client.go @@ -181,7 +181,7 @@ func (c *client) sendUpdates(updates chan<- sim.Updated) { if coordinates.Heading != nil { frame.Heading = *coordinates.Heading } - if agl, err := object.GetLength(properties.AGL); err != nil { + if agl, err := object.GetLength(properties.AGL); err == nil { frame.AGL = &agl }