a/tracking: Rename slam prediction types to be more readable
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2651>
9 unmodified lines101112131415161718192021222324252627282930313233343536373839407 unmodified lines48495051525354555627 unmodified lines84858687828889909192836 unmodified linesExpand all92993093193292793393493593693793893393994094194294394494594694194794894995095195295394895495595695795870 unmodified lines1029103010311032102710331034103510361037607 unmodified linesExpand all9 unmodified lines#include "xrt/xrt_config_have.h"#include "xrt/xrt_defines.h"#include "xrt/xrt_tracking.h"#include "xrt/xrt_frameserver.h"
#include "util/u_debug.h"#include "util/u_logging.h"#include "util/u_misc.h"#include "util/u_sink.h"#include "util/u_var.h"#include "util/u_trace_marker.h"
#include "os/os_threading.h"
#include "math/m_api.h"#include "math/m_filter_fifo.h"#include "math/m_filter_one_euro.h"#include "math/m_predict.h"#include "math/m_relation_history.h"#include "math/m_space.h"#include "math/m_vec3.h"
#include "tracking/t_euroc_recorder.h"#include "tracking/t_openvr_tracker.h"#include "tracking/t_tracking.h"#include "tracking/t_vit_loader.h"#include "tracking/t_dead_reckoning.h"
#include "vit/vit_interface.h"
#include <opencv2/core/mat.hpp>7 unmodified lines#include <mutex>#include <string>#include <vector>
//! @todo Get preferred system from systems found at build time#define PREFERRED_VIT_SYSTEM_LIBRARY "libbasalt.so"
#define SLAM_TRACE(...) U_LOG_IFL_T(t.log_level, __VA_ARGS__)27 unmodified linesDEBUG_GET_ONCE_OPTION(slam_config, "SLAM_CONFIG", nullptr)DEBUG_GET_ONCE_BOOL_OPTION(slam_ui, "SLAM_UI", false)DEBUG_GET_ONCE_BOOL_OPTION(slam_submit_from_start, "SLAM_SUBMIT_FROM_START", false)DEBUG_GET_ONCE_NUM_OPTION(slam_openvr_groundtruth_device, "SLAM_OPENVR_GROUNDTRUTH_DEVICE", 0)DEBUG_GET_ONCE_NUM_OPTION(slam_prediction_type, "SLAM_PREDICTION_TYPE", long(SLAM_PRED_IP_IO_IA_IL))DEBUG_GET_ONCE_NUM_OPTION(slam_prediction_type, "SLAM_PREDICTION_TYPE", long(SLAM_PRED_DEAD_RECKONING))DEBUG_GET_ONCE_BOOL_OPTION(slam_write_csvs, "SLAM_WRITE_CSVS", false)DEBUG_GET_ONCE_OPTION(slam_csv_path, "SLAM_CSV_PATH", "evaluation/")DEBUG_GET_ONCE_BOOL_OPTION(slam_timing_stat, "SLAM_TIMING_STAT", true)DEBUG_GET_ONCE_BOOL_OPTION(slam_features_stat, "SLAM_FEATURES_STAT", true)836 unmodified linesExpand all }
// Use only SLAM data if asking for an old point in time or PREDICTION_SP_SO_SA_SL SLAM_DASSERT_(rel_ts < INT64_MAX); if (t.pred_type == SLAM_PRED_SP_SO_SA_SL || when_ns <= (int64_t)rel_ts) { if (t.pred_type == SLAM_PRED_POSE_ONLY || when_ns <= (int64_t)rel_ts) { t.slam_rels.get(when_ns, out_relation); return; }
if (t.pred_type == SLAM_PRED_IP_IO_IA_IL) { if (t.pred_type == SLAM_PRED_DEAD_RECKONING) { predict_pose_from_imu(t, when_ns, rel, (int64_t)rel_ts, out_relation); return; }
os_mutex_lock(&t.lock_ff);
// Update angular velocity with gyro data if (t.pred_type >= SLAM_PRED_SP_SO_IA_SL) { if (t.pred_type >= SLAM_PRED_GYRO) { xrt_vec3 avg_gyro{}; m_ff_vec3_f32_filter(t.gyro_ff, rel_ts, when_ns, &avg_gyro); math_quat_rotate_derivative(&rel.pose.orientation, &avg_gyro, &rel.angular_velocity); }
// Update linear velocity with accel data if (t.pred_type >= SLAM_PRED_SP_SO_IA_IL) { if (t.pred_type >= SLAM_PRED_ACCEL_GYRO) { xrt_vec3 avg_accel{}; m_ff_vec3_f32_filter(t.accel_ff, rel_ts, when_ns, &avg_accel); xrt_vec3 world_accel{}; math_quat_rotate_vec3(&rel.pose.orientation, &avg_accel, &world_accel);70 unmodified linesstatic voidsetup_ui(TrackerSlam &t){ t.pred_combo.count = SLAM_PRED_COUNT; t.pred_combo.options = "None\0Interpolate SLAM poses\0Also gyro\0Also accel\0Latest IMU\0"; t.pred_combo.options = "NONE\0POSE_ONLY\0GYRO\0ACCEL_GYRO\0DEAD_RECKONING\0"; t.pred_combo.value = (int *)&t.pred_type; t.ui_sink = vector<u_sink_debug>(t.cam_count); for (size_t i = 0; i < t.ui_sink.size(); i++) { u_sink_debug_init(&t.ui_sink[i]);607 unmodified linesExpand all606 unmodified linesExpand all607608609610611612613614615616611612613614615616617618619620262 unmodified linesExpand all606 unmodified linesExpand all * @see xrt_tracked_slam */enum t_slam_prediction_type{ SLAM_PRED_NONE = 0, //!< No prediction, always return the last SLAM tracked pose SLAM_PRED_SP_SO_SA_SL, //!< Predicts from last two SLAM poses only SLAM_PRED_SP_SO_IA_SL, //!< Predicts from last SLAM pose with angular velocity computed from IMU SLAM_PRED_SP_SO_IA_IL, //!< Predicts from last SLAM pose with angular and linear velocity computed from IMU SLAM_PRED_IP_IO_IA_IL, //!< Predicts from a pose that is the last SLAM pose with the IMU samples that came after //!< it integrated on top; velocities from latest IMU sample. SLAM_PRED_NONE = 0, //!< No prediction, always return the last SLAM tracked pose SLAM_PRED_POSE_ONLY, //!< Predicts from last two SLAM poses only SLAM_PRED_GYRO, //!< Predicts from last SLAM pose with angular velocity computed from IMU SLAM_PRED_ACCEL_GYRO, //!< Predicts from last SLAM pose with angular and linear velocity computed from IMU SLAM_PRED_DEAD_RECKONING, //!< Predicts from a pose that is the last SLAM pose with the IMU samples that came //!< after it integrated on top; velocities from latest IMU sample. SLAM_PRED_COUNT,};
/*!262 unmodified linesExpand all