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 its 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, 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. Any given unit IDs are excluded from the search.
// Each group has BRAA set relative to the given origin. The groups are ordered by increasing distance from the point
// of interest.
FindNearbyGroupsWithBRAA(
origin,
pointOfInterest orb.Point,
minAltitude,
maxAltitude,
radius unit.Length,
coalition coalitions.Coalition,
category brevity.ContactCategory,
excludedIDs []uint64,
) []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. Any given unit IDs are excluded from the search.
// Each group has Bullseye set relative to the point provided in SetBullseye. The groups are ordered by increasing distance
// from the point of interest.
FindNearbyGroupsWithBullseye(
pointOfInterest orb.Point,
minAltitude,
maxAltitude,
radius unit.Length,
coalition coalitions.Coalition,
category brevity.ContactCategory,
excludedIDs []uint64,
) []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)
// SetRemovedCallback sets the callback function to be called when a trackfile is aged out.
SetRemovedCallback(RemovedCallback)
// Threats returns a map of threat groups of the given coalition to threatened object IDs.
Threats(coalitions.Coalition) map[brevity.Group][]uint64
// Merges returns a map of hostile groups of the given coalition to friendly trackfiles.
Merges(coalitions.Coalition) map[brevity.Group][]*trackfiles.Trackfile
}
Radar consumes updates from the simulation, keeps track of each aircraft as a trackfile, and provides functions to collect the aircraft into groups.
type RemovedCallback ¶ added in v0.4.0
type RemovedCallback func(trackfile trackfiles.Trackfile)
RemovedCallback is a callback function that is called when a trackfile is aged out and removed. A copy of the trackfile is provided.
Click to show internal directories.
Click to hide internal directories.