radar

package
v0.2.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2024 License: MIT Imports: 23 Imported by: 1

Documentation

Overview

package radar implements mid-level logic for Ground-Controlled Interception (GCI)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FadedCallback

type FadedCallback func(group brevity.Group, coalition coalitions.Coalition)

FadedCallback is a callback function that is called when a group has not been updated by sensors for a timeout period. The group and it's coalition are provided.

type Radar

type Radar interface {
	// SetBullseye updates the bullseye point for the given coalition.
	// The bullseye point is the reference point for polar coordinates provided in [Group.Bullseye].
	SetBullseye(orb.Point, coalitions.Coalition)
	// Bullseye returns the bullseye point for the given coalition.
	Bullseye(coalitions.Coalition) orb.Point
	// SetMissionTime updates the mission time. The mission time is used for computing magnetic declination.
	SetMissionTime(time.Time)
	// Declination returns the magnetic declination at the given point, at the time provided in SetMissionTime.
	Declination(orb.Point) unit.Angle
	// Run consumes updates from the simulation channels until the context is cancelled.
	Run(context.Context, *sync.WaitGroup)
	// FindCallsign returns the trackfile on the given coalition that mosty closely matches the given callsign,
	// or nil if no closely matching trackfile was found.
	// The first return value is the callsign of the trackfile, and the second is the trackfile itself.
	// The returned callsign may differ from the input callsign!
	FindCallsign(string, coalitions.Coalition) (string, *trackfiles.Trackfile)
	// FindUnit returns the trackfile for the given unit ID and coalition, or nil if no trackfile was found.
	FindUnit(uint64) *trackfiles.Trackfile
	// GetPicture returns a picture of the radar scope anchored at the center point, within the given radius,
	// filtered by the given coalition and contact category. The first return value is the total number of groups
	// and the second is a slice of up to to 3 high priority groups. Each group has Bullseye set relative to the
	// the point provided in SetBullseye.
	GetPicture(
		radius unit.Length,
		coalition coalitions.Coalition,
		category brevity.ContactCategory,
	) (int, []brevity.Group)
	// FindNearbyGroupsWithBRAA returns all groups within the given radius of the given point of interest, within the given
	// altitude block, filtered by the given coalition and contact category. Each group has BRAA set relative to the
	// given origin.
	FindNearbyGroupsWithBRAA(
		origin,
		pointOfInterest orb.Point,
		minAltitude,
		maxAltitude,
		radius unit.Length,
		coalition coalitions.Coalition,
		category brevity.ContactCategory,
	) []brevity.Group
	// FindNearbyGroupsWithBullseye returns all groups within the given radius of the given point of interest, within the given
	// altitude block, filtered by the given coalition and contact category. Each group has Bullseye set relative to the
	// point provided in SetBullseye.
	FindNearbyGroupsWithBullseye(
		pointOfInterest orb.Point,
		minAltitude,
		maxAltitude,
		radius unit.Length,
		coalition coalitions.Coalition,
		category brevity.ContactCategory,
	) []brevity.Group
	// FindNearestGroupWithBRAA returns the nearest group to the given origin (up to the given radius), within the
	// given altitude block, filtered by the given coalition and contact category. The group has BRAA set relative to
	// the given origin. Returns nil if no group was found.
	FindNearestGroupWithBRAA(
		origin orb.Point,
		minAltitude,
		maxAltitude,
		radius unit.Length,
		coalition coalitions.Coalition,
		category brevity.ContactCategory,
	) brevity.Group
	// FindNearestGroupWithBullseye returns the nearest group to the given point of interest (up to the given radius),
	// within the given altitude block, filtered by the given coalition and contact category. The group has Bullseye
	// set relative to the point provided in SetBullseye. Returns nil if no group was found.
	FindNearestGroupWithBullseye(
		pointOfIntest orb.Point,
		minAltitude,
		maxAltitude,
		radius unit.Length,
		coalition coalitions.Coalition,
		category brevity.ContactCategory,
	) brevity.Group
	// FindNearestGroupInSector returns the nearest group to the given origin (up to the given distance), within a 2D
	// circular sector defined by the given origin ,radius, bearing and arc, within the given altitude block, filtered
	// by the given coalition and contact category. The group has BRAA set relative to the given origin. Returns nil if
	// no group was found.
	FindNearestGroupInSector(
		origin orb.Point,
		minAltitude,
		maxAltitude,
		radius unit.Length,
		bearing bearings.Bearing,
		arc unit.Angle,
		coalition coalitions.Coalition,
		category brevity.ContactCategory,
	) brevity.Group
	// SetFadedCallback sets the callback function to be called when a trackfile fades.
	SetFadedCallback(FadedCallback)
	// Threats returns a map of threat groups of the given coalition to threatened object IDs.
	Threats(coalitions.Coalition) map[brevity.Group][]uint64
}

Radar consumes updates from the simulation, keeps track of each aircraft as a trackfile, and provides functions to collect the aircraft into groups.

func New

func New(coalition coalitions.Coalition, updates <-chan sim.Updated, fades <-chan sim.Faded, mandatoryThreatRadius unit.Length) Radar

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL