jord-0.5.0.0: Geographical Position Calculations

Copyright (c) 2018 Cedric Liegeois BSD3 Cedric Liegeois experimental portable Safe Haskell2010

Data.Geo.Jord.Frames

Description

Type and functions for working with delta vectors in different reference frames.

All functions are implemented using the vector-based approached described in Gade, K. (2010). A Non-singular Horizontal Position Representation

Synopsis

Reference Frames

class Frame a where Source #

class for reference frames.

Supported frames:

• FrameB: rEF returns R_EB
• FrameL: rEF returns R_EL
• FrameN: rEF returns R_EN

Minimal complete definition

rEF

Methods

Arguments

 :: a -> [Vector3d] rotation matrix to transform vectors decomposed in frame a to vectors decomposed Earth-Fixed frame.
Instances
 Source # R_EN: frame N to Earth Instance detailsDefined in Data.Geo.Jord.Frames MethodsrEF :: FrameN -> [Vector3d] Source # Source # R_EL: frame L to Earth Instance detailsDefined in Data.Geo.Jord.Frames MethodsrEF :: FrameL -> [Vector3d] Source # Source # R_EB: frame B to Earth Instance detailsDefined in Data.Geo.Jord.Frames MethodsrEF :: FrameB -> [Vector3d] Source #

Body frame

data FrameB Source #

Body frame (typically of a vehicle).

• Position: The origin is in the vehicle’s reference point.
• Orientation: The x-axis points forward, the y-axis to the right (starboard) and the z-axis in the vehicle’s down direction.
• Comments: The frame is fixed to the vehicle.
Instances
 Source # Instance detailsDefined in Data.Geo.Jord.Frames Methods(==) :: FrameB -> FrameB -> Bool #(/=) :: FrameB -> FrameB -> Bool # Source # Instance detailsDefined in Data.Geo.Jord.Frames MethodsshowsPrec :: Int -> FrameB -> ShowS #showList :: [FrameB] -> ShowS # Source # R_EB: frame B to Earth Instance detailsDefined in Data.Geo.Jord.Frames MethodsrEF :: FrameB -> [Vector3d] Source #

body yaw angle (vertical axis).

body pitch angle (transverse axis).

body roll angle (longitudinal axis).

frameB :: ETransform a => Angle -> Angle -> Angle -> a -> Earth -> FrameB Source #

FrameB from given yaw, pitch, roll, position (origin) and earth model.

Local frame

data FrameL Source #

Local level, Wander azimuth frame.

• Position: The origin is directly beneath or above the vehicle (B), at Earth’s surface (surface of ellipsoid model).
• Orientation: The z-axis is pointing down. Initially, the x-axis points towards north, and the y-axis points towards east, but as the vehicle moves they are not rotating about the z-axis (their angular velocity relative to the Earth has zero component along the z-axis). (Note: Any initial horizontal direction of the x- and y-axes is valid for L, but if the initial position is outside the poles, north and east are usually chosen for convenience.)
• Comments: The L-frame is equal to the N-frame except for the rotation about the z-axis, which is always zero for this frame (relative to Earth). Hence, at a given time, the only difference between the frames is an angle between the x-axis of L and the north direction; this angle is called the wander azimuth angle. The L-frame is well suited for general calculations, as it is non-singular.
Instances
 Source # Instance detailsDefined in Data.Geo.Jord.Frames Methods(==) :: FrameL -> FrameL -> Bool #(/=) :: FrameL -> FrameL -> Bool # Source # Instance detailsDefined in Data.Geo.Jord.Frames MethodsshowsPrec :: Int -> FrameL -> ShowS #showList :: [FrameL] -> ShowS # Source # R_EL: frame L to Earth Instance detailsDefined in Data.Geo.Jord.Frames MethodsrEF :: FrameL -> [Vector3d] Source #

wander azimuth: angle between x-axis of the frame L and the north direction.

frameL :: ETransform a => Angle -> a -> Earth -> FrameL Source #

FrameL from given wander azimuth, position (origin) and earth model.

North-East-Down frame

data FrameN Source #

North-East-Down (local level) frame.

• Position: The origin is directly beneath or above the vehicle (B), at Earth’s surface (surface of ellipsoid model).
• Orientation: The x-axis points towards north, the y-axis points towards east (both are horizontal), and the z-axis is pointing down.
• Comments: When moving relative to the Earth, the frame rotates about its z-axis to allow the x-axis to always point towards north. When getting close to the poles this rotation rate will increase, being infinite at the poles. The poles are thus singularities and the direction of the x- and y-axes are not defined here. Hence, this coordinate frame is not suitable for general calculations.
Instances
 Source # Instance detailsDefined in Data.Geo.Jord.Frames Methods(==) :: FrameN -> FrameN -> Bool #(/=) :: FrameN -> FrameN -> Bool # Source # Instance detailsDefined in Data.Geo.Jord.Frames MethodsshowsPrec :: Int -> FrameN -> ShowS #showList :: [FrameN] -> ShowS # Source # R_EN: frame N to Earth Instance detailsDefined in Data.Geo.Jord.Frames MethodsrEF :: FrameN -> [Vector3d] Source #

frameN :: ETransform a => a -> Earth -> FrameN Source #

FrameN from given position (origin) and earth model.

Deltas

data Delta Source #

delta between position in one of the reference frames.

Instances
 Source # Instance detailsDefined in Data.Geo.Jord.Frames Methods(==) :: Delta -> Delta -> Bool #(/=) :: Delta -> Delta -> Bool # Source # Instance detailsDefined in Data.Geo.Jord.Frames MethodsshowsPrec :: Int -> Delta -> ShowS #show :: Delta -> String #showList :: [Delta] -> ShowS #

Delta from given x, y and z length.

Delta from given x, y and z length in metres.

x component of given Delta.

y component of given Delta.

z component of given Delta.

Delta in the north, east, down frame

data Ned Source #

North, east and down delta (thus in frame FrameN).

Instances
 Source # Instance detailsDefined in Data.Geo.Jord.Frames Methods(==) :: Ned -> Ned -> Bool #(/=) :: Ned -> Ned -> Bool # Source # Instance detailsDefined in Data.Geo.Jord.Frames MethodsshowsPrec :: Int -> Ned -> ShowS #show :: Ned -> String #showList :: [Ned] -> ShowS #

ned :: Length -> Length -> Length -> Ned Source #

Ned from given north, east and down.

Ned from given north, east and down in metres.

North component of given Ned.

East component of given Ned.

Down component of given Ned.

bearing v computes the bearing in compass angle of the NED vector v from north.

Compass angles are clockwise angles from true north: 0 = north, 90 = east, 180 = south, 270 = west.

elevation v computes the elevation of the NED vector v from horizontal (ie tangent to ellipsoid surface).

slantRange v computes the distance from origin in the local system of the NED vector v.

Calculations

deltaBetween :: (ETransform a, Frame c) => a -> a -> (a -> Earth -> c) -> Earth -> Delta Source #

deltaBetween p1 p2 f e computes the exact Delta between the two positions p1 and p2 in frame f using earth model e.

    let p1 = decimalLatLongHeight 1 2 (metres (-3))
let p2 = decimalLatLongHeight 4 5 (metres (-6))
let w = decimalDegrees 5 -- wander azimuth
let d = deltaBetween p1 p2 (frameL w) wgs84
d = deltaMetres 359490.579 302818.523 17404.272


nedBetween :: ETransform a => a -> a -> Earth -> Ned Source #

nedBetween p1 p2 e computes the exact Ned vector between the two positions p1 and p2, in north, east, and down using earth model e.

Produced Ned delta is relative to p1: Due to the curvature of Earth and different directions to the North Pole, the north, east, and down directions will change (relative to Earth) for different places.

Position p1 must be outside the poles for the north and east directions to be defined.

    let p1 = decimalLatLongHeight 1 2 (metres (-3))
let p2 = decimalLatLongHeight 4 5 (metres (-6))
let d1 = nedBetween p1 p2 wgs84
let d2 = deltaBetween p1 p2 frameN wgs84
north d1 = dx d2
east d1 = dy d2
down d1 = dz d2


target :: (ETransform a, Frame c) => a -> (a -> Earth -> c) -> Delta -> Earth -> a Source #

target p0 f d e computes the target position from position p0 and delta d using in frame f and using earth model e.

    let p0 = decimalLatLongHeight 49.66618 3.45063 zero
let y = decimalDegrees 10 -- yaw
let r = decimalDegrees 20 -- roll
let p = decimalDegrees 30 -- pitch
let d = deltaMetres 3000 2000 100
target p0 (frameB y r p) d wgs84 = decimalLatLongHeight 49.6918016 3.4812669 (metres 6.007)


targetN :: ETransform a => a -> Ned -> Earth -> a Source #

targetN p0 d e computes the target position from position p0 and north, east, down d using earth model e.

    let p0 = decimalLatLongHeight 49.66618 3.45063 zero
targetN p0 (nedMeters 100 200 300) wgs84 = target p0 frameN (deltaMetres 100 200 300) wgs84