Sen API
Sen Libraries
Loading...
Searching...
No Matches
sen::util Namespace Reference

Namespaces

namespace  impl

Classes

struct  IteratorRange
 Basic range abstraction to form a minimal range around two iterators. More...
class  LockedRangeAdapter
 A range adapter to combine a range with lock. More...
struct  SmartPtrIteratorAdapter
 Iterator adapter to turn a iterator that iterates over a smart ptr sequence into one that iterates over pointers to the underlying type. More...
struct  DrConfig
 Length in meters. More...
struct  Location
 World Location struct. More...
struct  GeodeticWorldLocation
 World location in geodetic coordinates. More...
struct  Orientation
 Orientation struct. More...
struct  Velocity
 Velocity struct. More...
struct  Acceleration
 Acceleration struct. More...
struct  AngularVelocity
 AngularVelocity struct. More...
struct  AngularAcceleration
 AngularAcceleration struct. More...
struct  Situation
 Situation structure with the following parameters: More...
struct  GeodeticSituation
 GeodeticSituation structure with the following parameters: More...
class  DeadReckoner
 Enables the user to predict an object’s position and movement at any future time applying dead reckoning. It adheres to the algorithms specified in IEEE 1278_1:2012, Annex E. More...
class  DeadReckonerBase
 Extrapolates the Situation of an entity at a certain time. The extrapolation is smoothed by default unless the user specifies otherwise. More...
class  DeadReckonerTemplateBase
 Base class for the DeadReckoner and SettableDeadReckoner classes. More...
struct  DrThreshold
 Threshold configuration structure with the position error threshold (maximum distance between extrapolation and data) and the entity dynamics (speed and changes of direction). More...
class  SettableDeadReckoner
 Allows the user to get the extrapolated situation of an object and to set the Spatial when the error of the extrapolation exceeds a configurable threshold. More...
class  Mat3
 Handles all mathematical ops involving 3D Matrices. More...
class  Quat
 Quaternion. Represents the orientation of an object in space. More...
struct  HaversineData
 Return type for the haversine helper containing the haversine distance and header between the start and end points. More...
class  Vec3
 Handles all mathematical ops involving 3D Vectors. More...

Typedefs

using Mat3f = Mat3<f32>
using Mat3d = Mat3<f64>
using Quatf = Quat<f32>
using Quatd = Quat<f64>
using Vec3f = Vec3<f32>
using Vec3d = Vec3<f64>

Enumerations

enum class  SpatialAlgorithm {
  SpatialAlgorithm::drStatic = 0 , SpatialAlgorithm::drFPW = 1 , SpatialAlgorithm::drRPW = 2 , SpatialAlgorithm::drRVW = 3 ,
  SpatialAlgorithm::drFVW = 4 , SpatialAlgorithm::drFPB = 5 , SpatialAlgorithm::drRPB = 6 , SpatialAlgorithm::drRVB = 7 ,
  SpatialAlgorithm::drFVB = 8
}
 Enumeration of the different Spatial algorithms. More...
enum class  ReferenceSystem : u32 { ReferenceSystem::world , ReferenceSystem::body }
 Enumeration of the reference system: world-centered or body-centered. More...

Functions

template<typename IteratorType>
IteratorRange< IteratorType > makeRange (IteratorType begin, IteratorType end)
 Create a simple range for the two iterators.
template<typename ContainerType>
auto makeRange (ContainerType &container)
 Create a simple range for the given container.
template<template< typename > typename LockType, typename IteratorType, typename MutexType>
auto makeLockedRange (IteratorType begin, IteratorType end, MutexType &m)
 Create a LockedRangeAdapter for the given iterator pair and lock the given mutex.
template<template< typename > typename LockType, typename ContainerType, typename MutexType>
auto makeLockedRange (ContainerType &container, MutexType &m)
 Create a LockedRangeAdapter for the given container and lock the given mutex.
Situation drFpw (const Situation &value, sen::TimeStamp time) noexcept
 Returns the extrapolated situation using the FPW algorithm.
Situation drFpb (const Situation &value, sen::TimeStamp time) noexcept
 Returns the extrapolated situation using the FPB algorithm. The velocity is expressed in body coordinates.
Situation drRpw (const Situation &value, sen::TimeStamp time) noexcept
 Returns the extrapolated situation using the RPW algorithm.
Situation drRpb (const Situation &value, sen::TimeStamp time) noexcept
 Returns the extrapolated situation using the RPB algorithm. The input situation should be expressed in body coordinates and the returned situation in world coordinates.
Situation drRvw (const Situation &value, sen::TimeStamp time) noexcept
 Returns the extrapolated situation using the RVW algorithm.
Situation drRvb (const Situation &value, sen::TimeStamp time) noexcept
 Returns the extrapolated situation using the RVB algorithm.
Situation drFvw (const Situation &value, sen::TimeStamp time) noexcept
 Returns the extrapolated situation using the FVW algorithm.
Situation drFvb (const Situation &value, sen::TimeStamp time) noexcept
 Returns the extrapolated situation using the FVB algorithm.
GeodeticSituation toGeodeticSituation (const Situation &value)
 Transform a Situation to a GeodeticSituation.
Situation toSituation (const GeodeticSituation &value)
 Transforms a GeodeticSituation to a Situation.
Location toWorldLocation (const Vec3d &value)
 Translates a Vec3d instance to an RPR world location structure.
Vec3d fromWorldLocation (const Location &value)
 Converts an RPR world location structure to a Vec3d instance.
Vec3d fromVelocity (const Velocity &value)
 Converts an RPR velocity vector structure to a Vec3d instance.
Velocity toVelocity (const Vec3d &value)
 Converts a Vec3 to a RPR velocity vector structure.
Vec3d fromAcceleration (const Acceleration &value)
 Converts an RPR acceleration vector structure to a Vec3d instance.
Acceleration toAcceleration (const Vec3d &value)
 Converts an RPR acceleration vector structure to a Vec3d instance.
AngularAcceleration toAngularAcceleration (const Vec3d &value)
 Converts an RPR angular acceleration vector structure to a Vec3d instance.
Vec3d fromAngularVelocity (const AngularVelocity &value)
 Converts an RPR angular velocity vector structure to a Vec3d instance.
Vec3d fromAngularAcceleration (const AngularAcceleration &value)
AngularVelocity toAngularVelocity (const Vec3d &value)
 Converts an RPR angular velocity vector structure to a Vec3d instance.
Orientation toOrientation (const Vec3d &value)
 Translates a Vec3d instance to an RPR orientation structure.
Vec3d fromOrientationToVec (const Orientation &value)
 Converts an RPR orientation structure to a Vec3d instance.
Quatd fromOrientationToQuat (const Orientation &value)
 Converts an RPR orientation structure to a Quatf instance.
Vec3d nedToEcef (const Vec3d &value, const GeodeticWorldLocation &latLonAlt) noexcept
 Translates from NED to ECEF location coordinates using quaternions.
Vec3d ecefToNed (const Vec3d &value, const GeodeticWorldLocation &latLonAlt) noexcept
 Translates from ECEF to NED location coordinates using quaternions.
Vec3d bodyToNed (const Vec3d &value, const Orientation &orientationNed) noexcept
 Changes the basis of a vector from body referenced coordinates to NED coordinates.
Vec3d nedToBody (const Vec3d &value, const Orientation &orientationNed) noexcept
 Changes the basis of a vector from NED coordinates to body referenced coordinates.
f64 toRad (f64 value) noexcept
 Degrees to radians.
f64 toDeg (f64 value) noexcept
 Radians to degrees.
Mat3d makeR1 (const Vec3d &omega, f64 delta)
 Returns the R1 matrix used in the Dead Reckoning algorithms involving velocity in body coordinates.
Mat3d makeR2 (const Vec3d &omega, f64 delta)
 Returns the R2 matrix used in the Dead Reckoning algorithms involving acceleration in body coordinates.
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 quaternions given the Euler Angles of the transformation from the world reference system to the body reference system.
Vec3d worldToBody (const Vec3d &value, const Orientation &bodyEulerAngles) noexcept
 Transforms a vector from world coordinates (ECEF) to body coordinates using quaternions given the Euler Angles of the transformation from the world reference system to the body reference system.
Location extrapolateLocationWorld (const Situation &value, sen::Duration delta) noexcept
 Extrapolates the WorldLocation for the algorithms that use the World reference system.
Location extrapolateLocationBody (const Situation &value, sen::Duration delta) noexcept
 Extrapolates the WorldLocation for the algorithms that use the Body reference system.
Velocity extrapolateVelocity (const Velocity &value, const Acceleration &acceleration, sen::Duration delta) noexcept
 Extrapolates Velocities with constant Acceleration.
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 and the angular velocity in world coordinates.
std::array< Vec3d, 3U > getNedTrihedron (const GeodeticWorldLocation &location)
 Returns the NED trihedron at a certain world location given the Latitude and Longitude.
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 (xi, yi, zi) into the final trihedron (xf, yf, zf).
HaversineData haversine (const GeodeticWorldLocation &start, const GeodeticWorldLocation &end)
 Given the start and end Geodetic Locations, returns the Haversine distance and heading.
f64 hypot (f64 var1, f64 var2) noexcept
 Computes the hypotenuse given the sides.
bool hasVelocity (const Velocity &velocity) noexcept
 Returns true if any of the components of the entity velocity is bigger than 0.1 m/s.
bool hasAcceleration (const Acceleration &acceleration) noexcept
 Returns true if any of the components of the entity acceleration is bigger than 0.1 m/s2.
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.

Variables

constexpr std::array< SpatialAlgorithm, 4U > bodyAlgorithms
constexpr f64 pi = 3.14159265358979323846
 PI constant.
constexpr f32 pif = static_cast<f32>(pi)
constexpr f64 twoPi = 2.0 * pi
 2 * PI constant
constexpr f64 halfPi = pi * 0.5
 PI / 2 constant.
constexpr f64 earthSemiMajorAxis = 6378137.0
 Earth's semi.major axis in meters.
constexpr f64 earthFlattening = 1.0 / 298.257223563
 Earth's flattening.
constexpr f64 eccentricitySquared = 6.69437999014e-3
 Square of first eccentricity.
constexpr f32 epsilon = 0.1f
 Min value used to determine that an entity is not moving/accelerating.

Class Documentation

◆ sen::util::HaversineData

struct sen::util::HaversineData

Return type for the haversine helper containing the haversine distance and header between the start and end points.

Class Members
LengthMeters distance
AngleRadians heading
AngleRadians pitch

Typedef Documentation

◆ Mat3f

◆ Mat3d

◆ Quatf

◆ Quatd

◆ Vec3f

◆ Vec3d

Function Documentation

◆ makeRange() [1/2]

template<typename IteratorType>
IteratorRange< IteratorType > sen::util::makeRange ( IteratorType begin,
IteratorType end )

Create a simple range for the two iterators.

Parameters
[in]beginof the range
[in]endof the range

Example:

struct Foo
{
auto values() const { return makeRange(myValues.begin(), myValues.end()); }
private:
std::vector<int> myValues;
};
IteratorRange< IteratorType > makeRange(IteratorType begin, IteratorType end)
Create a simple range for the two iterators.
Definition iterator_adapters.h:52

◆ makeRange() [2/2]

template<typename ContainerType>
auto sen::util::makeRange ( ContainerType & container)

Create a simple range for the given container.

Parameters
[in]containerto iterate over

Example:

struct Foo
{
auto values() const { return makeRange(myValues); }
private:
std::vector<int> myValues;
};

◆ makeLockedRange() [1/2]

template<template< typename > typename LockType, typename IteratorType, typename MutexType>
auto sen::util::makeLockedRange ( IteratorType begin,
IteratorType end,
MutexType & m )

Create a LockedRangeAdapter for the given iterator pair and lock the given mutex.

Template Parameters
LockTypetype of the lock that should be created
Parameters
[in]beginof the range
[in]endof the range
[in]mutexthat should be locked

Example:

for (auto x : makeLockedRange<std::lock_guard>(foo.begin(), foo.end(), fooMutex))
{
// ensures the lock is held during the loop
} // lock release after the loop
auto makeLockedRange(IteratorType begin, IteratorType end, MutexType &m)
Create a LockedRangeAdapter for the given iterator pair and lock the given mutex.
Definition iterator_adapters.h:126

◆ makeLockedRange() [2/2]

template<template< typename > typename LockType, typename ContainerType, typename MutexType>
auto sen::util::makeLockedRange ( ContainerType & container,
MutexType & m )

Create a LockedRangeAdapter for the given container and lock the given mutex.

Template Parameters
LockTypetype of the lock that should be created
Parameters
[in]containerto wrap the range around
[in]mutexthat should be locked

Example:

for (auto x : makeLockedRange<std::lock_guard>(fooVector, fooMutex))
{
// ensures the lock is held during the loop
} // lock release after the loop

◆ toGeodeticSituation()

GeodeticSituation sen::util::toGeodeticSituation ( const Situation & value)
inlinenodiscard

Transform a Situation to a GeodeticSituation.

◆ toSituation()

Situation sen::util::toSituation ( const GeodeticSituation & value)
inlinenodiscard

Transforms a GeodeticSituation to a Situation.

◆ toWorldLocation()

Location sen::util::toWorldLocation ( const Vec3d & value)
nodiscard

Translates a Vec3d instance to an RPR world location structure.

◆ fromWorldLocation()

Vec3d sen::util::fromWorldLocation ( const Location & value)
nodiscard

Converts an RPR world location structure to a Vec3d instance.

◆ fromVelocity()

Vec3d sen::util::fromVelocity ( const Velocity & value)
nodiscard

Converts an RPR velocity vector structure to a Vec3d instance.

◆ toVelocity()

Velocity sen::util::toVelocity ( const Vec3d & value)
nodiscard

Converts a Vec3 to a RPR velocity vector structure.

◆ fromAcceleration()

Vec3d sen::util::fromAcceleration ( const Acceleration & value)
nodiscard

Converts an RPR acceleration vector structure to a Vec3d instance.

◆ toAcceleration()

Acceleration sen::util::toAcceleration ( const Vec3d & value)
nodiscard

Converts an RPR acceleration vector structure to a Vec3d instance.

◆ toAngularAcceleration()

AngularAcceleration sen::util::toAngularAcceleration ( const Vec3d & value)
nodiscard

Converts an RPR angular acceleration vector structure to a Vec3d instance.

◆ fromAngularVelocity()

Vec3d sen::util::fromAngularVelocity ( const AngularVelocity & value)
nodiscard

Converts an RPR angular velocity vector structure to a Vec3d instance.

◆ fromAngularAcceleration()

Vec3d sen::util::fromAngularAcceleration ( const AngularAcceleration & value)
nodiscard

◆ toAngularVelocity()

AngularVelocity sen::util::toAngularVelocity ( const Vec3d & value)
nodiscard

Converts an RPR angular velocity vector structure to a Vec3d instance.

◆ toOrientation()

Orientation sen::util::toOrientation ( const Vec3d & value)
nodiscard

Translates a Vec3d instance to an RPR orientation structure.

◆ fromOrientationToVec()

Vec3d sen::util::fromOrientationToVec ( const Orientation & value)
nodiscard

Converts an RPR orientation structure to a Vec3d instance.

◆ fromOrientationToQuat()

Quatd sen::util::fromOrientationToQuat ( const Orientation & value)
nodiscard

Converts an RPR orientation structure to a Quatf instance.

◆ nedToEcef()

Vec3d sen::util::nedToEcef ( const Vec3d & value,
const GeodeticWorldLocation & latLonAlt )
nodiscardnoexcept

Translates from NED to ECEF location coordinates using quaternions.

◆ ecefToNed()

Vec3d sen::util::ecefToNed ( const Vec3d & value,
const GeodeticWorldLocation & latLonAlt )
nodiscardnoexcept

Translates from ECEF to NED location coordinates using quaternions.

◆ bodyToNed()

Vec3d sen::util::bodyToNed ( const Vec3d & value,
const Orientation & orientationNed )
nodiscardnoexcept

Changes the basis of a vector from body referenced coordinates to NED coordinates.

◆ nedToBody()

Vec3d sen::util::nedToBody ( const Vec3d & value,
const Orientation & orientationNed )
nodiscardnoexcept

Changes the basis of a vector from NED coordinates to body referenced coordinates.

◆ toRad()

f64 sen::util::toRad ( f64 value)
nodiscardnoexcept

Degrees to radians.

◆ toDeg()

f64 sen::util::toDeg ( f64 value)
nodiscardnoexcept

Radians to degrees.

◆ makeR1()

Mat3d sen::util::makeR1 ( const Vec3d & omega,
f64 delta )
nodiscard

Returns the R1 matrix used in the Dead Reckoning algorithms involving velocity in body coordinates.

◆ makeR2()

Mat3d sen::util::makeR2 ( const Vec3d & omega,
f64 delta )
nodiscard

Returns the R2 matrix used in the Dead Reckoning algorithms involving acceleration in body coordinates.

◆ bodyToWorld()

Vec3d sen::util::bodyToWorld ( const Vec3d & value,
const Orientation & bodyEulerAngles )
nodiscardnoexcept

Transforms a vector from body coordinates (x forward, y right, z down ) to world coordinates using quaternions given the Euler Angles of the transformation from the world reference system to the body reference system.

◆ worldToBody()

Vec3d sen::util::worldToBody ( const Vec3d & value,
const Orientation & bodyEulerAngles )
nodiscardnoexcept

Transforms a vector from world coordinates (ECEF) to body coordinates using quaternions given the Euler Angles of the transformation from the world reference system to the body reference system.

◆ extrapolateLocationWorld()

Location sen::util::extrapolateLocationWorld ( const Situation & value,
sen::Duration delta )
nodiscardnoexcept

Extrapolates the WorldLocation for the algorithms that use the World reference system.

◆ extrapolateLocationBody()

Location sen::util::extrapolateLocationBody ( const Situation & value,
sen::Duration delta )
nodiscardnoexcept

Extrapolates the WorldLocation for the algorithms that use the Body reference system.

◆ extrapolateVelocity()

Velocity sen::util::extrapolateVelocity ( const Velocity & value,
const Acceleration & acceleration,
sen::Duration delta )
nodiscardnoexcept

Extrapolates Velocities with constant Acceleration.

◆ extrapolateOrientation()

Orientation sen::util::extrapolateOrientation ( const Orientation & value,
sen::Duration delta,
const AngularVelocity & angularVelocity,
const AngularAcceleration & angularAcceleration = {} )
nodiscardnoexcept

Performs a linear extrapolation the orientation of an entity using quaternions given a delta of time and the angular velocity in world coordinates.

◆ getNedTrihedron()

std::array< Vec3d, 3U > sen::util::getNedTrihedron ( const GeodeticWorldLocation & location)
nodiscard

Returns the NED trihedron at a certain world location given the Latitude and Longitude.

◆ eulerAnglesFromTrihedrons()

Orientation sen::util::eulerAnglesFromTrihedrons ( const Vec3d & xi,
const Vec3d & yi,
const Vec3d & zi,
const Vec3d & xf,
const Vec3d & yf )
nodiscard

Given two trihedrons of vectors, computes the Euler Angles needed to transform the initial trihedron (xi, yi, zi) into the final trihedron (xf, yf, zf).

◆ haversine()

HaversineData sen::util::haversine ( const GeodeticWorldLocation & start,
const GeodeticWorldLocation & end )
nodiscard

Given the start and end Geodetic Locations, returns the Haversine distance and heading.

◆ hypot()

f64 sen::util::hypot ( f64 var1,
f64 var2 )
nodiscardnoexcept

Computes the hypotenuse given the sides.

◆ hasVelocity()

bool sen::util::hasVelocity ( const Velocity & velocity)
nodiscardnoexcept

Returns true if any of the components of the entity velocity is bigger than 0.1 m/s.

◆ hasAcceleration()

bool sen::util::hasAcceleration ( const Acceleration & acceleration)
nodiscardnoexcept

Returns true if any of the components of the entity acceleration is bigger than 0.1 m/s2.

◆ hasAngularVelocity()

bool sen::util::hasAngularVelocity ( const AngularVelocity & omega)
nodiscardnoexcept

Returns true if any of the components of the entity angular velocity is bigger than 1e-3 rad/s.

Variable Documentation

◆ pi

f64 sen::util::pi = 3.14159265358979323846
constexpr

PI constant.

◆ pif

f32 sen::util::pif = static_cast<f32>(pi)
constexpr

◆ twoPi

f64 sen::util::twoPi = 2.0 * pi
constexpr

2 * PI constant

◆ halfPi

f64 sen::util::halfPi = pi * 0.5
constexpr

PI / 2 constant.

◆ earthSemiMajorAxis

f64 sen::util::earthSemiMajorAxis = 6378137.0
constexpr

Earth's semi.major axis in meters.

◆ earthFlattening

f64 sen::util::earthFlattening = 1.0 / 298.257223563
constexpr

Earth's flattening.

◆ eccentricitySquared

f64 sen::util::eccentricitySquared = 6.69437999014e-3
constexpr

Square of first eccentricity.

◆ epsilon

f32 sen::util::epsilon = 0.1f
constexpr

Min value used to determine that an entity is not moving/accelerating.