mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Progress
This commit is contained in:
parent
d4ab9e3e8a
commit
96546e21f5
@ -1661,85 +1661,50 @@ end
|
||||
-- A speed can be given in km/h.
|
||||
-- A given formation can be given.
|
||||
-- @param #CONTROLLABLE self
|
||||
-- @param Wrapper.Airbase#AIRBASE ReturnAirbase The @{Airbase#AIRBASE} to return to.
|
||||
-- @param Wrapper.Airbase#AIRBASE ReturnAirbase (optional) The @{Airbase#AIRBASE} to return to. If blank, the controllable will return to the nearest friendly airbase.
|
||||
-- @param #number Speed (optional) The speed.
|
||||
-- @return #string The route
|
||||
-- @return #CONTROLLABLE
|
||||
function CONTROLLABLE:RouteReturnToAirbase( ReturnAirbase, Speed )
|
||||
self:F2( { ReturnAirbase, Speed } )
|
||||
|
||||
-- Example
|
||||
-- [4] =
|
||||
-- {
|
||||
-- ["alt"] = 45,
|
||||
-- ["type"] = "Land",
|
||||
-- ["action"] = "Landing",
|
||||
-- ["alt_type"] = "BARO",
|
||||
-- ["formation_template"] = "",
|
||||
-- ["properties"] =
|
||||
-- {
|
||||
-- ["vnav"] = 1,
|
||||
-- ["scale"] = 0,
|
||||
-- ["angle"] = 0,
|
||||
-- ["vangle"] = 0,
|
||||
-- ["steer"] = 2,
|
||||
-- }, -- end of ["properties"]
|
||||
-- ["ETA"] = 527.81058817743,
|
||||
-- ["airdromeId"] = 12,
|
||||
-- ["y"] = 243127.2973737,
|
||||
-- ["x"] = -5406.2803440839,
|
||||
-- ["name"] = "DictKey_WptName_53",
|
||||
-- ["speed"] = 138.88888888889,
|
||||
-- ["ETA_locked"] = false,
|
||||
-- ["task"] =
|
||||
-- {
|
||||
-- ["id"] = "ComboTask",
|
||||
-- ["params"] =
|
||||
-- {
|
||||
-- ["tasks"] =
|
||||
-- {
|
||||
-- }, -- end of ["tasks"]
|
||||
-- }, -- end of ["params"]
|
||||
-- }, -- end of ["task"]
|
||||
-- ["speed_locked"] = true,
|
||||
-- }, -- end of [4]
|
||||
|
||||
|
||||
local DCSControllable = self:GetDCSObject()
|
||||
|
||||
if DCSControllable then
|
||||
|
||||
local ControllablePoint = self:GetVec2()
|
||||
local ControllableVelocity = self:GetMaxVelocity()
|
||||
|
||||
local PointFrom = {}
|
||||
PointFrom.x = ControllablePoint.x
|
||||
PointFrom.y = ControllablePoint.y
|
||||
PointFrom.type = "Turning Point"
|
||||
PointFrom.action = "Turning Point"
|
||||
PointFrom.speed = ControllableVelocity
|
||||
|
||||
|
||||
local PointTo = {}
|
||||
local AirbasePoint = ReturnAirbase:GetVec2()
|
||||
|
||||
PointTo.x = AirbasePoint.x
|
||||
PointTo.y = AirbasePoint.y
|
||||
PointTo.type = "Land"
|
||||
PointTo.action = "Landing"
|
||||
PointTo.airdromeId = ReturnAirbase:GetID()-- Airdrome ID
|
||||
self:T(PointTo.airdromeId)
|
||||
--PointTo.alt = 0
|
||||
|
||||
local Points = { PointFrom, PointTo }
|
||||
|
||||
self:T3( Points )
|
||||
|
||||
local Route = { points = Points, }
|
||||
|
||||
return Route
|
||||
if ReturnAirbase then
|
||||
local ControllablePoint = self:GetVec2()
|
||||
local ControllableVelocity = self:GetMaxVelocity()
|
||||
|
||||
local PointFrom = {}
|
||||
PointFrom.x = ControllablePoint.x
|
||||
PointFrom.y = ControllablePoint.y
|
||||
PointFrom.type = "Turning Point"
|
||||
PointFrom.action = "Turning Point"
|
||||
PointFrom.speed = ControllableVelocity
|
||||
|
||||
|
||||
local PointTo = {}
|
||||
local AirbasePointVec2 = ReturnAirbase:GetPointVec2()
|
||||
local AirbaseAirPoint = AirbasePointVec2:RoutePointAir(
|
||||
POINT_VEC3.RoutePointAltType.BARO,
|
||||
POINT_VEC3.RoutePointType.TurningPoint,
|
||||
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||
Speed or 600
|
||||
)
|
||||
|
||||
self:E(AirbaseAirPoint )
|
||||
|
||||
local Points = { PointFrom, AirbaseAirPoint }
|
||||
|
||||
self:T3( Points )
|
||||
|
||||
self:Route( Points )
|
||||
else
|
||||
self:ClearTasks()
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
return self
|
||||
end
|
||||
|
||||
-- Commands
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,5 @@
|
||||
---GRP-310 - Command StopRouteCAP-001 - Combat Air Patrol
|
||||
---
|
||||
-- Name: GRP-310 - Command StopRoute
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 25 Mar 2017
|
||||
--
|
||||
@ -12,7 +13,6 @@
|
||||
--
|
||||
|
||||
--- @param Wrapper.Group#GROUP GroundGroup
|
||||
--
|
||||
function StopMove( GroundGroup )
|
||||
|
||||
BASE:E("Stop")
|
||||
@ -21,6 +21,7 @@ function StopMove( GroundGroup )
|
||||
|
||||
end
|
||||
|
||||
--- @param Wrapper.Group#GROUP GroundGroup
|
||||
function StartMove( GroundGroup )
|
||||
|
||||
BASE:E("Start")
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
---
|
||||
-- Name: GRP-400 - RouteReturnToAirbase
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 25 Mar 2017
|
||||
--
|
||||
-- # Situation:
|
||||
-- Three air units are flying and are commanded to return a specific airbase.
|
||||
-- The return commands are given after 10 seconds.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Observe the Air1 group return to Batumi.
|
||||
-- 2. Observe the Air2 group returning to Sochi.
|
||||
-- 3. Observe the Air3 group returning to the nearest airbase after 120 seconds.
|
||||
--
|
||||
|
||||
--- @param Wrapper.Group#GROUP AirGroup
|
||||
function ReturnToBatumi( AirGroup )
|
||||
BASE:E("ReturnToBatumi")
|
||||
AirGroup:RouteReturnToAirbase( AIRBASE:FindByName("Batumi") )
|
||||
end
|
||||
|
||||
--- @param Wrapper.Group#GROUP AirGroup
|
||||
function ReturnToSochi( AirGroup )
|
||||
BASE:E("ReturnToSochi")
|
||||
AirGroup:RouteReturnToAirbase( AIRBASE:FindByName("Sochi-Adler") )
|
||||
end
|
||||
|
||||
--- @param Wrapper.Group#GROUP AirGroup
|
||||
function ReturnToNearest( AirGroup )
|
||||
BASE:E("ReturnToHomeBase")
|
||||
AirGroup:RouteReturnToAirbase()
|
||||
end
|
||||
|
||||
Air1Group = GROUP:FindByName( "Air1" )
|
||||
Air2Group = GROUP:FindByName( "Air2" )
|
||||
Air3Group = GROUP:FindByName( "Air3" )
|
||||
|
||||
Scheduler = SCHEDULER:New( nil )
|
||||
ScheduleIDAir1 = Scheduler:Schedule(nil, ReturnToBatumi, { Air1Group }, 10 )
|
||||
ScheduleIDAir2 = Scheduler:Schedule(nil, ReturnToSochi, { Air2Group }, 120 )
|
||||
ScheduleIDAir3 = Scheduler:Schedule(nil, ReturnToNearest, { Air3Group }, 120 )
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user