Monado OpenXR Runtime
Files | Functions

Trackers, filters and associated helper code. More...

Collaboration diagram for Tracking:

Files

file  t_calibration.cpp
 Calibration code.
 
file  t_calibration_opencv.hpp
 OpenCV calibration helpers.
 
file  t_convert.cpp
 Code to build conversion tables and convert images.
 
file  t_data_utils.c
 Small data helpers for calibration.
 
file  t_debug_hsv_filter.cpp
 HSV filter debug code.
 
file  t_debug_hsv_picker.cpp
 HSV Picker Debugging code.
 
file  t_debug_hsv_viewer.cpp
 HSV debug viewer code.
 
file  t_file.cpp
 Handling of files and calibration data.
 
file  t_fusion.hpp
 C++ sensor fusion/filtering code that uses flexkalman.
 
file  t_helper_debug_sink.hpp
 Small helper struct that for debugging views.
 
file  t_hsv_filter.c
 A simple HSV filter.
 
file  t_imu.cpp
 IMU fusion implementation - for inclusion into the single kalman-incuding translation unit.
 
file  t_imu.h
 C interface to basic IMU fusion.
 
file  t_imu_fusion.hpp
 C++ sensor fusion/filtering code that uses flexkalman.
 
file  t_kalman.cpp
 Single compiled file for all kalman filter using source.
 
file  t_lowpass.hpp
 Low-pass IIR filter.
 
file  t_lowpass_vector.hpp
 Low-pass IIR filter on vectors.
 
file  t_tracker_psmv.cpp
 PS Move tracker code.
 
file  t_tracker_psmv_fusion.cpp
 PS Move tracker code that is expensive to compile.
 
file  t_tracker_psmv_fusion.hpp
 PS Move tracker code.
 
file  t_tracker_psvr.cpp
 PSVR tracker code.
 
file  t_tracking.h
 Tracking API interface.
 

Functions

struct imu_fusionimu_fusion::imu_fusion_create ()
 Create a struct imu_fusion. More...
 
void imu_fusion::imu_fusion_destroy (struct imu_fusion *fusion)
 Destroy a struct imu_fusion. More...
 
int imu_fusion::imu_fusion_incorporate_gyros (struct imu_fusion *fusion, uint64_t timestamp_ns, struct xrt_vec3 const *ang_vel, struct xrt_vec3 const *ang_vel_variance)
 Predict and correct fusion with a gyroscope reading. More...
 
int imu_fusion::imu_fusion_incorporate_accelerometer (struct imu_fusion *fusion, uint64_t timestamp_ns, struct xrt_vec3 const *accel, struct xrt_vec3 const *accel_variance, struct xrt_vec3 *out_world_accel)
 Predict and correct fusion with an accelerometer reading. More...
 
int imu_fusion::imu_fusion_incorporate_gyros_and_accelerometer (struct imu_fusion *fusion, uint64_t timestamp_ns, struct xrt_vec3 const *ang_vel, struct xrt_vec3 const *ang_vel_variance, struct xrt_vec3 const *accel, struct xrt_vec3 const *accel_variance, struct xrt_vec3 *out_world_accel)
 Predict and correct fusion with a simultaneous accelerometer and gyroscope reading. More...
 
int imu_fusion::imu_fusion_get_prediction (struct imu_fusion const *fusion, uint64_t timestamp_ns, struct xrt_quat *out_quat, struct xrt_vec3 *out_ang_vel)
 Get the predicted state. More...
 
int imu_fusion::imu_fusion_get_prediction_rotation_vec (struct imu_fusion const *fusion, uint64_t timestamp_ns, struct xrt_vec3 *out_rotation_vec)
 Get the predicted state as a rotation vector. More...
 

Detailed Description

Trackers, filters and associated helper code.

Coordinate system

Right now there is no specific convention on where a tracking systems coordinate system is centered, and is something we probably need to figure out. Right now the stereo based tracking system used by the PSVR and PSMV tracking system is centered on the camera that OpenCV decided is origin.

To go a bit further on the PSVR/PSMV case. Think about a idealized start up case, the user is wearing the HMD headset and holding two PSMV controllers. The HMD's coordinate system axis are perfectly parallel with the user coordinate with the user's coordinate system. Where -Z is forward. The user holds the controllers with the ball pointing up and the buttons on the back pointing forward. Which if you read the documentation of psmv_device will that the axis of the PSMV are also perfectly aligned with the users coordinate system. So everything "attached" to the user have it's coordinate system parallel to the user's.

The camera on the other hand is looking directly at the user, it's Z-axis and X-axis is flipped in relation to the user's. So to compare what is sees to what the user sees, everything is rotated 180° around the Y-axis.

Function Documentation

◆ imu_fusion_create()

struct imu_fusion * imu_fusion_create ( )

Create a struct imu_fusion.

◆ imu_fusion_destroy()

void imu_fusion_destroy ( struct imu_fusion fusion)

Destroy a struct imu_fusion.

Should not be called simultaneously with any other imu_fusion function.

Parameters
fusionThe IMU Fusion object

◆ imu_fusion_get_prediction()

int imu_fusion_get_prediction ( struct imu_fusion const *  fusion,
uint64_t  timestamp_ns,
struct xrt_quat out_quat,
struct xrt_vec3 out_ang_vel 
)

Get the predicted state.

Does not advance the internal state clock.

Non-zero return means error.

Parameters
fusionThe IMU Fusion object
timestamp_nsThe timestamp corresponding to the predicted state you want.
out_quatThe quaternion to populate with the predicted orientation.
out_ang_velThe vector to poluate with the predicted angular velocity.

◆ imu_fusion_get_prediction_rotation_vec()

int imu_fusion_get_prediction_rotation_vec ( struct imu_fusion const *  fusion,
uint64_t  timestamp_ns,
struct xrt_vec3 out_rotation_vec 
)

Get the predicted state as a rotation vector.

Does not advance the internal state clock.

This is mostly for debugging: a rotation vector can be easier to visualize or understand intuitively.

Non-zero return means error.

Parameters
fusionThe IMU Fusion object
timestamp_nsThe timestamp corresponding to the predicted state you want.
out_rotation_vecThe vector to poluate with the predicted orientation rotation vector.

◆ imu_fusion_incorporate_accelerometer()

int imu_fusion_incorporate_accelerometer ( struct imu_fusion fusion,
uint64_t  timestamp_ns,
struct xrt_vec3 const *  accel,
struct xrt_vec3 const *  accel_variance,
struct xrt_vec3 out_world_accel 
)

Predict and correct fusion with an accelerometer reading.

If you're receiving accel and gyro data at the same time, call imu_fusion_incorporate_gyros_and_accelerometer() instead.

Should not be called simultaneously with any other imu_fusion function.

Non-zero return means error.

Parameters
fusionThe IMU Fusion object
timestamp_nsThe timestamp corresponding to the information being processed with this call.
accelAccelerometer data (in m/s/s) including the effect of gravity - assumed to be +y when aligned with the world.
accel_varianceThe variance of the accelerometer measurements: part of the characteristics of the IMU being used.
out_world_accelOptional output parameter: will contain the non-gravity acceleration in the world frame.

◆ imu_fusion_incorporate_gyros()

int imu_fusion_incorporate_gyros ( struct imu_fusion fusion,
uint64_t  timestamp_ns,
struct xrt_vec3 const *  ang_vel,
struct xrt_vec3 const *  ang_vel_variance 
)

Predict and correct fusion with a gyroscope reading.

dt should not be zero: If you're receiving accel and gyro data at the same time, call imu_fusion_incorporate_gyros_and_accelerometer() instead.

Should not be called simultaneously with any other imu_fusion function.

Non-zero return means error.

Parameters
fusionThe IMU Fusion object
timestamp_nsThe timestamp corresponding to the information being processed with this call.
ang_velAngular velocity vector from gyroscope: in radians per second.
ang_vel_varianceThe variance of the angular velocity measurements: part of the characteristics of the IMU being used.

◆ imu_fusion_incorporate_gyros_and_accelerometer()

int imu_fusion_incorporate_gyros_and_accelerometer ( struct imu_fusion fusion,
uint64_t  timestamp_ns,
struct xrt_vec3 const *  ang_vel,
struct xrt_vec3 const *  ang_vel_variance,
struct xrt_vec3 const *  accel,
struct xrt_vec3 const *  accel_variance,
struct xrt_vec3 out_world_accel 
)

Predict and correct fusion with a simultaneous accelerometer and gyroscope reading.

Should not be called simultaneously with any other imu_fusion function.

Non-zero return means error.

Parameters
fusionThe IMU Fusion object
timestamp_nsThe timestamp corresponding to the information being processed with this call.
ang_velAngular velocity vector from gyroscope: radians/s
ang_vel_varianceThe variance of the angular velocity measurements: part of the characteristics of the IMU being used.
accelAccelerometer data (in m/s/s) including the effect of gravity - assumed to be +y when aligned with the world.
accel_varianceThe variance of the accelerometer measurements: part of the characteristics of the IMU being used.
out_world_accelOptional output parameter: will contain the non-gravity acceleration in the world frame.