More bugfixing, set CAS and ASL to be default modes

This commit is contained in:
Pax1601
2023-09-09 19:07:09 +02:00
parent 74d5480587
commit 6a2ffc936e
9 changed files with 52 additions and 24 deletions

View File

@@ -173,6 +173,8 @@ function Olympus.buildTask(groupName, options)
pattern = options['pattern'] or "Circle"
}
}
-- Compute the altitude depending on the altitude type
if options['altitude'] then
if options ['altitudeType'] then
if options ['altitudeType'] == "AGL" then
@@ -189,8 +191,15 @@ function Olympus.buildTask(groupName, options)
task['params']['altitude'] = options['altitude']
end
end
-- Compute the speed depending on the speed type. CAS calculation is only available if the altitude is also available
if options['speed'] then
task['params']['speed'] = options['speed']
-- Simplified formula to compute CAS from GS
local speed = options['speed']
if options['speedType'] and options['speedType'] == "CAS" and task['params']['altitude'] then
speed = speed * (1 + 0.02 * task['params']['altitude'] / 0.3048 / 1000)
end
task['params']['speed'] = speed
end
-- Bomb a specific location
elseif options['id'] == 'Bombing' and options['lat'] and options['lng'] then
@@ -246,6 +255,11 @@ function Olympus.move(groupName, lat, lng, altitude, altitudeType, speed, speedT
altitude = land.getHeight({x = endPoint.x, y = endPoint.z}) + altitude
end
-- Simplified formula to compute CAS from GS
if speedType == "CAS" then
speed = speed * (1 + 0.02 * altitude / 0.3048 / 1000)
end
-- Create the path
local path = {
[1] = mist.fixedWing.buildWP(startPoint, turningPoint, speed, altitude, 'BARO'),
@@ -284,6 +298,11 @@ function Olympus.move(groupName, lat, lng, altitude, altitudeType, speed, speedT
altitude = land.getHeight({x = endPoint.x, y = endPoint.z}) + altitude
end
-- Simplified formula to compute CAS from GS
if speedType == "CAS" then
speed = speed * (1 + 0.02 * altitude / 0.3048 / 1000)
end
-- Create the path
local path = {
[1] = mist.heli.buildWP(startPoint, turningPoint, speed, altitude, 'BARO'),