Class BufferedPva

Inheritance Relationships

Derived Types

Class Documentation

class BufferedPva

Class that maintains a time history of and provides access to calculated PVAs.

It is not meant to be used directly but provides functionality for child classes to build off of.

Subclassed by navtk::inertial::BufferedImu, navtk::inertial::BufferedIns

Public Functions

virtual ~BufferedPva() = default
BufferedPva(const BufferedPva&) = default

Copy constructor.

Defaulted.

BufferedPva &operator=(const BufferedPva&) = default

Copy assignment.

Defaulted.

Returns

*this

BufferedPva(BufferedPva&&) = default

Move constructor.

Defaulted.

BufferedPva &operator=(BufferedPva&&) = default

Move assignment.

Defaulted.

Returns

*this

virtual void add_data(not_null<std::shared_ptr<aspn_xtensor::AspnBase>> data) = 0

Child classes will need to have an implementation-specific data class added periodically in order to increase the time span that this buffer covers.

This method provides a common interface to add data to child classes.

Parameters

data – The data to add.

std::shared_ptr<aspn_xtensor::MeasurementPositionVelocityAttitude> calc_pva(const aspn_xtensor::TypeTimestamp &time) const

Get solution at time.

Parameters

time – Requested solution time.

Returns

Solution at time, or nullptr if Time is not within the available history of solutions.

not_null<std::shared_ptr<aspn_xtensor::MeasurementPositionVelocityAttitude>> calc_pva() const

Get most recent solution.

Throws

std::runtime_error – If this instance has been ‘moved’ from.

Returns

Most recent solution stored.

std::pair<aspn_xtensor::TypeTimestamp, aspn_xtensor::TypeTimestamp> time_span() const

Get available time range of solutions.

Returns

Pair of times (first being the earlier time and second being the later` time) indicating the range of time over which PVA is available. If there is no history of solutions available, returned times will both equal std::numeric_limits<double>::lowest(). If only one PVA resides in the buffer, then both times returned will be the time of that PVA.

std::pair<int64_t, int64_t> nsec_time_span() const

Get available time range of solutions in a 64-bit represented integer, nanoseconds.

Returns

Pair of times (first being the earlier time and second being the later` time) indicating the range of time over which PVA is available. If there is no history of solutions available, returned times will both equal std::numeric_limits<double>::lowest(). If only one PVA resides in the buffer, then both times returned will be the time of that PVA.

bool in_range(const aspn_xtensor::TypeTimestamp &t) const

Determines if a time is within the available history of solutions, which is a prerequisite for most operations.

Parameters

t – Time to check.

Returns

True if t lies within the stored history of solutions. This return is invalidated by a call to mechanize().

virtual std::shared_ptr<aspn_xtensor::MeasurementImu> calc_force_and_rate(const aspn_xtensor::TypeTimestamp &time) const

Get the average specific force and inertial sensor frame rotation rate between two solutions close to the requested time.

Parameters

time – Requested time of force and rate.

Returns

If time is within the available history of solutions, the specific force in the NED frame, in m/s^2, and inertial sensor frame rotation rate in inertial sensor frame in rad/s. Otherwise, a nullptr. This force and rate will be returned as an aspn_xtensor::MeasurementImu with the imu type set to ASPN_MEASUREMENT_IMU_IMU_TYPE_SAMPLED. If time is in between two solutions, then the force and rate will be calculated from the two bordering solutions. Otherwise, if time matches a solution’s time, it uses the two neighboring PVAs to calculate the force and rate. If only one neighboring PVA exists, then the other one is interpolated from the matched PVA and the existing neighbor. If neither neighboring PVA exists, then a nullptr is returned.

virtual std::shared_ptr<aspn_xtensor::MeasurementImu> calc_force_and_rate(const aspn_xtensor::TypeTimestamp &time1, const aspn_xtensor::TypeTimestamp &time2) const

Get average specific force and rotation rate between the solutions at two times.

Parameters
  • time1 – Start time of range, inclusive.

  • time2 – Stop time of range, inclusive.

Returns

Average specific force in the NED frame in m/s^2, and average inertial sensor frame rotation rate, in the inertial sensor frame in rad/s over the requested time range. This force and rate will be returned as an aspn_xtensor::MeasurementImu with the imu type set to ASPN_MEASUREMENT_IMU_IMU_TYPE_SAMPLED. The frames are approximations of the frames midway between time1 and time2. If either time1 or time2 are not within the available history of solutions, returns a nullptr.

Protected Functions

BufferedPva(std::shared_ptr<aspn_xtensor::MeasurementPositionVelocityAttitude> pva = nullptr, double expected_dt = 1.0, double buffer_length = 60.0)

Constructor.

Parameters
  • pva – Time-tagged initial position, velocity and attitude nullptr if unknown.

  • expected_dt – The typical delta time between PVAs, in seconds.

  • buffer_length – Amount of data, in seconds, this class should keep in history. Max number of accessible buffer elements is buffer_length/expected_dt + 2.

BufferedPva(const aspn_xtensor::MeasurementPositionVelocityAttitude &pva, double expected_dt = 1.0, double buffer_length = 60.0)

Constructor.

Parameters
  • pva – Time-tagged initial position, velocity and attitude.

  • expected_dt – The typical delta time between PVAs, in seconds.

  • buffer_length – Amount of data, in seconds, this class should keep in history. Max number of accessible buffer elements is buffer_length/expected_dt + 2.

std::shared_ptr<aspn_xtensor::MeasurementPositionVelocityAttitude> calc_pva_no_check(const aspn_xtensor::TypeTimestamp &time) const

Allows calc_pva access to the ‘extra’ value on the PVA buffer by not checking if in_range(), which normally excludes this value when the buffer is full.

This is useful for implementations which wrap an inertial since it enables proper repropagation from the first ‘time_span’ time in the case the underlying Inertial is using high-order mechanization methods that require a ‘prior’ PVA when resetting, such as Simpsons.

Parameters

time – Requested solution time.

Returns

Solution at time, or nullptr if Time is not within the available history of solutions.

Protected Attributes

filtering::TimestampedDataSeries<aspn_xtensor::MeasurementPositionVelocityAttitude, aspn_xtensor::TypeTimestamp> pva_buf

Buffers solution history, with resets.

In other words, this is a sorted container where the earlier times are in the front and the later times are in the back.