mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Navigation
This commit is contained in:
@@ -3697,13 +3697,17 @@ end
|
||||
-- Flightplan Functions
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--- Check flightplans.
|
||||
--- Set flightplan and add waypoints.
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @param Navigation.FlightPlan#FLIGHTPLAN FlightPlan Flight plan.
|
||||
-- @return #FLIGHTGROUP self
|
||||
function FLIGHTGROUP:_SetFlightPlan(FlightPlan)
|
||||
|
||||
self:I(self.lid..string.format("Setting flightplan %s", FlightPlan.alias))
|
||||
|
||||
self.flightplan=FlightPlan
|
||||
|
||||
self:SetDestinationbase(self.flightplan.destinationAirbase)
|
||||
|
||||
for i,_fix in pairs(FlightPlan.fixes) do
|
||||
local fix=_fix --Navigation.NavFix#NAVFIX
|
||||
@@ -3714,7 +3718,7 @@ function FLIGHTGROUP:_SetFlightPlan(FlightPlan)
|
||||
|
||||
local altitude=(fix.altMin or fix.altMax)~=nil and fix:GetAltitude() or FlightPlan:GetCruiseAltitude()
|
||||
|
||||
local wp=self:AddWaypoint(fix.coordinate, Speed, AfterWaypointWithID, altitude or 10000, false)
|
||||
local wp=self:AddWaypoint(fix.vector, Speed, AfterWaypointWithID, altitude or 10000, false)
|
||||
wp.flightplan=FlightPlan
|
||||
|
||||
end
|
||||
|
||||
@@ -13493,20 +13493,24 @@ end
|
||||
-- @return Core.Point#COORDINATE The coordinate of the object.
|
||||
function OPSGROUP:_CoordinateFromObject(Object)
|
||||
|
||||
env.info("FF coordfrom object")
|
||||
if Object then
|
||||
if Object:IsInstanceOf("COORDINATE") then
|
||||
if VECTOR._IsVector(Object) then
|
||||
env.info("FF VECTOR")
|
||||
return Object:GetCoordinate()
|
||||
elseif Object:IsInstanceOf("COORDINATE") then
|
||||
return Object
|
||||
else
|
||||
if Object:IsInstanceOf("POSITIONABLE") or Object:IsInstanceOf("ZONE_BASE") then
|
||||
self:T(self.lid.."WARNING: Coordinate is not a COORDINATE but a POSITIONABLE or ZONE. Trying to get coordinate")
|
||||
self:E(self.lid.."WARNING: Coordinate is not a COORDINATE but a POSITIONABLE or ZONE. Trying to get coordinate")
|
||||
local coord=Object:GetCoordinate()
|
||||
return coord
|
||||
else
|
||||
self:T(self.lid.."ERROR: Coordinate is neither a COORDINATE nor any POSITIONABLE or ZONE!")
|
||||
self:E(self.lid.."ERROR: Coordinate is neither a COORDINATE nor any POSITIONABLE or ZONE!")
|
||||
end
|
||||
end
|
||||
else
|
||||
self:T(self.lid.."ERROR: Object passed is nil!")
|
||||
self:E(self.lid.."ERROR: Object passed is nil!")
|
||||
end
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user