CogniPilot

MODELICA LIBRARY · ENGINEERING REFERENCE

function

Geodesy.routeLocalEnuToGeodetic

Lift a local East-North-Up route to lat/lon/alt through the origin

Public declarations

Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.

RoleNameTypeDimensions / attributes / defaultDescription
inputoriginGeodeticOriginLocal frame reference point
inputlocalWaypointsReal[:, 3]Route rows are [east_m, north_m, up_m]
inputearth_radius_mReal= 6378137.0Spherical Earth radius [m]
outputglobalWaypointsReal[size(localWaypoints, 1), 3]Route rows are [latitude_deg, longitude_deg, altitude_m]

Modelica declarations and implementation

Show parameters, interfaces and source

Parameters, inputs, outputs, defaults and equations from the source file.

function routeLocalEnuToGeodetic
    "Lift a local East-North-Up route to lat/lon/alt through the origin"
    input GeodeticOrigin origin "Local frame reference point";
    input Real localWaypoints[:, 3]
      "Route rows are [east_m, north_m, up_m]";
    input Real earth_radius_m = 6378137.0 "Spherical Earth radius [m]";
    output Real globalWaypoints[size(localWaypoints, 1), 3]
      "Route rows are [latitude_deg, longitude_deg, altitude_m]";
  protected
    Real globalWaypoint[3];
  algorithm
    // Keep one waypoint cohesive: compute the vector once, then write one row.
    for row in 1:size(localWaypoints, 1) loop
      globalWaypoint := localEnuToGeodetic(
        origin,
        localWaypoints[row, 1],
        localWaypoints[row, 2],
        localWaypoints[row, 3],
        earth_radius_m);
      globalWaypoints[row, :] := globalWaypoint;
    end for;
  end routeLocalEnuToGeodetic;