Class DynData

Class Documentation

class DynData

A container that calculates a number of derived values (velocities, forces) covering a short time history of position and IMU data.

Public Types

enum class RecentPositionsEnum

DynData contains the three most recently received positions.

This enum allows selection of these positions.

Values:

enumerator MOST_RECENT

The position corresponding to the current position in time.

enumerator SECOND_MOST_RECENT

The position one time step in the past.

enumerator THIRD_MOST_RECENT

The position two time steps in the past.

Public Functions

DynData(const aspn_xtensor::MeasurementPosition &origin)

Constructor.

Parameters

origin – Position of the origin of the NED frame in which all local-level values will be referenced.

bool enough_data()

Indicates if the user has provided enough data that forces can theoretically be calculated.

Returns

true if update() has been called at least twice; false otherwise.

void update(const aspn_xtensor::MeasurementPosition &new_pos, const std::vector<aspn_xtensor::MeasurementImu> &align_buffer)

Update the time history of measurements and derived values.

Parameters
  • new_pos – The latest position measurement. Assumed to have occurred after the position provided to the last call of this function (or class instantiation).

  • align_buffer – A time sorted collection of all IMU measurements that occurred between the last call to this function and the time of validity of new_pos. If a significant number of IMU measurements are missing (a more than 5% deviation between the average delta time between measurements and the expected dt based on the number of measurements received) or the number of IMU measurements is less than 2, then this measurement period will be considered invalid. It is assumed that all imu measurements in align_buffer are of type ASPN_MEASUREMENT_IMU_IMU_TYPE_INTEGRATED.

std::pair<bool, Vector3> get_force_from_imu()

Get the estimated average specific force from IMU data.

Returns

A pair where .first is the validity of the force, and .second is the 3-D force, valid at the ‘mid time’; that is the same time of validity returned by get_vel_mid(). Validity will be false if not enough_data().

Vector3 get_force_from_pos()

Get the estimated average specific force from position data.

Returns

The 3-D force, valid at the ‘mid time’; that is the same time of validity returned by get_vel_mid().

std::pair<aspn_xtensor::TypeTimestamp, Vector3> get_vel_mid()

Get the estimated velocity at the ‘midpoint’ position time.

Returns

A pair containing the time of validity and the NED velocity in m/s. The velocity is calculated from double differencing of the positions returned by get_positions(), and corresponds to the middle element of that vector. Will not be valid if enough_data() returns false.

std::vector<aspn_xtensor::MeasurementPosition> get_positions()

Get the last 3 positions received.

Returns

A 3-length vector that contains the last 3 positions received, oldest first. This vector is initially filled with copies of the origin (as returned by get_origin()); each call to update() will ‘push down’ the stack, removing the previous oldest element.

const aspn_xtensor::MeasurementPosition &get_position(const RecentPositionsEnum &recency) const

Get one of the most recent positions.

Parameters

recency – RecentPositionsEnum.

Returns

The chosen position.

const aspn_xtensor::MeasurementPosition &get_origin() const

The origin of the local frame (as passed to the constructor).

Returns

The position of the frame origin.

std::pair<double, double> get_lat_lon_factors()

Get the radians to meters conversion factors for the local frame defined by the position returned by get_origin().

Returns

A pair containing a) the multiplier that converts a delta latitude (in radians) to meters in local north, and b) the multiplier that converts a delta longitude (in radians) to meters in local east.