Sen API
Sen Libraries
Loading...
Searching...
No Matches
util/src/dr/utils.h
Go to the documentation of this file.
1// === utils.h =========================================================================================================
2// Sen Infrastructure
3// Released under the Apache License v2.0 (SPDX-License-Identifier Apache-2.0).
4// See the LICENSE.txt file for more information.
5// © Airbus SAS, Airbus Helicopters, and Airbus Defence and Space SAU/GmbH/SAS.
6// =====================================================================================================================
7
8#ifndef SEN_LIBS_UTIL_SRC_DR_UTILS_H
9#define SEN_LIBS_UTIL_SRC_DR_UTILS_H
10
11#include "mat3.h"
12#include "quat.h"
13
14// sen
16
17namespace sen::util
18{
19
20//--------------------------------------------------------------------------------------------------------------
21// Helpers
22//--------------------------------------------------------------------------------------------------------------
23
25[[nodiscard]] Location toWorldLocation(const Vec3d& value);
26
28[[nodiscard]] Vec3d fromWorldLocation(const Location& value);
29
31[[nodiscard]] Vec3d fromVelocity(const Velocity& value);
32
34[[nodiscard]] Velocity toVelocity(const Vec3d& value);
35
37[[nodiscard]] Vec3d fromAcceleration(const Acceleration& value);
38
40[[nodiscard]] Acceleration toAcceleration(const Vec3d& value);
41
44
46[[nodiscard]] Vec3d fromAngularVelocity(const AngularVelocity& value);
47
49
51[[nodiscard]] AngularVelocity toAngularVelocity(const Vec3d& value);
52
54[[nodiscard]] Orientation toOrientation(const Vec3d& value);
55
57[[nodiscard]] Vec3d fromOrientationToVec(const Orientation& value);
58
60[[nodiscard]] Quatd fromOrientationToQuat(const Orientation& value);
61
63[[nodiscard]] Vec3d nedToEcef(const Vec3d& value, const GeodeticWorldLocation& latLonAlt) noexcept;
64
66[[nodiscard]] Vec3d ecefToNed(const Vec3d& value, const GeodeticWorldLocation& latLonAlt) noexcept;
67
69[[nodiscard]] Vec3d bodyToNed(const Vec3d& value, const Orientation& orientationNed) noexcept;
70
72[[nodiscard]] Vec3d nedToBody(const Vec3d& value, const Orientation& orientationNed) noexcept;
73
75[[nodiscard]] f64 toRad(f64 value) noexcept;
76
78[[nodiscard]] f64 toDeg(f64 value) noexcept;
79
81[[nodiscard]] Mat3d makeR1(const Vec3d& omega, f64 delta);
82
84[[nodiscard]] Mat3d makeR2(const Vec3d& omega, f64 delta);
85
88[[nodiscard]] Vec3d bodyToWorld(const Vec3d& value, const Orientation& bodyEulerAngles) noexcept;
89
92[[nodiscard]] Vec3d worldToBody(const Vec3d& value, const Orientation& bodyEulerAngles) noexcept;
93
95[[nodiscard]] Location extrapolateLocationWorld(const Situation& value, sen::Duration delta) noexcept;
96
98[[nodiscard]] Location extrapolateLocationBody(const Situation& value, sen::Duration delta) noexcept;
99
101[[nodiscard]] Velocity extrapolateVelocity(const Velocity& value,
103 sen::Duration delta) noexcept;
104
108 sen::Duration delta,
110 const AngularAcceleration& angularAcceleration = {}) noexcept;
111
113[[nodiscard]] std::array<Vec3d, 3U> getNedTrihedron(const GeodeticWorldLocation& location);
114
118 const Vec3d& yi,
119 const Vec3d& zi,
120 const Vec3d& xf,
121 const Vec3d& yf);
122
126{
127 LengthMeters distance;
128 AngleRadians heading;
129 AngleRadians pitch;
130};
131
134
136[[nodiscard]] f64 hypot(f64 var1, f64 var2) noexcept;
137
139[[nodiscard]] bool hasVelocity(const Velocity& velocity) noexcept;
140
142[[nodiscard]] bool hasAcceleration(const Acceleration& acceleration) noexcept;
143
145[[nodiscard]] bool hasAngularVelocity(const AngularVelocity& omega) noexcept;
146
147} // namespace sen::util
148
149#endif // SEN_LIBS_UTIL_SRC_DR_UTILS_H
A time duration.
Definition duration.h:25
Acceleration struct.
Definition algorithms.h:119
AngularAcceleration struct.
Definition algorithms.h:135
AngularVelocity struct.
Definition algorithms.h:127
World location in geodetic coordinates.
Definition algorithms.h:95
World Location struct.
Definition algorithms.h:87
Orientation struct.
Definition algorithms.h:103
Situation structure with the following parameters:
Definition algorithms.h:143
Velocity struct.
Definition algorithms.h:111
@ angularAcceleration
Definition unit.h:47
@ velocity
Definition unit.h:44
@ acceleration
Definition unit.h:46
@ angularVelocity
Definition unit.h:45
float64_t f64
Definition numbers.h:29
Definition iterator_adapters.h:16
AngularVelocity toAngularVelocity(const Vec3d &value)
Converts an RPR angular velocity vector structure to a Vec3d instance.
std::array< Vec3d, 3U > getNedTrihedron(const GeodeticWorldLocation &location)
Returns the NED trihedron at a certain world location given the Latitude and Longitude.
Acceleration toAcceleration(const Vec3d &value)
Converts an RPR acceleration vector structure to a Vec3d instance.
AngleRadians pitch
Definition util/src/dr/utils.h:129
Orientation eulerAnglesFromTrihedrons(const Vec3d &xi, const Vec3d &yi, const Vec3d &zi, const Vec3d &xf, const Vec3d &yf)
Given two trihedrons of vectors, computes the Euler Angles needed to transform the initial trihedron ...
Vec3d fromVelocity(const Velocity &value)
Converts an RPR velocity vector structure to a Vec3d instance.
AngleRadians heading
Definition util/src/dr/utils.h:128
Location extrapolateLocationWorld(const Situation &value, sen::Duration delta) noexcept
Extrapolates the WorldLocation for the algorithms that use the World reference system.
bool hasAngularVelocity(const AngularVelocity &omega) noexcept
Returns true if any of the components of the entity angular velocity is bigger than 1e-3 rad/s.
Mat3d makeR2(const Vec3d &omega, f64 delta)
Returns the R2 matrix used in the Dead Reckoning algorithms involving acceleration in body coordinate...
Vec3d worldToBody(const Vec3d &value, const Orientation &bodyEulerAngles) noexcept
Transforms a vector from world coordinates (ECEF) to body coordinates using quaternions given the Eul...
f64 hypot(f64 var1, f64 var2) noexcept
Computes the hypotenuse given the sides.
Vec3d bodyToNed(const Vec3d &value, const Orientation &orientationNed) noexcept
Changes the basis of a vector from body referenced coordinates to NED coordinates.
Quat< f64 > Quatd
Definition quat.h:149
Vec3d fromAngularVelocity(const AngularVelocity &value)
Converts an RPR angular velocity vector structure to a Vec3d instance.
Vec3d nedToBody(const Vec3d &value, const Orientation &orientationNed) noexcept
Changes the basis of a vector from NED coordinates to body referenced coordinates.
Mat3< f64 > Mat3d
Definition mat3.h:110
AngularAcceleration toAngularAcceleration(const Vec3d &value)
Converts an RPR angular acceleration vector structure to a Vec3d instance.
Vec3< f64 > Vec3d
Definition vec3.h:115
Vec3d bodyToWorld(const Vec3d &value, const Orientation &bodyEulerAngles) noexcept
Transforms a vector from body coordinates (x forward, y right, z down ) to world coordinates using qu...
Location toWorldLocation(const Vec3d &value)
Translates a Vec3d instance to an RPR world location structure.
Vec3d fromOrientationToVec(const Orientation &value)
Converts an RPR orientation structure to a Vec3d instance.
Vec3d fromAngularAcceleration(const AngularAcceleration &value)
f64 toRad(f64 value) noexcept
Degrees to radians.
Location extrapolateLocationBody(const Situation &value, sen::Duration delta) noexcept
Extrapolates the WorldLocation for the algorithms that use the Body reference system.
Vec3d fromAcceleration(const Acceleration &value)
Converts an RPR acceleration vector structure to a Vec3d instance.
Orientation toOrientation(const Vec3d &value)
Translates a Vec3d instance to an RPR orientation structure.
Orientation extrapolateOrientation(const Orientation &value, sen::Duration delta, const AngularVelocity &angularVelocity, const AngularAcceleration &angularAcceleration={}) noexcept
Performs a linear extrapolation the orientation of an entity using quaternions given a delta of time ...
f64 toDeg(f64 value) noexcept
Radians to degrees.
HaversineData haversine(const GeodeticWorldLocation &start, const GeodeticWorldLocation &end)
Given the start and end Geodetic Locations, returns the Haversine distance and heading.
Mat3d makeR1(const Vec3d &omega, f64 delta)
Returns the R1 matrix used in the Dead Reckoning algorithms involving velocity in body coordinates.
Quatd fromOrientationToQuat(const Orientation &value)
Converts an RPR orientation structure to a Quatf instance.
bool hasAcceleration(const Acceleration &acceleration) noexcept
Returns true if any of the components of the entity acceleration is bigger than 0....
Vec3d fromWorldLocation(const Location &value)
Converts an RPR world location structure to a Vec3d instance.
Vec3d nedToEcef(const Vec3d &value, const GeodeticWorldLocation &latLonAlt) noexcept
Translates from NED to ECEF location coordinates using quaternions.
Velocity extrapolateVelocity(const Velocity &value, const Acceleration &acceleration, sen::Duration delta) noexcept
Extrapolates Velocities with constant Acceleration.
bool hasVelocity(const Velocity &velocity) noexcept
Returns true if any of the components of the entity velocity is bigger than 0.1 m/s.
Vec3d ecefToNed(const Vec3d &value, const GeodeticWorldLocation &latLonAlt) noexcept
Translates from ECEF to NED location coordinates using quaternions.
Velocity toVelocity(const Vec3d &value)
Converts a Vec3 to a RPR velocity vector structure.
LengthMeters distance
Definition util/src/dr/utils.h:127
Return type for the haversine helper containing the haversine distance and header between the start a...
Definition util/src/dr/utils.h:126