Copyright | (c) 2018 Cedric Liegeois |
---|---|
License | BSD3 |
Maintainer | Cedric Liegeois <ofmooseandmen@yahoo.fr> |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
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
- class Frame a where
- data FrameB
- yaw :: FrameB -> Angle
- pitch :: FrameB -> Angle
- roll :: FrameB -> Angle
- frameB :: ETransform a => Angle -> Angle -> Angle -> a -> Earth -> FrameB
- data FrameL
- wanderAzimuth :: FrameL -> Angle
- frameL :: ETransform a => Angle -> a -> Earth -> FrameL
- data FrameN
- frameN :: ETransform a => a -> Earth -> FrameN
- data Delta
- delta :: Length -> Length -> Length -> Delta
- deltaMetres :: Double -> Double -> Double -> Delta
- data Ned
- ned :: Length -> Length -> Length -> Ned
- nedMetres :: Double -> Double -> Double -> Ned
- north :: Ned -> Length
- east :: Ned -> Length
- down :: Ned -> Length
- bearing :: Ned -> Angle
- elevation :: Ned -> Angle
- norm :: Ned -> Length
- deltaBetween :: (ETransform a, Frame c) => a -> a -> (a -> Earth -> c) -> Earth -> Delta
- nedBetween :: ETransform a => a -> a -> Earth -> Ned
- target :: (ETransform a, Frame c) => a -> (a -> Earth -> c) -> Delta -> Earth -> a
- targetN :: ETransform a => a -> Ned -> Earth -> a
Reference Frames
class for reference frames.
Supported frames:
:: a | |
-> [Vector3d] | rotation matrix to transform vectors decomposed in frame |
Body frame
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.
frameB :: ETransform a => Angle -> Angle -> Angle -> a -> Earth -> FrameB Source #
FrameB
from given yaw, pitch, roll, position (origin) and earth model.
Local frame
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.
wanderAzimuth :: FrameL -> Angle 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
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.
frameN :: ETransform a => a -> Earth -> FrameN Source #
FrameN
from given position (origin) and earth model.
Deltas
delta between position in one of the reference frames.
deltaMetres :: Double -> Double -> Double -> Delta Source #
Delta
from given x, y and z length in _metres_.
Delta in the north, east, down frame
North, east and down delta (thus in frame FrameN
).
nedMetres :: Double -> Double -> Double -> Ned Source #
Ned
from given north, east and down in _metres_.
bearing :: Ned -> Angle Source #
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 :: Ned -> Angle Source #
elevation v
computes the elevation of the NED vector v
from horizontal (ie tangent to ellipsoid surface).
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
.
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.