Module AI_A2A
AI -- AI A2A Air Patrolling or Staging.
Author: Sven Van de Velde (FlightControl)
Contributions:
- Dutch_Baron: Working together with James has resulted in the creation of the AI_BALANCER class.
James has shared his ideas on balancing AI with air units, and together we made a first design which you can use now :-) * Pikey: Testing and API concept review.
Global(s)
| AI_A2A |
AI_A2A class, extends Fsm#FSM_CONTROLLABLEThe AI_A2A class implements the core functions to operate an AI Group A2A tasking. |
Type AI_A2A
Global(s)
- #AI_A2A AI_A2A
-
AI_A2A class, extends Fsm#FSM_CONTROLLABLE
The AI_A2A class implements the core functions to operate an AI Group A2A tasking.
AI_A2A constructor
- AI_A2A.New(): Creates a new AI_A2A object.
2. AI_A2A is a FSM
2.1. AI_A2A States
- None ( Group ): The process is not started yet.
- Patrolling ( Group ): The AI is patrolling the Patrol Zone.
- Returning ( Group ): The AI is returning to Base.
- Stopped ( Group ): The process is stopped.
- Crashed ( Group ): The AI has crashed or is dead.
2.2. AI_A2A Events
- Start ( Group ): Start the process.
- Stop ( Group ): Stop the process.
- Route ( Group ): Route the AI to a new random 3D point within the Patrol Zone.
- RTB ( Group ): Route the AI to the home base.
- Detect ( Group ): The AI is detecting targets.
- Detected ( Group ): The AI has detected new targets.
- Status ( Group ): The AI is checking status (fuel and damage). When the tresholds have been reached, the AI will RTB.
3. Set or Get the AI controllable
- AI_A2A.SetControllable(): Set the AIControllable.
- AI_A2A.GetControllable(): Get the AIControllable.
Type AI_A2A
Field(s)
- #boolean AI_A2A.CheckStatus
- #number AI_A2A.IdleCount
- AI_A2A:New(AIGroup)
-
Creates a new AI_A2A object
Parameter
-
Wrapper.Group#GROUP AIGroup: The GROUP object to receive the A2A Process.
Return value
-
- AI_A2A:OnAfterRTB(Controllable, From, Event, To)
-
OnAfter Transition Handler for Event RTB.
Parameters
-
Wrapper.Controllable#CONTROLLABLE Controllable: The Controllable Object managed by the FSM. -
#string From: The From State string. -
#string Event: The Event string. -
#string To: The To State string.
-
- AI_A2A:OnAfterRefuel(Controllable, From, Event, To)
-
Refuel Handler OnAfter for AI_A2A
Parameters
-
Wrapper.Controllable#CONTROLLABLE Controllable: The Controllable Object managed by the FSM. -
#string From: -
#string Event: -
#string To:
-
- AI_A2A:OnAfterStart(From, Event, To)
-
Start Handler OnAfter for AI_A2A
Parameters
-
#string From: -
#string Event: -
#string To:
-
- AI_A2A:OnAfterStatus(Controllable, From, Event, To)
-
OnAfter Transition Handler for Event Status.
Parameters
-
Wrapper.Controllable#CONTROLLABLE Controllable: The Controllable Object managed by the FSM. -
#string From: The From State string. -
#string Event: The Event string. -
#string To: The To State string.
-
- AI_A2A:OnAfterStop(Controllable, From, Event, To)
-
OnAfter Transition Handler for Event Stop.
Parameters
-
Wrapper.Controllable#CONTROLLABLE Controllable: The Controllable Object managed by the FSM. -
#string From: The From State string. -
#string Event: The Event string. -
#string To: The To State string.
-
- AI_A2A:OnBeforeRTB(Controllable, From, Event, To)
-
OnBefore Transition Handler for Event RTB.
Parameters
-
Wrapper.Controllable#CONTROLLABLE Controllable: The Controllable Object managed by the FSM. -
#string From: The From State string. -
#string Event: The Event string. -
#string To: The To State string.
Return value
#boolean: Return false to cancel Transition.
-
- AI_A2A:OnBeforeRefuel(Controllable, From, Event, To)
-
Refuel Handler OnBefore for AI_A2A
Parameters
-
Wrapper.Controllable#CONTROLLABLE Controllable: The Controllable Object managed by the FSM. -
#string From: -
#string Event: -
#string To:
Return value
#boolean:
-
- AI_A2A:OnBeforeStart(From, Event, To)
-
Start Handler OnBefore for AI_A2A
Parameters
-
#string From: -
#string Event: -
#string To:
Return value
#boolean:
-
- AI_A2A:OnBeforeStatus(Controllable, From, Event, To)
-
OnBefore Transition Handler for Event Status.
Parameters
-
Wrapper.Controllable#CONTROLLABLE Controllable: The Controllable Object managed by the FSM. -
#string From: The From State string. -
#string Event: The Event string. -
#string To: The To State string.
Return value
#boolean: Return false to cancel Transition.
-
- AI_A2A:OnBeforeStop(Controllable, From, Event, To)
-
OnBefore Transition Handler for Event Stop.
Parameters
-
Wrapper.Controllable#CONTROLLABLE Controllable: The Controllable Object managed by the FSM. -
#string From: The From State string. -
#string Event: The Event string. -
#string To: The To State string.
Return value
#boolean: Return false to cancel Transition.
-
- AI_A2A:OnCrash(EventData)
-
Parameter
-
Core.Event#EVENTDATA EventData:
-
- AI_A2A:OnEjection(EventData)
-
Parameter
-
Core.Event#EVENTDATA EventData:
-
- AI_A2A:OnEnterReturning(Controllable, From, Event, To)
-
OnEnter Transition Handler for State Returning.
Parameters
-
Wrapper.Controllable#CONTROLLABLE Controllable: The Controllable Object managed by the FSM. -
#string From: The From State string. -
#string Event: The Event string. -
#string To: The To State string.
-
- AI_A2A:OnEnterStopped(Controllable, From, Event, To)
-
OnEnter Transition Handler for State Stopped.
Parameters
-
Wrapper.Controllable#CONTROLLABLE Controllable: The Controllable Object managed by the FSM. -
#string From: The From State string. -
#string Event: The Event string. -
#string To: The To State string.
-
- AI_A2A:OnLeaveReturning(Controllable, From, Event, To)
-
OnLeave Transition Handler for State Returning.
Parameters
-
Wrapper.Controllable#CONTROLLABLE Controllable: The Controllable Object managed by the FSM. -
#string From: The From State string. -
#string Event: The Event string. -
#string To: The To State string.
Return value
#boolean: Return false to cancel Transition.
-
- AI_A2A:OnLeaveStopped(Controllable, From, Event, To)
-
OnLeave Transition Handler for State Stopped.
Parameters
-
Wrapper.Controllable#CONTROLLABLE Controllable: The Controllable Object managed by the FSM. -
#string From: The From State string. -
#string Event: The Event string. -
#string To: The To State string.
Return value
#boolean: Return false to cancel Transition.
-
- AI_A2A:OnPilotDead(EventData)
-
Parameter
-
Core.Event#EVENTDATA EventData:
-
- #boolean AI_A2A.PatrolManageDamage
- #boolean AI_A2A.PatrolManageFuel
- AI_A2A:RTB()
-
Synchronous Event Trigger for Event RTB.
- AI_A2A.RTBHold(AIGroup, Fsm)
-
Parameters
-
Wrapper.Group#GROUP AIGroup: -
Fsm:
-
- AI_A2A.RTBRoute(AIGroup, Fsm)
-
Parameters
-
Wrapper.Group#GROUP AIGroup: -
Fsm:
-
- AI_A2A:Refuel()
-
Refuel Trigger for AI_A2A
- AI_A2A.Resume(AIGroup, Fsm)
-
Parameters
-
Wrapper.Group#GROUP AIGroup: -
Fsm:
-
- AI_A2A:SetAltitude(PatrolFloorAltitude, PatrolCeilingAltitude)
-
Sets the floor and ceiling altitude of the patrol.
Parameters
-
Dcs.DCSTypes#Altitude PatrolFloorAltitude: The lowest altitude in meters where to execute the patrol. -
Dcs.DCSTypes#Altitude PatrolCeilingAltitude: The highest altitude in meters where to execute the patrol.
Return value
#AI_A2A: self
-
- AI_A2A:SetDamageThreshold(PatrolDamageThreshold)
-
When the AI is damaged beyond a certain treshold, it is required that the AI returns to the home base.
However, damage cannot be foreseen early on. Therefore, when the damage treshold is reached, the AI will return immediately to the home base (RTB). Note that for groups, the average damage of the complete group will be calculated. So, in a group of 4 airplanes, 2 lost and 2 with damage 0.2, the damage treshold will be 0.25.
Parameter
-
#number PatrolDamageThreshold: The treshold in percentage (between 0 and 1) when the AI is considered to be damaged.
Return value
#AI_A2A: self
-
- AI_A2A:SetDisengageRadius(DisengageRadius)
-
Sets the disengage range, that when engaging a target beyond the specified range, the engagement will be cancelled and the plane will RTB.
Parameter
-
#number DisengageRadius: The disengage range.
Return value
#AI_A2A: self
-
- AI_A2A:SetDispatcher(Dispatcher)
-
Parameter
-
Dispatcher:
-
- AI_A2A:SetFuelThreshold(PatrolFuelThresholdPercentage, PatrolOutOfFuelOrbitTime)
-
When the AI is out of fuel, it is required that a new AI is started, before the old AI can return to the home base.
Therefore, with a parameter and a calculation of the distance to the home base, the fuel treshold is calculated. When the fuel treshold is reached, the AI will continue for a given time its patrol task in orbit, while a new AIControllable is targetted to the AI_A2A. Once the time is finished, the old AI will return to the base.
Parameters
-
#number PatrolFuelThresholdPercentage: The treshold in percentage (between 0 and 1) when the AIControllable is considered to get out of fuel. -
#number PatrolOutOfFuelOrbitTime: The amount of seconds the out of fuel AIControllable will orbit before returning to the base.
Return value
#AI_A2A: self
-
- AI_A2A:SetHomeAirbase(HomeAirbase)
-
Sets the home airbase.
Parameter
-
Wrapper.Airbase#AIRBASE HomeAirbase:
Return value
#AI_A2A: self
-
- AI_A2A:SetSpeed(PatrolMinSpeed, PatrolMaxSpeed)
-
Sets (modifies) the minimum and maximum speed of the patrol.
Parameters
-
Dcs.DCSTypes#Speed PatrolMinSpeed: The minimum speed of the Controllable in km/h. -
Dcs.DCSTypes#Speed PatrolMaxSpeed: The maximum speed of the Controllable in km/h.
Return value
#AI_A2A: self
-
- AI_A2A:SetStatusOff()
-
Set the status checking off.
Return value
#AI_A2A: self
- AI_A2A:SetTanker(TankerName)
-
Sets to refuel at the given tanker.
Parameter
-
Wrapper.Group#GROUP TankerName: The group name of the tanker as defined within the Mission Editor or spawned.
Return value
#AI_A2A: self
-
- AI_A2A:SetTargetDistance(Coordinate)
-
Parameter
-
Coordinate:
-
- AI_A2A:Start()
-
Start Trigger for AI_A2A
- AI_A2A:Status()
-
Synchronous Event Trigger for Event Status.
- AI_A2A:Stop()
-
Synchronous Event Trigger for Event Stop.
- AI_A2A:__RTB(Delay)
-
Asynchronous Event Trigger for Event RTB.
Parameter
-
#number Delay: The delay in seconds.
-
- AI_A2A:__Refuel(Delay)
-
Refuel Asynchronous Trigger for AI_A2A
Parameter
-
#number Delay:
-
- AI_A2A:__Start(Delay)
-
Start Asynchronous Trigger for AI_A2A
Parameter
-
#number Delay:
-
- AI_A2A:__Status(Delay)
-
Asynchronous Event Trigger for Event Status.
Parameter
-
#number Delay: The delay in seconds.
-
- AI_A2A:__Stop(Delay)
-
Asynchronous Event Trigger for Event Stop.
Parameter
-
#number Delay: The delay in seconds.
-
- AI_A2A:onafterHold(AIGroup, From, Event, To, HoldTime)
-
Parameters
-
Wrapper.Group#GROUP AIGroup: -
From: -
Event: -
To: -
HoldTime:
-
- AI_A2A:onafterHome(AIGroup, From, Event, To)
-
Parameters
-
Wrapper.Group#GROUP AIGroup: -
From: -
Event: -
To:
-
- AI_A2A:onafterRTB(AIGroup, From, Event, To)
-
Parameters
-
Wrapper.Group#GROUP AIGroup: -
From: -
Event: -
To:
-
- AI_A2A:onafterRefuel(AIGroup, From, Event, To)
-
Parameters
-
Wrapper.Group#GROUP AIGroup: -
From: -
Event: -
To:
-
- AI_A2A:onafterStart(Controllable, From, Event, To)
-
Defines a new patrol route using the Process_PatrolZone parameters and settings.
Parameters
-
Wrapper.Controllable#CONTROLLABLE Controllable: The Controllable Object managed by the FSM. -
#string From: The From State string. -
#string Event: The Event string. -
#string To: The To State string.
Return value
#AI_A2A: self
-