mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-28 02:26:16 +00:00
build: Use pkg-config for finding SLAM systems in CMake and other minor improvements
This commit is contained in:
parent
ea43e197a3
commit
7f247604e3
|
@ -134,7 +134,9 @@ endif()
|
|||
# Find a external SLAM implementation
|
||||
set(EXTERNAL_SLAM_SYSTEMS kimera_vio)
|
||||
foreach(slam_system IN LISTS EXTERNAL_SLAM_SYSTEMS)
|
||||
find_package(${slam_system} CONFIG)
|
||||
if(PKGCONFIG_FOUND)
|
||||
pkg_check_modules(${slam_system} ${slam_system})
|
||||
endif()
|
||||
if(${slam_system}_FOUND)
|
||||
set(SLAM ON)
|
||||
set(SLAM_NAME ${slam_system})
|
||||
|
@ -209,8 +211,8 @@ cmake_dependent_option(XRT_HAVE_SDL2 "Enable use of SDL2" ON "SDL2_FOUND AND XRT
|
|||
cmake_dependent_option(XRT_HAVE_SYSTEM_CJSON "Enable cJSON from system, instead of bundled source" ON "CJSON_FOUND" OFF)
|
||||
cmake_dependent_option(XRT_HAVE_GST "Enable gstreamer" ON "GST_FOUND" OFF)
|
||||
cmake_dependent_option(XRT_HAVE_ONNXRUNTIME "Enable ONNX runtime support" ON "ONNXRUNTIME_FOUND" OFF)
|
||||
cmake_dependent_option(XRT_HAVE_SLAM "Enable SLAM tracking support" ON "SLAM;XRT_HAVE_OPENCV" OFF)
|
||||
cmake_dependent_option(XRT_HAVE_KIMERA_SLAM "Enable Kimera support" ON "kimera_vio_FOUND" OFF)
|
||||
cmake_dependent_option(XRT_HAVE_SLAM "Enable SLAM tracking support" ON "SLAM;XRT_HAVE_OPENCV" OFF)
|
||||
cmake_dependent_option(XRT_BUILD_DRIVER_PSVR "Enable PSVR HMD driver" ON "HIDAPI_FOUND" OFF)
|
||||
cmake_dependent_option(XRT_BUILD_DRIVER_RS "Enable RealSense device driver" ON "realsense2_FOUND" OFF)
|
||||
cmake_dependent_option(XRT_BUILD_DRIVER_VIVE "Enable driver for HTC Vive, Vive Pro, Valve Index, and their controllers" ON "ZLIB_FOUND AND XRT_HAVE_LINUX" OFF)
|
||||
|
|
|
@ -131,8 +131,10 @@ euroc_device_get_tracked_pose(struct xrt_device *xdev,
|
|||
int pose_bits = XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT | XRT_SPACE_RELATION_POSITION_TRACKED_BIT;
|
||||
bool pose_tracked = out_relation->relation_flags & pose_bits;
|
||||
if (pose_tracked) {
|
||||
#ifdef XRT_HAVE_KIMERA_SLAM
|
||||
#if defined(XRT_HAVE_KIMERA_SLAM)
|
||||
ed->pose = euroc_device_correct_pose_from_kimera(out_relation->pose);
|
||||
#else
|
||||
ed->pose = out_relation->pose;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -209,9 +209,10 @@ rs_hdev_correct_pose_from_kimera(struct xrt_pose pose)
|
|||
swapped.orientation.w = pose.orientation.w;
|
||||
|
||||
// Correct orientation
|
||||
//! @todo Encode this transformation into constants
|
||||
struct xrt_space_relation out_relation;
|
||||
struct xrt_space_graph space_graph = {0};
|
||||
struct xrt_pose pre_correction = (struct xrt_pose){{-0.5, -0.5, -0.5, 0.5}, {0, 0, 0}}; // euler(90, 90, 0)
|
||||
struct xrt_pose pre_correction = {{-0.5, -0.5, -0.5, 0.5}, {0, 0, 0}}; // euler(90, 90, 0)
|
||||
float sin45 = 0.7071067811865475;
|
||||
struct xrt_pose pos_correction = {{sin45, 0, sin45, 0}, {0, 0, 0}}; // euler(180, 90, 0)
|
||||
m_space_graph_add_pose(&space_graph, &pre_correction);
|
||||
|
@ -237,8 +238,10 @@ rs_hdev_get_tracked_pose(struct xrt_device *xdev,
|
|||
bool pose_tracked = out_relation->relation_flags & pose_bits;
|
||||
|
||||
if (pose_tracked) {
|
||||
#ifdef XRT_HAVE_KIMERA_SLAM
|
||||
#if defined(XRT_HAVE_KIMERA_SLAM)
|
||||
rs->pose = rs_hdev_correct_pose_from_kimera(out_relation->pose);
|
||||
#else
|
||||
rs->pose = out_relation->pose;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -106,9 +106,7 @@ endif
|
|||
|
||||
if slam.found() and build_tracking
|
||||
have_conf.set('XRT_HAVE_SLAM', true)
|
||||
if slam.name() == 'kimera_vio'
|
||||
have_conf.set('XRT_HAVE_KIMERA_SLAM', true)
|
||||
endif
|
||||
have_conf.set('XRT_HAVE_KIMERA_SLAM', slam.name() == 'kimera_vio')
|
||||
endif
|
||||
|
||||
if build_wayland
|
||||
|
|
Loading…
Reference in a new issue