The OrientationHistory class implements a timestamped history of orientation data (e.g., from an IMU).
More...
#include <OrientationHistory.h>
|
const int | MAX_ORIENTATION_HISTORY_LENGTH_NUM_SAMPLES = 1000 |
|
The OrientationHistory class implements a timestamped history of orientation data (e.g., from an IMU).
The OrientationHistory is populated by data from a "timestamped quaternion" sensor, such as the navX-MXP.
The OrientationHistory buffers the orientation data received over the most current time period between "now" and the size of the time history, and provides methods to retrieve orientation data in the form of TimestampedQuaternion objects. These objects can be looked up based upon a timestamp; if an exact match is found the object is returned direction; otherwise if TimestampedQuaternion objects exist for the times before and after the requested timestamp, a new TimestampedQuaterion object is created via interpolation.
- Author
- Scott
OrientationHistory::OrientationHistory |
( |
ISensorInfo * |
p_sensor, |
|
|
int |
history_length_num_samples |
|
) |
| |
|
inline |
Constructs an OrientationHistory object with a specified size.
The OrientationHistory registers for incoming data using the provided ITimestampedQuaternionSensor object.
- Parameters
-
quat_sensor | - the sensor to acquire TimestampedQuaternion objects from. |
history_length_seconds | - the length of the OrientationHistory, in seconds. The actual length of the OrientationHistory in number of objects is calculated internally by accessing the sensor's current update rate. Note: if the sensor update rate is changed, after this constructor is invoked, the length of the history may no longer accurately reflect the originally-configured length. |
quat_sensor | - the sensor to use as the source of TimestampedQuaternions contained in the Orientation History |
history_length_seconds | - the number of seconds the history will represent. This value may not be larger than #MAX_ORIENTATION_HISTORY_IN_SECONDS seconds. |
Retrieves the most recently added Quaternion.
- Returns
float OrientationHistory::getPitchDegreesAtTime |
( |
long |
requested_timestamp | ) |
|
|
inline |
Retrieves the pitch angle in degrees at the specified sensor timestamp.
Note that this value may be interpolated if a sample at the requested time is not available.
- Parameters
-
- Returns
- Pitch angle (in degrees, range -180 to 180) at the requested timestamp. If a pitch angle at the specified timestamp could not be found/interpolated, the value INVALID_ANGLE (NaN) will be returned.
Retrieves the TimestampedQuaterion at the specified sensor timestamp.
If an exact timestamp match occurs, a TimestampedQuaternion representing the actual (measured) data is returned; otherwise a new interpolated TimestampedQuaternion will be estimated, using the nearest preceding/following TimestampedQuaternion and the requested timestamp's ratio of time between them as its basis. If no exact match could be found or interpolated value estimated, null is returned.
- Parameters
-
requested_timestamp | - sensor timestamp to retrieve |
- Returns
- TimestampedQuaternion at requested timestamp, or null.
float OrientationHistory::getRollDegreesAtTime |
( |
long |
requested_timestamp | ) |
|
|
inline |
Retrieves the roll angle in degrees at the specified sensor timestamp.
Note that this value may be interpolated if a sample at the requested time is not available.
- Parameters
-
- Returns
- Roll angle (in degrees, range -180 to 180) at the requested timestamp. If a roll angle at the specified timestamp could not be found/interpolated, the value INVALID_ANGLE (NaN) will be returned.
float OrientationHistory::getYawDegreesAtTime |
( |
long |
requested_timestamp | ) |
|
|
inline |
Retrieves the yaw angle in degrees at the specified sensor timestamp.
Note that this value may be interpolated if a sample at the requested time is not available.
- Parameters
-
- Returns
- Yaw angle (in degrees, range -180 to 180) at the requested timestamp. If a yaw angle at the specified timestamp could not be found/interpolated, the value INVALID_ANGLE (NaN) will be returned.
void OrientationHistory::reset |
( |
| ) |
|
|
inline |
The documentation for this class was generated from the following file: