Module AI_Cargo_Dispatcher

AI -- (R2.4) - Models the intelligent transportation of infantry and other cargo.


Author: FlightControl


Global(s)

AI_CARGO_DISPATCHER

AI_CARGO_DISPATCHER class, extends Core.Fsm#FSM


AI_CARGO_DISPATCHER brings a dynamic cargo handling capability for AI groups.

Type AI_CARGO_DISPATCHER

AI_CARGO_DISPATCHER.AI_Cargo
AI_CARGO_DISPATCHER.CarrierHome
AI_CARGO_DISPATCHER.DeployInnerRadius
AI_CARGO_DISPATCHER.DeployMaxSpeed
AI_CARGO_DISPATCHER.DeployMinSpeed
AI_CARGO_DISPATCHER.DeployOuterRadius
AI_CARGO_DISPATCHER.DeployRadiusInner
AI_CARGO_DISPATCHER.DeployRadiusOuter
AI_CARGO_DISPATCHER.HomeZone
AI_CARGO_DISPATCHER.MonitorTimeInterval
AI_CARGO_DISPATCHER:New(SetCarrier, SetCargo, SetDeployZone, SetDeployZones)

Creates a new AICARGODISPATCHER object.

AI_CARGO_DISPATCHER:OnAfterLoaded(From, Event, To, Carrier, Cargo)

Loaded Handler OnAfter for AICARGODISPATCHER

AI_CARGO_DISPATCHER:OnAfterStart(From, Event, To)

Start Handler OnAfter for AICARGODISPATCHER

AI_CARGO_DISPATCHER:OnAfterStop(From, Event, To)

Stop Handler OnAfter for AICARGODISPATCHER

AI_CARGO_DISPATCHER:OnAfterUnloaded(From, Event, To, Carrier, Cargo)

Unloaded Handler OnAfter for AICARGODISPATCHER

AI_CARGO_DISPATCHER:OnBeforeStart(From, Event, To)

Start Handler OnBefore for AICARGODISPATCHER

AI_CARGO_DISPATCHER:OnBeforeStop(From, Event, To)

Stop Handler OnBefore for AICARGODISPATCHER

AI_CARGO_DISPATCHER.PickupCargo
AI_CARGO_DISPATCHER.PickupInnerRadius
AI_CARGO_DISPATCHER.PickupMaxSpeed
AI_CARGO_DISPATCHER.PickupMinSpeed
AI_CARGO_DISPATCHER.PickupOuterRadius
AI_CARGO_DISPATCHER.SetCargo
AI_CARGO_DISPATCHER.SetCarrier
AI_CARGO_DISPATCHER:SetDeployRadius(OuterRadius, InnerRadius)

Sets or randomizes the deploy location for the carrier around the cargo coordinate in a radius defined an outer and an optional inner radius.

AI_CARGO_DISPATCHER:SetDeploySpeed(MaxSpeed, MinSpeed)

Sets or randomizes the speed in km/h to deploy the cargo.

AI_CARGO_DISPATCHER.SetDeployZones
AI_CARGO_DISPATCHER:SetHomeZone(HomeZone)

Set the home zone.

AI_CARGO_DISPATCHER:SetPickupRadius(OuterRadius, InnerRadius)

Sets or randomizes the pickup location for the carrier around the cargo coordinate in a radius defined an outer and optional inner radius.

AI_CARGO_DISPATCHER:SetPickupSpeed(MaxSpeed, MinSpeed)

Set the speed or randomizes the speed in km/h to pickup the cargo.

AI_CARGO_DISPATCHER:Start()

Start Trigger for AICARGODISPATCHER

AI_CARGO_DISPATCHER:Stop()

Stop Trigger for AICARGODISPATCHER

AI_CARGO_DISPATCHER:__Start(Delay)

Start Asynchronous Trigger for AICARGODISPATCHER

AI_CARGO_DISPATCHER:__Stop(Delay)

Stop Asynchronous Trigger for AICARGODISPATCHER

AI_CARGO_DISPATCHER:onafterMonitor()

The Start trigger event, which actually takes action at the specified time interval.

AI_CARGO_DISPATCHER:onafterStart(From, Event, To)

Global(s)

#AI_CARGO_DISPATCHER AI_CARGO_DISPATCHER

AI_CARGO_DISPATCHER class, extends Core.Fsm#FSM


AI_CARGO_DISPATCHER brings a dynamic cargo handling capability for AI groups.

Carrier equipment can be mobilized to intelligently transport infantry and other cargo within the simulation. The AI_CARGO_DISPATCHER module uses the Cargo capabilities within the MOOSE framework, to enable Carrier GROUP objects to transport Cargo towards several deploy zones. CARGO derived objects must be declared within the mission to make the AI_CARGO_DISPATCHER object recognize the cargo. Please consult the Cargo module for more information.

1. AI_CARGO_DISPATCHER constructor

2. AI_CARGO_DISPATCHER is a FSM

Process

2.1. AI_CARGO_DISPATCHER States

  • Monitoring: The process is dispatching.
  • Idle: The process is idle.

2.2. AI_CARGO_DISPATCHER Events

  • Monitor: Monitor and take action.
  • Start: Start the transport process.
  • Stop: Stop the transport process.
  • Pickup: Pickup cargo.
  • Load: Load the cargo.
  • Loaded: Flag that the cargo is loaded.
  • Deploy: Deploy cargo to a location.
  • Unload: Unload the cargo.
  • Unloaded: Flag that the cargo is unloaded.
  • Home: A Carrier is going home.

3. Set the pickup parameters.

Several parameters can be set to pickup cargo:

4. Set the deploy parameters.

Several parameters can be set to deploy cargo:

5. Set the home zone when there isn't any more cargo to pickup.

A home zone can be specified to where the Carriers will move when there isn't any cargo left for pickup. Use AI_CARGO_DISPATCHER.SetHomeZone() to specify the home zone.

If no home zone is specified, the carriers will wait near the deploy zone for a new pickup command.


Type AI_Cargo_Dispatcher

Type AI_CARGO_DISPATCHER

Extends Core.Fsm#FSM

Field(s)

#AI_CARGO_DISPATCHER.AI_Cargo AI_CARGO_DISPATCHER.AI_Cargo
#table AI_CARGO_DISPATCHER.CarrierHome
AI_CARGO_DISPATCHER.DeployInnerRadius
AI_CARGO_DISPATCHER.DeployMaxSpeed
AI_CARGO_DISPATCHER.DeployMinSpeed
AI_CARGO_DISPATCHER.DeployOuterRadius
#number AI_CARGO_DISPATCHER.DeployRadiusInner
#number AI_CARGO_DISPATCHER.DeployRadiusOuter
AI_CARGO_DISPATCHER.HomeZone
#number AI_CARGO_DISPATCHER.MonitorTimeInterval
AI_CARGO_DISPATCHER:New(SetCarrier, SetCargo, SetDeployZone, SetDeployZones)

Creates a new AICARGODISPATCHER object.

Parameters

Return value

#AI_CARGO_DISPATCHER:

Usage:


-- Create a new cargo dispatcher
SetCarrier = SET_GROUP:New():FilterPrefixes( "APC" ):FilterStart()
SetCargo = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart()
SetDeployZone = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart()
AICargoDispatcher = AI_CARGO_DISPATCHER:New( SetCarrier, SetCargo, SetDeployZone )
AI_CARGO_DISPATCHER:OnAfterLoaded(From, Event, To, Carrier, Cargo)

Loaded Handler OnAfter for AICARGODISPATCHER

Parameters

AI_CARGO_DISPATCHER:OnAfterStart(From, Event, To)

Start Handler OnAfter for AICARGODISPATCHER

Parameters

  • #string From :

  • #string Event :

  • #string To :

AI_CARGO_DISPATCHER:OnAfterStop(From, Event, To)

Stop Handler OnAfter for AICARGODISPATCHER

Parameters

  • #string From :

  • #string Event :

  • #string To :

AI_CARGO_DISPATCHER:OnAfterUnloaded(From, Event, To, Carrier, Cargo)

Unloaded Handler OnAfter for AICARGODISPATCHER

Parameters

AI_CARGO_DISPATCHER:OnBeforeStart(From, Event, To)

Start Handler OnBefore for AICARGODISPATCHER

Parameters

  • #string From :

  • #string Event :

  • #string To :

Return value

#boolean:

AI_CARGO_DISPATCHER:OnBeforeStop(From, Event, To)

Stop Handler OnBefore for AICARGODISPATCHER

Parameters

  • #string From :

  • #string Event :

  • #string To :

Return value

#boolean:

#table AI_CARGO_DISPATCHER.PickupCargo
AI_CARGO_DISPATCHER.PickupInnerRadius
AI_CARGO_DISPATCHER.PickupMaxSpeed
AI_CARGO_DISPATCHER.PickupMinSpeed
AI_CARGO_DISPATCHER.PickupOuterRadius
Core.Set#SET_CARGO AI_CARGO_DISPATCHER.SetCargo
Core.Set#SET_GROUP AI_CARGO_DISPATCHER.SetCarrier
AI_CARGO_DISPATCHER:SetDeployRadius(OuterRadius, InnerRadius)

Sets or randomizes the deploy location for the carrier around the cargo coordinate in a radius defined an outer and an optional inner radius.

This radius is influencing the location where the carrier will land to deploy the cargo. There is an aspect that is very important to remember and take into account:

  • Take care of the potential cargo position and possible reasons to crash the carrier. This is especially important for locations which are crowded with other objects, like in the middle of villages or cities. So, for the best operation of cargo operations, always ensure that the cargo is located at open spaces.

The default radius is 0, so the center. In case of a polygon zone, a random location will be selected as the center in the zone.

Parameters

  • #number OuterRadius : The outer radius in meters around the cargo coordinate.

  • #number InnerRadius : (optional) The inner radius in meters around the cargo coordinate.

Return value

#AI_CARGO_DISPATCHER:

Usage:


-- Create a new cargo dispatcher
AICargoDispatcher = AI_CARGO_DISPATCHER:New( SetCarrier, SetCargo, SetDeployZone )

-- Set the carrier to land within a band around the cargo coordinate between 500 and 300 meters!
AICargoDispatcher:SetDeployRadius( 500, 300 )
AI_CARGO_DISPATCHER:SetDeploySpeed(MaxSpeed, MinSpeed)

Sets or randomizes the speed in km/h to deploy the cargo.

Parameters

  • #number MaxSpeed : The maximum speed to move to the cargo deploy location.

  • #number MinSpeed : (optional) The minimum speed to move to the cargo deploy location.

Return value

#AI_CARGO_DISPATCHER:

Usage:


-- Create a new cargo dispatcher
AICargoDispatcher = AI_CARGO_DISPATCHER:New( SetCarrier, SetCargo, SetDeployZone )

-- Set the minimum deploy speed to be 100 km/h and the maximum speed to be 200 km/h.
AICargoDispatcher:SetDeploySpeed( 200, 100 )
Core.Set#SET_ZONE AI_CARGO_DISPATCHER.SetDeployZones
AI_CARGO_DISPATCHER:SetHomeZone(HomeZone)

Set the home zone.

When there is nothing anymore to pickup, the carriers will go to a random coordinate in this zone. They will await here new orders.

Parameter

Return value

#AI_CARGO_DISPATCHER:

Usage:


-- Create a new cargo dispatcher
AICargoDispatcher = AI_CARGO_DISPATCHER:New( SetCarrier, SetCargo, SetDeployZone )

-- Set the home coordinate
local HomeZone = ZONE:New( "Home" )
AICargoDispatcher:SetHomeZone( HomeZone )
AI_CARGO_DISPATCHER:SetPickupRadius(OuterRadius, InnerRadius)

Sets or randomizes the pickup location for the carrier around the cargo coordinate in a radius defined an outer and optional inner radius.

This radius is influencing the location where the carrier will land to pickup the cargo. There are two aspects that are very important to remember and take into account:

  • Ensure that the outer and inner radius are within reporting radius set by the cargo. For example, if the cargo has a reporting radius of 400 meters, and the outer and inner radius is set to 500 and 450 respectively, then no cargo will be loaded!!!
  • Also take care of the potential cargo position and possible reasons to crash the carrier. This is especially important for locations which are crowded with other objects, like in the middle of villages or cities. So, for the best operation of cargo operations, always ensure that the cargo is located at open spaces.

The default radius is 0, so the center. In case of a polygon zone, a random location will be selected as the center in the zone.

Parameters

  • #number OuterRadius : The outer radius in meters around the cargo coordinate.

  • #number InnerRadius : (optional) The inner radius in meters around the cargo coordinate.

Return value

#AI_CARGO_DISPATCHER:

Usage:


-- Create a new cargo dispatcher
AICargoDispatcher = AI_CARGO_DISPATCHER:New( SetCarrier, SetCargo, SetDeployZone )

-- Set the carrier to land within a band around the cargo coordinate between 500 and 300 meters!
AICargoDispatcher:SetPickupRadius( 500, 300 )
AI_CARGO_DISPATCHER:SetPickupSpeed(MaxSpeed, MinSpeed)

Set the speed or randomizes the speed in km/h to pickup the cargo.

Parameters

  • #number MaxSpeed : (optional) The maximum speed to move to the cargo pickup location.

  • #number MinSpeed : The minimum speed to move to the cargo pickup location.

Return value

#AI_CARGO_DISPATCHER:

Usage:


-- Create a new cargo dispatcher
AICargoDispatcher = AI_CARGO_DISPATCHER:New( SetCarrier, SetCargo, SetDeployZone )

-- Set the minimum pickup speed to be 100 km/h and the maximum speed to be 200 km/h.
AICargoDispatcher:SetPickupSpeed( 200, 100 )
AI_CARGO_DISPATCHER:Start()

Start Trigger for AICARGODISPATCHER

AI_CARGO_DISPATCHER:Stop()

Stop Trigger for AICARGODISPATCHER

AI_CARGO_DISPATCHER:__Start(Delay)

Start Asynchronous Trigger for AICARGODISPATCHER

Parameter

  • #number Delay :

AI_CARGO_DISPATCHER:__Stop(Delay)

Stop Asynchronous Trigger for AICARGODISPATCHER

Parameter

  • #number Delay :

AI_CARGO_DISPATCHER:onafterMonitor()

The Start trigger event, which actually takes action at the specified time interval.

AI_CARGO_DISPATCHER:onafterStart(From, Event, To)

Parameters

  • From :

  • Event :

  • To :

Type AI_CARGO_DISPATCHER.AI_Cargo

Type AI_CARGO_DISPATCHER.PickupCargo