t/slam: Add SLAM_UI option to enable the external system UI

This commit is contained in:
Mateo de Mayo 2022-10-15 17:17:45 -03:00 committed by Jakob Bornecrantz
parent fb28f940b5
commit 80fdf7317f
3 changed files with 20 additions and 12 deletions
src
external/slam_tracker
xrt/auxiliary/tracking

View file

@ -29,7 +29,7 @@ namespace xrt::auxiliary::tracking::slam {
// For implementation: same as IMPLEMENTATION_VERSION_* // For implementation: same as IMPLEMENTATION_VERSION_*
// For user: expected IMPLEMENTATION_VERSION_*. Should be checked in runtime. // For user: expected IMPLEMENTATION_VERSION_*. Should be checked in runtime.
constexpr int HEADER_VERSION_MAJOR = 4; //!< API Breakages constexpr int HEADER_VERSION_MAJOR = 5; //!< API Breakages
constexpr int HEADER_VERSION_MINOR = 0; //!< Backwards compatible API changes constexpr int HEADER_VERSION_MINOR = 0; //!< Backwards compatible API changes
constexpr int HEADER_VERSION_PATCH = 0; //!< Backw. comp. .h-implemented changes constexpr int HEADER_VERSION_PATCH = 0; //!< Backw. comp. .h-implemented changes
@ -87,6 +87,17 @@ struct img_sample {
: timestamp(timestamp), img(img), is_left(is_left) {} : timestamp(timestamp), img(img), is_left(is_left) {}
}; };
/*!
* @brief Parameters for creating the system pipeline.
*/
struct slam_config {
//! Path to a implementation-specific config file. If null, use defaults.
std::shared_ptr<std::string> config_file;
//! If supported, whether to open the system's UI.
bool show_ui;
};
/*! /*!
* @brief slam_tracker serves as an interface between Monado and external SLAM * @brief slam_tracker serves as an interface between Monado and external SLAM
* systems. * systems.
@ -95,15 +106,7 @@ struct img_sample {
* should be provided by an external SLAM system. * should be provided by an external SLAM system.
*/ */
struct slam_tracker { struct slam_tracker {
/*! slam_tracker(const slam_config &config);
* @brief Construct a new slam tracker object
*
* @param config_file SLAM systems parameters tend to be numerous and very
* specific, so they usually use a configuration file as the main way to set
* them up. Therefore, this constructor receives a path to a
* implementation-specific configuration file.
*/
slam_tracker(const std::string &config_file);
~slam_tracker(); ~slam_tracker();
slam_tracker(const slam_tracker &) = delete; slam_tracker(const slam_tracker &) = delete;

View file

@ -66,6 +66,7 @@
//! @see t_slam_tracker_config //! @see t_slam_tracker_config
DEBUG_GET_ONCE_LOG_OPTION(slam_log, "SLAM_LOG", U_LOGGING_INFO) DEBUG_GET_ONCE_LOG_OPTION(slam_log, "SLAM_LOG", U_LOGGING_INFO)
DEBUG_GET_ONCE_OPTION(slam_config, "SLAM_CONFIG", nullptr) DEBUG_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_BOOL_OPTION(slam_submit_from_start, "SLAM_SUBMIT_FROM_START", false)
DEBUG_GET_ONCE_NUM_OPTION(slam_prediction_type, "SLAM_PREDICTION_TYPE", long(SLAM_PRED_SP_SO_IA_SL)) DEBUG_GET_ONCE_NUM_OPTION(slam_prediction_type, "SLAM_PREDICTION_TYPE", long(SLAM_PRED_SP_SO_IA_SL))
DEBUG_GET_ONCE_BOOL_OPTION(slam_write_csvs, "SLAM_WRITE_CSVS", false) DEBUG_GET_ONCE_BOOL_OPTION(slam_write_csvs, "SLAM_WRITE_CSVS", false)
@ -1268,6 +1269,7 @@ t_slam_fill_default_config(struct t_slam_tracker_config *config)
{ {
config->log_level = debug_get_log_option_slam_log(); config->log_level = debug_get_log_option_slam_log();
config->slam_config = debug_get_option_slam_config(); config->slam_config = debug_get_option_slam_config();
config->slam_ui = debug_get_bool_option_slam_ui();
config->submit_from_start = debug_get_bool_option_slam_submit_from_start(); config->submit_from_start = debug_get_bool_option_slam_submit_from_start();
config->prediction = t_slam_prediction_type(debug_get_num_option_slam_prediction_type()); config->prediction = t_slam_prediction_type(debug_get_num_option_slam_prediction_type());
config->write_csvs = debug_get_bool_option_slam_write_csvs(); config->write_csvs = debug_get_bool_option_slam_write_csvs();
@ -1321,8 +1323,10 @@ t_slam_create(struct xrt_frame_context *xfctx,
t.base.get_tracked_pose = t_slam_get_tracked_pose; t.base.get_tracked_pose = t_slam_get_tracked_pose;
std::string config_file_string = std::string(config_file ? config_file : "DEFAULT"); slam_config system_config = {};
t.slam = new slam_tracker{config_file_string}; system_config.config_file = config_file ? make_shared<string>(config_file) : nullptr;
system_config.show_ui = config->slam_ui;
t.slam = new slam_tracker{system_config};
if (!config_file) { if (!config_file) {
SLAM_INFO("Using calibration from driver and default pipeline settings"); SLAM_INFO("Using calibration from driver and default pipeline settings");

View file

@ -465,6 +465,7 @@ struct t_slam_tracker_config
{ {
enum u_logging_level log_level; //!< SLAM tracking logging level enum u_logging_level log_level; //!< SLAM tracking logging level
const char *slam_config; //!< Config file path, format is specific to the SLAM implementation in use const char *slam_config; //!< Config file path, format is specific to the SLAM implementation in use
bool slam_ui; //!< Whether to open the external UI of the external SLAM system
bool submit_from_start; //!< Whether to submit data to the SLAM tracker without user action bool submit_from_start; //!< Whether to submit data to the SLAM tracker without user action
enum t_slam_prediction_type prediction; //!< Which level of prediction to use enum t_slam_prediction_type prediction; //!< Which level of prediction to use
bool write_csvs; //!< Whether to enable CSV writers from the start for later analysis bool write_csvs; //!< Whether to enable CSV writers from the start for later analysis