- Unfinished: get map heading error between compassHeading and rawHeading.
This commit is contained in:
Binary file not shown.
+22
-10
@@ -153,20 +153,37 @@ do
|
|||||||
local CarrierPoint = self.carrierUnit:getPoint()
|
local CarrierPoint = self.carrierUnit:getPoint()
|
||||||
local windBearing, windSpeed = self:getWindBearingAndVel(CarrierPoint) -- radians & m/s
|
local windBearing, windSpeed = self:getWindBearingAndVel(CarrierPoint) -- radians & m/s
|
||||||
|
|
||||||
|
--[[
|
||||||
|
heading
|
||||||
|
wind *70
|
||||||
|
|
||||||
|
mag 7.6
|
||||||
|
|
||||||
|
northCorrection -4.94
|
||||||
|
carrierHeading 265.9999
|
||||||
|
wind 69.999
|
||||||
|
|
||||||
|
carrier 259M 266
|
||||||
|
deck 250M 257
|
||||||
|
]]
|
||||||
|
|
||||||
local carrierSpeed = 5/1.944 --m/s
|
local carrierSpeed = 5/1.944 --m/s
|
||||||
-- local carrierHeading = (windBearing*180/math.pi)+189
|
local northCorrection = mist.getNorthCorrection(CarrierPoint)
|
||||||
local carrierHeading = (windBearing*180/math.pi)+189+Utils.getNorthCorrection(CarrierPoint)
|
|
||||||
|
local carrierHeading = math.deg(windBearing)+180+9
|
||||||
|
|
||||||
if carrierHeading > 360 then
|
if carrierHeading > 360 then
|
||||||
carrierHeading = carrierHeading - 360
|
carrierHeading = carrierHeading - 360
|
||||||
end
|
end
|
||||||
|
|
||||||
|
trigger.action.outText('northCorrection: '..math.deg(northCorrection),10)--Debug
|
||||||
|
trigger.action.outText('windBearing: '..math.deg(windBearing),10)--Debug
|
||||||
|
trigger.action.outText('carrierHeading: '..carrierHeading,10)--Debug
|
||||||
|
|
||||||
--Calculate wind speed on deck in knots. If wind speed < 25 knots, try to make it 25 knots on deck.
|
--Calculate wind speed on deck in knots. If wind speed < 25 knots, try to make it 25 knots on deck.
|
||||||
if windSpeed <= 20/1.944 then
|
if windSpeed <= 20/1.944 then
|
||||||
carrierSpeed = 25/1.944-windSpeed
|
carrierSpeed = 25/1.944-windSpeed
|
||||||
end
|
end
|
||||||
trigger.action.outText('windSpeed: '..(windSpeed*1.944),10) --Debug
|
|
||||||
trigger.action.outText('carrierSpeed: '..(carrierSpeed*1.944),10) --Debug
|
|
||||||
|
|
||||||
-- Find available waypoint and path.
|
-- Find available waypoint and path.
|
||||||
-- Requirements: 6 hours long voyage time based on carrier speed.
|
-- Requirements: 6 hours long voyage time based on carrier speed.
|
||||||
@@ -190,11 +207,6 @@ do
|
|||||||
speed = 10/1.944
|
speed = 10/1.944
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger.action.circleToAll(-1,1,{x=newWaypoint_1.point.x,y=0,z=newWaypoint_1.point.y},5000,{1,0,0,1},{1,0,0,0.3},1)--Debug
|
|
||||||
trigger.action.circleToAll(-1,2,{x=newWaypoint_2.point.x,y=0,z=newWaypoint_2.point.y},5000,{1,0,0,1},{1,0,0,0.3},1)--Debug
|
|
||||||
trigger.action.circleToAll(-1,3,{x=newWaypoint_3.point.x,y=0,z=newWaypoint_3.point.y},5000,{1,0,0,1},{1,0,0,0.3},1)--Debug
|
|
||||||
trigger.action.circleToAll(-1,4,{x=newWaypoint_4.point.x,y=0,z=newWaypoint_4.point.y},5000,{1,0,0,1},{1,0,0,0.3},1)--Debug
|
|
||||||
|
|
||||||
local Mission = {
|
local Mission = {
|
||||||
id = 'Mission',
|
id = 'Mission',
|
||||||
params = {
|
params = {
|
||||||
@@ -245,7 +257,7 @@ do
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local Controller = self.carrierUnit:getController()
|
local Controller = self.carrierUnit:getGroup():getController()
|
||||||
if not Controller then return end
|
if not Controller then return end
|
||||||
|
|
||||||
timer.scheduleFunction(function (Mission)
|
timer.scheduleFunction(function (Mission)
|
||||||
|
|||||||
Reference in New Issue
Block a user