st/prober: Handle SLAM tracker creation failure for the Euroc player

This also adds a do-nothing section to `p_factory_create_tracked_slam`
that could be replicated by new SLAM frame servers.
This commit is contained in:
Mateo de Mayo 2021-09-28 16:01:23 -03:00
parent f88befbdbc
commit e561d312f6

View file

@ -344,6 +344,16 @@ p_factory_create_tracked_slam(struct xrt_tracking_factory *xfact,
struct xrt_tracked_slam *xts = NULL;
#ifdef XRT_BUILD_DRIVER_EUROC
if (debug_get_option_euroc_path() != NULL) {
// The euroc slam tracker was already created on p_tracking_init because the
// euroc player is not a device so it needs to be started from somewhere
goto end;
}
#endif
end:
if (!fact->started_xts) {
xts = fact->xts;
}
@ -394,17 +404,19 @@ p_tracking_init(struct prober *p)
#ifdef XRT_BUILD_DRIVER_EUROC
if (debug_get_option_euroc_path() != NULL) {
struct xrt_slam_sinks *sinks = NULL;
struct xrt_slam_sinks empty_sinks = {0};
struct xrt_slam_sinks *sinks = &empty_sinks;
// fact->xfs *will* be an euroc frame server after open, because of prober open_video_device
xrt_prober_open_video_device(&fact->p->base, NULL, &fact->xfctx, &fact->xfs);
#ifdef XRT_HAVE_SLAM
t_slam_create(&fact->xfctx, &fact->xts, &sinks);
int ret = t_slam_create(&fact->xfctx, &fact->xts, &sinks);
if (ret != 0) {
U_LOG_W("Unable to initialize SLAM tracking, the Euroc driver will not be tracked");
}
#else
U_LOG_W("SLAM tracking support is disabled, the Euroc driver will not be tracked");
struct xrt_slam_sinks empty_sinks = {0};
sinks = &empty_sinks;
#endif
xrt_fs_slam_stream_start(fact->xfs, sinks);