external: Add semver to slam_tracker (1.0.0) and pose timestamps

This commit is contained in:
Mateo de Mayo 2021-12-14 11:35:01 -03:00 committed by Jakob Bornecrantz
parent 88a3848b5a
commit 090e465dda
2 changed files with 36 additions and 4 deletions
src
external/slam_tracker
xrt/auxiliary/tracking

View file

@ -25,15 +25,31 @@
namespace xrt::auxiliary::tracking::slam {
// For implementation: same as IMPLEMENTATION_VERSION_*
// For user: expected IMPLEMENTATION_VERSION_*. Should be checked in runtime.
constexpr int HEADER_VERSION_MAJOR = 1; //!< API Breakages
constexpr int HEADER_VERSION_MINOR = 0; //!< Backwards compatible API changes
constexpr int HEADER_VERSION_PATCH = 0; //!< Backw. comp. .h-implemented changes
// Which header version the external system is implementing.
extern const int IMPLEMENTATION_VERSION_MAJOR;
extern const int IMPLEMENTATION_VERSION_MINOR;
extern const int IMPLEMENTATION_VERSION_PATCH;
/*!
* @brief Standard pose type to communicate Monado with the external SLAM system
*/
struct pose {
float px, py, pz;
float rx, ry, rz, rw;
std::int64_t timestamp; //!< In same clock as input samples
float px, py, pz; //!< Position vector
float rx, ry, rz, rw = 1; //!< Orientation quaternion
pose() = default;
pose(float px, float py, float pz, float rx, float ry, float rz, float rw)
: px(px), py(py), pz(pz), rx(rx), ry(ry), rz(rz), rw(rw) {}
pose(std::int64_t timestamp, //
float px, float py, float pz, //
float rx, float ry, float rz, float rw)
: timestamp(timestamp), //
px(px), py(py), pz(pz), //
rx(rx), ry(ry), rz(rz), rw(rw) {}
};
/*!

View file

@ -334,6 +334,22 @@ extern "C" int
t_slam_create(struct xrt_frame_context *xfctx, struct xrt_tracked_slam **out_xts, struct xrt_slam_sinks **out_sink)
{
enum u_logging_level log_level = debug_get_log_option_slam_log();
// Check that the external SLAM system built is compatible
int ima = IMPLEMENTATION_VERSION_MAJOR;
int imi = IMPLEMENTATION_VERSION_MINOR;
int ipa = IMPLEMENTATION_VERSION_PATCH;
int hma = HEADER_VERSION_MAJOR;
int hmi = HEADER_VERSION_MINOR;
int hpa = HEADER_VERSION_PATCH;
U_LOG_IFL_I(log_level, "External SLAM system built %d.%d.%d, expected %d.%d.%d.", ima, imi, ipa, hma, hmi, hpa);
if (IMPLEMENTATION_VERSION_MAJOR != HEADER_VERSION_MAJOR) {
U_LOG_IFL_E(log_level, "Incompatible external SLAM system found.");
return -1;
}
U_LOG_IFL_I(log_level, "Initializing compatible external SLAM system.");
// Check the user has provided a SLAM_CONFIG file
const char *config_file = debug_get_option_slam_config();
if (!config_file) {
U_LOG_IFL_W(log_level,