external/vit: Update to 1.0.1 and remove unused cpp helper

This commit is contained in:
Mateo de Mayo 2024-01-24 18:09:21 -03:00 committed by Simon Zeni
parent a10644c873
commit d80a41f34f
2 changed files with 63 additions and 299 deletions

View file

@ -1,216 +0,0 @@
// Copyright 2023, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
* @brief Visual-Intertial Tracking tracker helper.
* @author Jakob Bornecrantz <jakob@collabora.com>
* @author Simon Zeni <simon.zeni@collabora.com>
*/
#pragma once
#include "vit_interface.h"
namespace vit {
typedef vit_result_t Result;
typedef vit_image_format_t ImageFormat;
typedef vit_camera_distortion_t CameraDistortion;
typedef vit_tracker_capability_t TrackerCapability;
typedef vit_tracker_pose_capability_t TrackerPoseCapability;
typedef vit_tracker_timing_titles TrackerTimingTitles;
typedef vit_tracker_t Tracker;
typedef vit_config_t Config;
typedef vit_pose_t Pose;
typedef vit_config_t Config;
typedef vit_imu_sample_t ImuSample;
typedef vit_mask_t Mask;
typedef vit_img_sample_t ImgSample;
typedef vit_pose_data_t PoseData;
typedef vit_pose_timing_t PoseTiming;
typedef vit_pose_feature_t PoseFeature;
typedef vit_pose_features_t PoseFeatures;
typedef vit_camera_calibration_t CameraCalibration;
typedef vit_inertial_calibration_t InertialCalibration;
typedef vit_imu_calibration_t ImuCalibration;
} // namespace vit
extern "C" {
struct vit_tracker
{
virtual ~vit_tracker() = default;
virtual vit_result_t has_image_format(const vit_image_format_t fmt, bool *out_supported) const = 0;
virtual vit_result_t get_capabilities(vit_tracker_capability_t *out_capabilities) const = 0;
virtual vit_result_t get_pose_capabilities(vit_tracker_pose_capability_t *out_capabilities) const = 0;
virtual vit_result_t set_pose_capabilities(const vit_tracker_pose_capability_t capabilities, bool value) = 0;
virtual vit_result_t start() = 0;
virtual vit_result_t stop() = 0;
virtual vit_result_t reset() = 0;
virtual vit_result_t is_running(bool *out_running) const = 0;
virtual vit_result_t add_imu_calibration(const vit_imu_calibration_t *calibration) = 0;
virtual vit_result_t add_camera_calibration(const vit_camera_calibration_t *calibration) = 0;
virtual vit_result_t push_imu_sample(const vit_imu_sample_t *sample) = 0;
virtual vit_result_t push_img_sample(const vit_img_sample_t *sample) = 0;
virtual vit_result_t pop_pose(vit_pose_t **pose) = 0;
virtual vit_result_t get_timing_titles(vit_tracker_timing_titles *out_titles) const = 0;
};
struct vit_pose
{
virtual ~vit_pose() = default;
virtual vit_result_t get_data(vit_pose_data *out_data) const = 0;
virtual vit_result_t get_timing(vit_pose_timing *out_timing) const = 0;
virtual vit_result_t get_features(uint32_t camera_index, vit_pose_features_t *out_features) const = 0;
};
#ifdef VIT_INTERFACE_IMPLEMENTATION
vit_result_t
vit_api_get_version(uint32_t *out_major, uint32_t *out_minor, uint32_t *out_patch)
{
*out_major = VIT_HEADER_VERSION_MAJOR;
*out_minor = VIT_HEADER_VERSION_MINOR;
*out_patch = VIT_HEADER_VERSION_PATCH;
return VIT_SUCCESS;
}
void
vit_tracker_destroy(vit_tracker_t *tracker)
{
vit::Tracker *t = static_cast<vit::Tracker *>(tracker);
delete t;
}
vit_result_t
vit_tracker_has_image_format(const vit_tracker_t *tracker, const vit_image_format_t image_format, bool *out_supported)
{
const vit::Tracker *t = static_cast<const vit::Tracker *>(tracker);
return t->has_image_format(image_format, out_supported);
}
vit_result_t
vit_tracker_get_capabilities(const vit_tracker_t *tracker, vit_tracker_capability_t *out_caps)
{
const vit::Tracker *t = static_cast<const vit::Tracker *>(tracker);
return t->get_capabilities(out_caps);
}
vit_result_t
vit_tracker_get_pose_capabilities(const vit_tracker_t *tracker, vit_tracker_pose_capability_t *out_caps)
{
const vit::Tracker *t = static_cast<const vit::Tracker *>(tracker);
return t->get_pose_capabilities(out_caps);
}
vit_result_t
vit_tracker_set_pose_capabilities(vit_tracker_t *tracker, vit_tracker_pose_capability_t caps, bool value)
{
vit::Tracker *t = static_cast<vit::Tracker *>(tracker);
return t->set_pose_capabilities(caps, value);
}
vit_result_t
vit_tracker_start(vit_tracker_t *tracker)
{
vit::Tracker *t = static_cast<vit::Tracker *>(tracker);
return t->start();
}
vit_result_t
vit_tracker_stop(vit_tracker_t *tracker)
{
vit::Tracker *t = static_cast<vit::Tracker *>(tracker);
return t->stop();
}
vit_result_t
vit_tracker_reset(vit_tracker_t *tracker)
{
vit::Tracker *t = static_cast<vit::Tracker *>(tracker);
return t->reset();
}
vit_result_t
vit_tracker_is_running(const vit_tracker *tracker, bool *out_running)
{
const vit::Tracker *t = static_cast<const vit::Tracker *>(tracker);
return t->is_running(out_running);
}
vit_result_t
vit_tracker_push_imu_sample(vit_tracker *tracker, const vit_imu_sample_t *sample)
{
vit::Tracker *t = static_cast<vit::Tracker *>(tracker);
return t->push_imu_sample(sample);
}
vit_result_t
vit_tracker_push_img_sample(vit_tracker *tracker, const vit_img_sample_t *sample)
{
vit::Tracker *t = static_cast<vit::Tracker *>(tracker);
return t->push_img_sample(sample);
}
vit_result_t
vit_tracker_add_imu_calibration(vit_tracker_t *tracker, const vit_imu_calibration_t *calibration)
{
vit::Tracker *t = static_cast<vit::Tracker *>(tracker);
return t->add_imu_calibration(calibration);
}
vit_result_t
vit_tracker_add_camera_calibration(vit_tracker_t *tracker, const vit_camera_calibration_t *calibration)
{
vit::Tracker *t = static_cast<vit::Tracker *>(tracker);
return t->add_camera_calibration(calibration);
}
vit_result_t
vit_tracker_pop_pose(vit_tracker_t *tracker, vit_pose_t **out_pose)
{
vit::Tracker *t = static_cast<vit::Tracker *>(tracker);
return t->pop_pose(out_pose);
}
vit_result_t
vit_tracker_get_timing_titles(const vit_tracker_t *tracker, vit_tracker_timing_titles *out_titles)
{
const vit::Tracker *t = static_cast<const vit::Tracker *>(tracker);
return t->get_timing_titles(out_titles);
}
void
vit_pose_destroy(vit_pose_t *pose)
{
vit::Pose *p = static_cast<vit::Pose *>(pose);
delete p;
}
vit_result_t
vit_pose_get_data(const vit_pose_t *pose, vit_pose_data_t *out_data)
{
const vit::Pose *p = static_cast<const vit::Pose *>(pose);
return p->get_data(out_data);
}
vit_result_t
vit_pose_get_timing(const vit_pose_t *pose, vit_pose_timing_t *out_timing)
{
const vit::Pose *p = static_cast<const vit::Pose *>(pose);
return p->get_timing(out_timing);
}
vit_result_t
vit_pose_get_features(const vit_pose_t *pose, uint32_t camera_index, vit_pose_features_t *out_features)
{
const vit::Pose *p = static_cast<const vit::Pose *>(pose);
return p->get_features(camera_index, out_features);
}
#endif
}

View file

@ -1,4 +1,4 @@
// Copyright 2023, Collabora, Ltd. // Copyright 2023-2024, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0 // SPDX-License-Identifier: BSL-1.0
/*! /*!
* @file * @file
@ -8,10 +8,10 @@
* @author Jakob Bornecrantz <jakob@collabora.com> * @author Jakob Bornecrantz <jakob@collabora.com>
* *
* This file contains the declaration of the @ref vit_tracker struct. This * This file contains the declaration of the @ref vit_tracker struct. This
* header is intended to appear in both Monado and external SLAM systems. The * header is intended to appear in both consumers (e.g., Monado) and external
* implementation of `vit_interface` is provided by the external system. * visual-inertial tracking (VIT) systems (e.g., Basalt). The implementation of
* Additional data types are declared for the communication between Monado and * `vit_interface` is provided by the external system. Additional data types are
* the system. * declared for the communication between consumers and the system.
*/ */
#pragma once #pragma once
@ -20,22 +20,22 @@
extern "C" { extern "C" {
#endif #endif
#include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
// For implementation: same as IMPLEMENTATION_VERSION_* //! Compatibility with these values should be checked against @ref vit_api_get_version.
// For user: expected IMPLEMENTATION_VERSION_*. Should be checked in runtime.
#define VIT_HEADER_VERSION_MAJOR 1 //!< API Breakages #define VIT_HEADER_VERSION_MAJOR 1 //!< API Breakages
#define VIT_HEADER_VERSION_MINOR 0 //!< Backwards compatible API changes #define VIT_HEADER_VERSION_MINOR 0 //!< Backwards compatible API changes
#define VIT_HEADER_VERSION_PATCH 0 //!< Backw. comp. .h-implemented changes #define VIT_HEADER_VERSION_PATCH 1 //!< Backw. comp. .h-implemented changes
#define VIT_CAMERA_CALIBRATION_DISTORTION_MAX_COUNT 32
/*! /*!
* Result type used by the VIT system * Result type used by the VIT system
* *
* 0 is @ref VIT_SUCCESS, positive values are non fatal results and negative values are errors. * 0 is @ref VIT_SUCCESS, positive values are non fatal results and negative values are errors.
*/ */
typedef enum vit_result typedef enum vit_result {
{
/*! /*!
* Operation suceeded * Operation suceeded
*/ */
@ -70,8 +70,7 @@ typedef enum vit_result
/*! /*!
* Image formats. * Image formats.
*/ */
typedef enum vit_image_format typedef enum vit_image_format {
{
//! 8-bit luminance //! 8-bit luminance
VIT_IMAGE_FORMAT_L8 = 1, VIT_IMAGE_FORMAT_L8 = 1,
//! 16-bit luminance //! 16-bit luminance
@ -83,8 +82,7 @@ typedef enum vit_image_format
/*! /*!
* Camera calibration types. * Camera calibration types.
*/ */
typedef enum vit_camera_distortion typedef enum vit_camera_distortion {
{
//! No distortion (pre-disotorted). //! No distortion (pre-disotorted).
VIT_CAMERA_DISTORTION_NONE, VIT_CAMERA_DISTORTION_NONE,
//! Distortion radial-tangential (OpenCV), 4 parameters. //! Distortion radial-tangential (OpenCV), 4 parameters.
@ -100,8 +98,7 @@ typedef enum vit_camera_distortion
/*! /*!
* Capabilities of the tracker. * Capabilities of the tracker.
*/ */
typedef enum vit_tracker_capability typedef enum vit_tracker_capability {
{
//! Does the tracker support per pose (frame) timing data. //! Does the tracker support per pose (frame) timing data.
VIT_TRACKER_CAPABILITY_CAMERA_CALIBRATION = 1 << 0, VIT_TRACKER_CAPABILITY_CAMERA_CALIBRATION = 1 << 0,
//! Does the tracker support per pose (frame) and per camera features. //! Does the tracker support per pose (frame) and per camera features.
@ -111,8 +108,7 @@ typedef enum vit_tracker_capability
/*! /*!
* Capabilities of the poses that this tracker produces. * Capabilities of the poses that this tracker produces.
*/ */
typedef enum vit_tracker_pose_capability typedef enum vit_tracker_pose_capability {
{
//! Does the tracker support per pose (frame) timing data. //! Does the tracker support per pose (frame) timing data.
VIT_TRACKER_POSE_CAPABILITY_TIMING = 1 << 0, VIT_TRACKER_POSE_CAPABILITY_TIMING = 1 << 0,
//! Does the tracker support per pose (frame) and per camera features. //! Does the tracker support per pose (frame) and per camera features.
@ -134,9 +130,8 @@ typedef struct vit_pose vit_pose_t;
/*! /*!
* @brief Names of the timestamps returned by `vit_pose_get_timings` * @brief Names of the timestamps returned by `vit_pose_get_timings`
*/ */
typedef struct vit_tracker_timing_titles typedef struct vit_tracker_timing_titles {
{ uint32_t count; //! Number of titles
uint32_t count; //! Number of titles
const char **titles; //! Names of the measures timestamps const char **titles; //! Names of the measures timestamps
} vit_tracker_timing_titles; } vit_tracker_timing_titles;
@ -174,8 +169,7 @@ typedef struct vit_imu_sample {
/*! /*!
* Region in image space that this mask covers. * Region in image space that this mask covers.
*/ */
typedef struct vit_mask typedef struct vit_mask {
{
//! In pixels. //! In pixels.
float x, y, w, h; float x, y, w, h;
} vit_mask_t; } vit_mask_t;
@ -253,21 +247,21 @@ typedef struct vit_pose_features {
typedef struct vit_camera_calibration { typedef struct vit_camera_calibration {
uint32_t camera_index; // <! For multi-camera setup. For stereo 0 ~ left, 1 ~ right. uint32_t camera_index; // <! For multi-camera setup. For stereo 0 ~ left, 1 ~ right.
int width, height; //<! Resolution int width, height; //<! Resolution
double frequency; //<! Frames per second double frequency; //<! Frames per second
double fx, fy; //<! Focal point double fx, fy; //<! Focal point
double cx, cy; //<! Principal point double cx, cy; //<! Principal point
enum vit_camera_distortion model; enum vit_camera_distortion model;
uint32_t distortion_count; uint32_t distortion_count;
double distortion[32]; //!< Parameters for the distortion model double distortion[VIT_CAMERA_CALIBRATION_DISTORTION_MAX_COUNT]; //!< Parameters for the distortion model
double transform[16]; //!< Row-major 4x4 camera transform w.r.t. the IMU (i.e., T_imu_cam) double transform[4 * 4]; //!< Row-major 4x4 camera transform w.r.t. the IMU (i.e., T_imu_cam)
} vit_camera_calibration_t; } vit_camera_calibration_t;
typedef struct vit_inertial_calibration { typedef struct vit_inertial_calibration {
// Calibration intrinsics to apply to each raw measurement. // Calibration intrinsics to apply to each raw measurement.
//! Row major 3x3 linear transformation for raw measurements alignment and scaling. //! Row major 3x3 linear transformation for raw measurements alignment and scaling.
double transform[9]; double transform[3 * 3];
//! Offset to add to raw measurements; called bias in other contexts. //! Offset to add to raw measurements; called bias in other contexts.
double offset[3]; double offset[3];
@ -297,7 +291,6 @@ typedef struct vit_imu_calibration {
struct vit_inertial_calibration gyro; struct vit_inertial_calibration gyro;
} vit_imu_calibration_t; } vit_imu_calibration_t;
/* /*
* *
* Function prototypes. * Function prototypes.
@ -307,25 +300,32 @@ typedef struct vit_imu_calibration {
typedef vit_result_t (*PFN_vit_api_get_version)(uint32_t *out_major, uint32_t *out_minor, uint32_t *out_patch); typedef vit_result_t (*PFN_vit_api_get_version)(uint32_t *out_major, uint32_t *out_minor, uint32_t *out_patch);
typedef vit_result_t (*PFN_vit_tracker_create)(const vit_config_t *config, vit_tracker_t **out_tracker); typedef vit_result_t (*PFN_vit_tracker_create)(const vit_config_t *config, vit_tracker_t **out_tracker);
typedef void (*PFN_vit_tracker_destroy)(vit_tracker_t *tracker); typedef void (*PFN_vit_tracker_destroy)(vit_tracker_t *tracker);
typedef vit_result_t (*PFN_vit_tracker_has_image_format)(const vit_tracker_t *tracker, const vit_image_format_t image_format, bool *out_supported); typedef vit_result_t (*PFN_vit_tracker_has_image_format)(const vit_tracker_t *tracker, vit_image_format_t image_format,
typedef vit_result_t (*PFN_vit_tracker_get_capabilities)(const vit_tracker_t *tracker, vit_tracker_capability_t *out_caps); bool *out_supported);
typedef vit_result_t (*PFN_vit_tracker_get_pose_capabilities)(const vit_tracker_t *tracker, vit_tracker_pose_capability_t *out_caps); typedef vit_result_t (*PFN_vit_tracker_get_capabilities)(const vit_tracker_t *tracker,
typedef vit_result_t (*PFN_vit_tracker_set_pose_capabilities)(vit_tracker_t *tracker, const vit_tracker_pose_capability_t caps, bool value); vit_tracker_capability_t *out_caps);
typedef vit_result_t (*PFN_vit_tracker_get_pose_capabilities)(const vit_tracker_t *tracker,
vit_tracker_pose_capability_t *out_caps);
typedef vit_result_t (*PFN_vit_tracker_set_pose_capabilities)(vit_tracker_t *tracker,
vit_tracker_pose_capability_t caps, bool value);
typedef vit_result_t (*PFN_vit_tracker_start)(vit_tracker_t *tracker); typedef vit_result_t (*PFN_vit_tracker_start)(vit_tracker_t *tracker);
typedef vit_result_t (*PFN_vit_tracker_stop)(vit_tracker_t *tracker); typedef vit_result_t (*PFN_vit_tracker_stop)(vit_tracker_t *tracker);
typedef vit_result_t (*PFN_vit_tracker_reset)(vit_tracker_t *tracker); typedef vit_result_t (*PFN_vit_tracker_reset)(vit_tracker_t *tracker);
typedef vit_result_t (*PFN_vit_tracker_is_running)(const vit_tracker_t *tracker, bool *out_bool); typedef vit_result_t (*PFN_vit_tracker_is_running)(const vit_tracker_t *tracker, bool *out_bool);
typedef vit_result_t (*PFN_vit_tracker_push_imu_sample)(vit_tracker_t *tracker, const vit_imu_sample_t *sample); typedef vit_result_t (*PFN_vit_tracker_push_imu_sample)(vit_tracker_t *tracker, const vit_imu_sample_t *sample);
typedef vit_result_t (*PFN_vit_tracker_push_img_sample)(vit_tracker_t *tracker, const vit_img_sample_t *sample); typedef vit_result_t (*PFN_vit_tracker_push_img_sample)(vit_tracker_t *tracker, const vit_img_sample_t *sample);
typedef vit_result_t (*PFN_vit_tracker_add_imu_calibration)(vit_tracker_t *tracker, const vit_imu_calibration_t *calibration); typedef vit_result_t (*PFN_vit_tracker_add_imu_calibration)(vit_tracker_t *tracker,
typedef vit_result_t (*PFN_vit_tracker_add_camera_calibration)(vit_tracker_t *tracker, const vit_camera_calibration_t *calibration); const vit_imu_calibration_t *calibration);
typedef vit_result_t (*PFN_vit_tracker_add_camera_calibration)(vit_tracker_t *tracker,
const vit_camera_calibration_t *calibration);
typedef vit_result_t (*PFN_vit_tracker_pop_pose)(vit_tracker_t *tracker, vit_pose_t **out_pose); typedef vit_result_t (*PFN_vit_tracker_pop_pose)(vit_tracker_t *tracker, vit_pose_t **out_pose);
typedef vit_result_t (*PFN_vit_tracker_get_timing_titles)(const vit_tracker_t *tracker, vit_tracker_timing_titles *out_titles); typedef vit_result_t (*PFN_vit_tracker_get_timing_titles)(const vit_tracker_t *tracker,
vit_tracker_timing_titles *out_titles);
typedef void (*PFN_vit_pose_destroy)(vit_pose_t *pose); typedef void (*PFN_vit_pose_destroy)(vit_pose_t *pose);
typedef vit_result_t (*PFN_vit_pose_get_data)(const vit_pose_t *pose, vit_pose_data_t *out_data); typedef vit_result_t (*PFN_vit_pose_get_data)(const vit_pose_t *pose, vit_pose_data_t *out_data);
typedef vit_result_t (*PFN_vit_pose_get_timing)(const vit_pose_t *pose, vit_pose_timing_t *out_timing); typedef vit_result_t (*PFN_vit_pose_get_timing)(const vit_pose_t *pose, vit_pose_timing_t *out_timing);
typedef vit_result_t (*PFN_vit_pose_get_features)(const vit_pose_t *pose, uint32_t camera_index, vit_pose_features_t *out_features); typedef vit_result_t (*PFN_vit_pose_get_features)(const vit_pose_t *pose, uint32_t camera_index,
vit_pose_features_t *out_features);
/* /*
* *
@ -338,26 +338,23 @@ typedef vit_result_t (*PFN_vit_pose_get_features)(const vit_pose_t *pose, uint32
/*! /*!
* @brief Returns the API version implemented by the VIT system. * @brief Returns the API version implemented by the VIT system.
*/ */
vit_result_t vit_result_t vit_api_get_version(uint32_t *out_major, uint32_t *out_minor, uint32_t *out_patch);
vit_api_get_version(uint32_t *out_major, uint32_t *out_minor, uint32_t *out_patch);
/*! /*!
* @brief Creates a new VIT tracker. The caller is responsible of destroying it when done. * @brief Creates a new VIT tracker. The caller is responsible of destroying it when done.
*/ */
vit_result_t vit_result_t vit_tracker_create(const vit_config_t *config, vit_tracker_t **out_tracker);
vit_tracker_create(const vit_config_t *config, vit_tracker_t **out_tracker);
/*! /*!
* @brief Destroys the VIT tracker and free all resources allocated. * @brief Destroys the VIT tracker and free all resources allocated.
*/ */
void void vit_tracker_destroy(vit_tracker_t *tracker);
vit_tracker_destroy(vit_tracker_t *tracker);
/*! /*!
* @brief Verifies if the tracker supports a given `vit_image_format_t`. * @brief Verifies if the tracker supports a given `vit_image_format_t`.
*/ */
vit_result_t vit_result_t vit_tracker_has_image_format(const vit_tracker_t *tracker, vit_image_format_t image_format,
vit_tracker_has_image_format(const vit_tracker_t *tracker, const vit_image_format_t image_format, bool *out_supported); bool *out_supported);
/*! /*!
* @brief Returns a bitfield of capabilities supported by the tracker. * @brief Returns a bitfield of capabilities supported by the tracker.
@ -365,16 +362,14 @@ vit_tracker_has_image_format(const vit_tracker_t *tracker, const vit_image_forma
* @see vit_tracker_capability_t * @see vit_tracker_capability_t
*/ */
vit_result_t vit_result_t vit_tracker_get_capabilities(const vit_tracker_t *tracker, vit_tracker_capability_t *out_caps);
vit_tracker_get_capabilities(const vit_tracker_t *tracker, vit_tracker_capability_t *out_caps);
/*! /*!
* @brief Returns a bitfield of pose capabilities supported by the tracker. * @brief Returns a bitfield of pose capabilities supported by the tracker.
* *
* @see vit_tracker_pose_capability_t * @see vit_tracker_pose_capability_t
*/ */
vit_result_t vit_result_t vit_tracker_get_pose_capabilities(const vit_tracker_t *tracker, vit_tracker_pose_capability_t *out_caps);
vit_tracker_get_pose_capabilities(const vit_tracker_t *tracker, vit_tracker_pose_capability_t *out_caps);
/*! /*!
* @brief Enables or disables multiple tracker pose capabilities. * @brief Enables or disables multiple tracker pose capabilities.
@ -383,34 +378,29 @@ vit_tracker_get_pose_capabilities(const vit_tracker_t *tracker, vit_tracker_pose
* *
* @see vit_tracker_pose_capability_t * @see vit_tracker_pose_capability_t
*/ */
vit_result_t vit_result_t vit_tracker_set_pose_capabilities(vit_tracker_t *tracker, vit_tracker_pose_capability_t caps, bool value);
vit_tracker_set_pose_capabilities(vit_tracker_t *tracker, const vit_tracker_pose_capability_t caps, bool value);
/*! /*!
* @brief Starts the VIT tracker. Image and IMU samples can be pushed and pose can be retrieved. * @brief Starts the VIT tracker. Image and IMU samples can be pushed and pose can be retrieved.
* *
* This function must be non blocking. The VIT system implementing it is expected to start its own event loop. * This function must be non blocking. The VIT system implementing it is expected to start its own event loop.
*/ */
vit_result_t vit_result_t vit_tracker_start(vit_tracker_t *tracker);
vit_tracker_start(vit_tracker_t *tracker);
/*! /*!
* @brief Stops the VIT tracker. The tracker wont accept image and IMU samples, and will not return poses. * @brief Stops the VIT tracker. The tracker wont accept image and IMU samples, and will not return poses.
*/ */
vit_result_t vit_result_t vit_tracker_stop(vit_tracker_t *tracker);
vit_tracker_stop(vit_tracker_t *tracker);
/*! /*!
* @brief Resets the VIT tracker. The tracker internal state will be set to its original state. * @brief Resets the VIT tracker. The tracker internal state will be set to its original state.
*/ */
vit_result_t vit_result_t vit_tracker_reset(vit_tracker_t *tracker);
vit_tracker_reset(vit_tracker_t *tracker);
/*! /*!
* @brief Verifies if the tracker is running. * @brief Verifies if the tracker is running.
*/ */
vit_result_t vit_result_t vit_tracker_is_running(const vit_tracker_t *tracker, bool *out_bool);
vit_tracker_is_running(const vit_tracker_t *tracker, bool *out_bool);
/*! /*!
* @brief Push an IMU sample into the tracker. * @brief Push an IMU sample into the tracker.
@ -420,8 +410,7 @@ vit_tracker_is_running(const vit_tracker_t *tracker, bool *out_bool);
* The implementation must be non-blocking. * The implementation must be non-blocking.
* Thus, a separate consumer thread should process the samples. * Thus, a separate consumer thread should process the samples.
*/ */
vit_result_t vit_result_t vit_tracker_push_imu_sample(vit_tracker_t *tracker, const vit_imu_sample_t *sample);
vit_tracker_push_imu_sample(vit_tracker_t *tracker, const vit_imu_sample_t *sample);
/*! /*!
* @brief Push an image sample into the tracker. * @brief Push an image sample into the tracker.
@ -430,8 +419,7 @@ vit_tracker_push_imu_sample(vit_tracker_t *tracker, const vit_imu_sample_t *samp
* When using N>1 cameras, the N frames must be pushed following @ref cam_index order. * When using N>1 cameras, the N frames must be pushed following @ref cam_index order.
* The bundle of N frames must have the same timestamps. * The bundle of N frames must have the same timestamps.
*/ */
vit_result_t vit_result_t vit_tracker_push_img_sample(vit_tracker_t *tracker, const vit_img_sample_t *sample);
vit_tracker_push_img_sample(vit_tracker_t *tracker, const vit_img_sample_t *sample);
/*! /*!
* @brief Adds an inertial measurement unit calibration to the tracker. The tracker must not be started. * @brief Adds an inertial measurement unit calibration to the tracker. The tracker must not be started.
@ -441,8 +429,7 @@ vit_tracker_push_img_sample(vit_tracker_t *tracker, const vit_img_sample_t *samp
* @see vit_tracker_get_capabilities * @see vit_tracker_get_capabilities
* @see vit_tracker_capability_t * @see vit_tracker_capability_t
*/ */
vit_result_t vit_result_t vit_tracker_add_imu_calibration(vit_tracker_t *tracker, const vit_imu_calibration_t *calibration);
vit_tracker_add_imu_calibration(vit_tracker_t *tracker, const vit_imu_calibration_t *calibration);
/*! /*!
* @brief Adds a camera calibration to the tracker. The tracker must not be started. * @brief Adds a camera calibration to the tracker. The tracker must not be started.
@ -452,8 +439,7 @@ vit_tracker_add_imu_calibration(vit_tracker_t *tracker, const vit_imu_calibratio
* @see vit_tracker_get_capabilities * @see vit_tracker_get_capabilities
* @see vit_tracker_capability_t * @see vit_tracker_capability_t
*/ */
vit_result_t vit_result_t vit_tracker_add_camera_calibration(vit_tracker_t *tracker, const vit_camera_calibration_t *calibration);
vit_tracker_add_camera_calibration(vit_tracker_t *tracker, const vit_camera_calibration_t *calibration);
/*! /*!
* @brief Get the pose from the front of the tracking queue from the VIT tracker * @brief Get the pose from the front of the tracking queue from the VIT tracker
@ -464,46 +450,40 @@ vit_tracker_add_camera_calibration(vit_tracker_t *tracker, const vit_camera_cali
* *
* @param[out] out_pose Pose returned to the caller, NULL if there is not pose available or on error. * @param[out] out_pose Pose returned to the caller, NULL if there is not pose available or on error.
*/ */
vit_result_t vit_result_t vit_tracker_pop_pose(vit_tracker_t *tracker, vit_pose_t **out_pose);
vit_tracker_pop_pose(vit_tracker_t *tracker, vit_pose_t **out_pose);
/*! /*!
* @brief Get the titles of the timestamps measured by the pose timings. * @brief Get the titles of the timestamps measured by the pose timings.
* *
* Returns `VIT_ERROR_NOT_SUPPORTED` if the tracker doesn't offer the pose timing capability. * Returns `VIT_ERROR_NOT_SUPPORTED` if the tracker doesn't offer the pose timing capability.
*/ */
vit_result_t vit_result_t vit_tracker_get_timing_titles(const vit_tracker_t *tracker, vit_tracker_timing_titles *out_titles);
vit_tracker_get_timing_titles(const vit_tracker_t *tracker, vit_tracker_timing_titles *out_titles);
/*! /*!
* @brief Destroys a pose. All of the data, timing and features associated to it will be invalidated. * @brief Destroys a pose. All of the data, timing and features associated to it will be invalidated.
*/ */
void void vit_pose_destroy(vit_pose_t *pose);
vit_pose_destroy(vit_pose_t *pose);
/*! /*!
* @brief Gets the data form a given `vit_pose_t`. * @brief Gets the data form a given `vit_pose_t`.
* *
* The data becomes invalid when the associated pose gets destroyed. * The data becomes invalid when the associated pose gets destroyed.
*/ */
vit_result_t vit_result_t vit_pose_get_data(const vit_pose_t *pose, vit_pose_data_t *out_data);
vit_pose_get_data(const vit_pose_t *pose, vit_pose_data_t *out_data);
/*! /*!
* @brief Gets the timing form a given `vit_pose_t`. * @brief Gets the timing form a given `vit_pose_t`.
* *
* The timing data becomes invalid when the associated pose gets destroyed. * The timing data becomes invalid when the associated pose gets destroyed.
*/ */
vit_result_t vit_result_t vit_pose_get_timing(const vit_pose_t *pose, vit_pose_timing_t *out_timing);
vit_pose_get_timing(const vit_pose_t *pose, vit_pose_timing_t *out_timing);
/*! /*!
* @brief Gets the features form a given `vit_pose_t`. * @brief Gets the features form a given `vit_pose_t`.
* *
* The features data becomes invalid when the associated pose gets destroyed. * The features data becomes invalid when the associated pose gets destroyed.
*/ */
vit_result_t vit_result_t vit_pose_get_features(const vit_pose_t *pose, uint32_t camera_index, vit_pose_features_t *out_features);
vit_pose_get_features(const vit_pose_t *pose, uint32_t camera_index, vit_pose_features_t *out_features);
#endif #endif