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 speed can be given in km/h.
|
||||||
-- A given formation can be given.
|
-- A given formation can be given.
|
||||||
-- @param #CONTROLLABLE self
|
-- @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.
|
-- @param #number Speed (optional) The speed.
|
||||||
-- @return #string The route
|
-- @return #CONTROLLABLE
|
||||||
function CONTROLLABLE:RouteReturnToAirbase( ReturnAirbase, Speed )
|
function CONTROLLABLE:RouteReturnToAirbase( ReturnAirbase, Speed )
|
||||||
self:F2( { 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()
|
local DCSControllable = self:GetDCSObject()
|
||||||
|
|
||||||
if DCSControllable then
|
if DCSControllable then
|
||||||
|
|
||||||
local ControllablePoint = self:GetVec2()
|
if ReturnAirbase then
|
||||||
local ControllableVelocity = self:GetMaxVelocity()
|
local ControllablePoint = self:GetVec2()
|
||||||
|
local ControllableVelocity = self:GetMaxVelocity()
|
||||||
local PointFrom = {}
|
|
||||||
PointFrom.x = ControllablePoint.x
|
local PointFrom = {}
|
||||||
PointFrom.y = ControllablePoint.y
|
PointFrom.x = ControllablePoint.x
|
||||||
PointFrom.type = "Turning Point"
|
PointFrom.y = ControllablePoint.y
|
||||||
PointFrom.action = "Turning Point"
|
PointFrom.type = "Turning Point"
|
||||||
PointFrom.speed = ControllableVelocity
|
PointFrom.action = "Turning Point"
|
||||||
|
PointFrom.speed = ControllableVelocity
|
||||||
|
|
||||||
local PointTo = {}
|
|
||||||
local AirbasePoint = ReturnAirbase:GetVec2()
|
local PointTo = {}
|
||||||
|
local AirbasePointVec2 = ReturnAirbase:GetPointVec2()
|
||||||
PointTo.x = AirbasePoint.x
|
local AirbaseAirPoint = AirbasePointVec2:RoutePointAir(
|
||||||
PointTo.y = AirbasePoint.y
|
POINT_VEC3.RoutePointAltType.BARO,
|
||||||
PointTo.type = "Land"
|
POINT_VEC3.RoutePointType.TurningPoint,
|
||||||
PointTo.action = "Landing"
|
POINT_VEC3.RoutePointAction.TurningPoint,
|
||||||
PointTo.airdromeId = ReturnAirbase:GetID()-- Airdrome ID
|
Speed or 600
|
||||||
self:T(PointTo.airdromeId)
|
)
|
||||||
--PointTo.alt = 0
|
|
||||||
|
self:E(AirbaseAirPoint )
|
||||||
local Points = { PointFrom, PointTo }
|
|
||||||
|
local Points = { PointFrom, AirbaseAirPoint }
|
||||||
self:T3( Points )
|
|
||||||
|
self:T3( Points )
|
||||||
local Route = { points = Points, }
|
|
||||||
|
self:Route( Points )
|
||||||
return Route
|
else
|
||||||
|
self:ClearTasks()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Commands
|
-- 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
|
-- Author: FlightControl
|
||||||
-- Date Created: 25 Mar 2017
|
-- Date Created: 25 Mar 2017
|
||||||
--
|
--
|
||||||
@ -12,7 +13,6 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
--- @param Wrapper.Group#GROUP GroundGroup
|
--- @param Wrapper.Group#GROUP GroundGroup
|
||||||
--
|
|
||||||
function StopMove( GroundGroup )
|
function StopMove( GroundGroup )
|
||||||
|
|
||||||
BASE:E("Stop")
|
BASE:E("Stop")
|
||||||
@ -21,6 +21,7 @@ function StopMove( GroundGroup )
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- @param Wrapper.Group#GROUP GroundGroup
|
||||||
function StartMove( GroundGroup )
|
function StartMove( GroundGroup )
|
||||||
|
|
||||||
BASE:E("Start")
|
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