···156156# Most users won't touch these.
157157mark_as_advanced(XRT_FEATURE_COMPOSITOR_MAIN XRT_FEATURE_OPENXR)
158158159159+# ILLIXR
160160+set(ILLIXR_PATH "" CACHE PATH "Path to ILLIXR headers")
161161+159162if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
160163 set(XRT_HAVE_LIBUDEV ON)
161164 set(XRT_HAVE_INTERNAL_HID ON)
···178181cmake_dependent_option(XRT_BUILD_DRIVER_HANDTRACKING "Enable Camera Hand Tracking driver" ON "XRT_HAVE_V4L2" OFF)
179182cmake_dependent_option(XRT_BUILD_DRIVER_DAYDREAM "Enable the Google Daydream View controller driver (BLE, via D-Bus)" ON "XRT_HAVE_DBUS" OFF)
180183cmake_dependent_option(XRT_BUILD_DRIVER_ARDUINO "Enable Arduino input device with BLE via via D-Bus" ON "XRT_HAVE_DBUS" OFF)
184184+cmake_dependent_option(XRT_BUILD_DRIVER_ILLIXR "Enable ILLIXR driver" ON "ILLIXR_PATH" OFF)
181185182186option(XRT_BUILD_DRIVER_DUMMY "Enable dummy driver" ON)
183187cmake_dependent_option(XRT_BUILD_DRIVER_REMOTE "Enable remote debugging driver" ON "XRT_HAVE_LINUX OR ANDROID" OFF)
···195199196200# You can set this from a superproject to add a driver
197201# All drivers must be listed in here to be included in the generated header!
198198-list(APPEND AVAILABLE_DRIVERS "ANDROID" ARDUINO DUMMY HDK HYDRA NS OHMD PSMV PSVR RS V4L2 VIVE DAYDREAM REMOTE SURVIVE HANDTRACKING)
202202+list(APPEND AVAILABLE_DRIVERS "ANDROID" ARDUINO DUMMY HDK HYDRA NS OHMD PSMV PSVR RS V4L2 VIVE DAYDREAM REMOTE SURVIVE HANDTRACKING ILLIXR)
199203200204201205# Package name needs to be known by the native code itself.
···315319message(STATUS "# DRIVER_DUMMY: ${XRT_BUILD_DRIVER_DUMMY}")
316320message(STATUS "# DRIVER_HDK: ${XRT_BUILD_DRIVER_HDK}")
317321message(STATUS "# DRIVER_HYDRA: ${XRT_BUILD_DRIVER_HYDRA}")
322322+message(STATUS "# DRIVER_ILLIXR: ${XRT_BUILD_DRIVER_ILLIXR}")
318323message(STATUS "# DRIVER_NS: ${XRT_BUILD_DRIVER_NS}")
319324message(STATUS "# DRIVER_OHMD: ${XRT_BUILD_DRIVER_OHMD}")
320325message(STATUS "# DRIVER_HANDTRACKING: ${XRT_BUILD_DRIVER_HANDTRACKING}")
+17-1
src/xrt/drivers/CMakeLists.txt
···231231 list(APPEND ENABLED_DRIVERS android)
232232endif()
233233234234+if (XRT_BUILD_DRIVER_ILLIXR)
235235+ set(ILLIXR_SOURCE_FILES
236236+ illixr/illixr_device.cpp
237237+ illixr/illixr_interface.h
238238+ illixr/illixr_prober.c
239239+ illixr/illixr_component.cpp
240240+ illixr/illixr_component.h
241241+ )
242242+243243+ add_library(drv_illixr STATIC ${ILLIXR_SOURCE_FILES})
244244+ target_link_libraries(drv_illixr PUBLIC ${CMAKE_DL_LIBS} xrt-interfaces aux_util aux_os)
245245+ target_include_directories(drv_illixr PUBLIC ${ILLIXR_PATH})
246246+ target_compile_options(drv_illixr PUBLIC $<$<COMPILE_LANGUAGE:CXX>:-std=c++17>)
247247+ list(APPEND ENABLED_HEADSET_DRIVERS illixr)
248248+endif()
249249+234250if(ENABLED_HEADSET_DRIVERS)
235251 set(ENABLED_DRIVERS ${ENABLED_HEADSET_DRIVERS} ${ENABLED_DRIVERS})
236252 list(SORT ENABLED_DRIVERS)
···238254 message(STATUS "Enabled drivers: ${ENABLED_DRIVERS}")
239255else()
240256 message(FATAL_ERROR "You must enable at least one headset driver to build Monado.")
241241-endif()
257257+endif()
+84
src/xrt/drivers/illixr/illixr_component.cpp
···11+// Copyright 2020-2021, The Board of Trustees of the University of Illinois.
22+// SPDX-License-Identifier: BSL-1.0
33+/*!
44+ * @file
55+ * @brief ILLIXR plugin
66+ * @author RSIM Group <illixr@cs.illinois.edu>
77+ * @ingroup drv_illixr
88+ */
99+1010+1111+#include "xrt/xrt_device.h"
1212+1313+#include <iostream>
1414+#include "common/plugin.hpp"
1515+#include "common/phonebook.hpp"
1616+#include "common/switchboard.hpp"
1717+#include "common/data_format.hpp"
1818+#include "common/pose_prediction.hpp"
1919+2020+using namespace ILLIXR;
2121+2222+/// Dummy plugin class for an instance during phonebook registration
2323+class illixr_plugin : public plugin
2424+{
2525+public:
2626+ illixr_plugin(std::string name_, phonebook *pb_)
2727+ : plugin{name_, pb_}, sb{pb->lookup_impl<switchboard>()},
2828+ sb_pose{pb->lookup_impl<pose_prediction>()},
2929+ sb_eyebuffer{sb->publish<rendered_frame>("eyebuffer")},
3030+ sb_vsync_estimate{
3131+ sb->subscribe_latest<time_type>("vsync_estimate")}
3232+ {}
3333+3434+ const std::shared_ptr<switchboard> sb;
3535+ const std::shared_ptr<pose_prediction> sb_pose;
3636+ const std::unique_ptr<writer<rendered_frame>> sb_eyebuffer;
3737+ const std::unique_ptr<reader_latest<time_type>> sb_vsync_estimate;
3838+ fast_pose_type prev_pose; /* stores a copy of pose each time
3939+ illixr_read_pose() is called */
4040+ std::chrono::time_point<std::chrono::system_clock>
4141+ sample_time; /* when prev_pose was stored */
4242+};
4343+4444+static illixr_plugin *illixr_plugin_obj = nullptr;
4545+4646+extern "C" plugin *
4747+illixr_monado_create_plugin(phonebook *pb)
4848+{
4949+ illixr_plugin_obj = new illixr_plugin{"illixr_plugin", pb};
5050+ illixr_plugin_obj->start();
5151+ return illixr_plugin_obj;
5252+}
5353+5454+extern "C" struct xrt_pose
5555+illixr_read_pose()
5656+{
5757+ assert(illixr_plugin_obj &&
5858+ "illixr_plugin_obj must be initialized first.");
5959+6060+ if (!illixr_plugin_obj->sb_pose->fast_pose_reliable()) {
6161+ std::cerr << "Pose not reliable yet; returning best guess"
6262+ << std::endl;
6363+ }
6464+ struct xrt_pose ret;
6565+ const fast_pose_type fast_pose =
6666+ illixr_plugin_obj->sb_pose->get_fast_pose();
6767+ const pose_type pose = fast_pose.pose;
6868+6969+ // record when the pose was read for use in write_frame
7070+ illixr_plugin_obj->sample_time = std::chrono::system_clock::now();
7171+7272+ ret.orientation.x = pose.orientation.x();
7373+ ret.orientation.y = pose.orientation.y();
7474+ ret.orientation.z = pose.orientation.z();
7575+ ret.orientation.w = pose.orientation.w();
7676+ ret.position.x = pose.position.x();
7777+ ret.position.y = pose.position.y();
7878+ ret.position.z = pose.position.z();
7979+8080+ // store pose in static variable for use in write_frame
8181+ illixr_plugin_obj->prev_pose = fast_pose; // copy member variables
8282+8383+ return ret;
8484+}
+23
src/xrt/drivers/illixr/illixr_component.h
···11+// Copyright 2020-2021, The Board of Trustees of the University of Illinois.
22+// SPDX-License-Identifier: BSL-1.0
33+/*!
44+ * @file
55+ * @brief ILLIXR plugin
66+ * @author RSIM Group <illixr@cs.illinois.edu>
77+ * @ingroup drv_illixr
88+ */
99+1010+#pragma once
1111+1212+#ifdef __cplusplus
1313+extern "C" {
1414+#endif
1515+1616+void *
1717+illixr_monado_create_plugin(void *pb);
1818+struct xrt_pose
1919+illixr_read_pose();
2020+2121+#ifdef __cplusplus
2222+}
2323+#endif
···6262#include "android/android_prober.h"
6363#endif
64646565+#ifdef XRT_BUILD_DRIVER_ILLIXR
6666+#include "illixr/illixr_interface.h"
6767+#endif
6868+6569/*!
6670 * Each entry should be a vendor ID (VID), product ID (PID), a "found" function,
6771 * and a string literal name.
···148152149153#ifdef XRT_BUILD_DRIVER_ANDROID
150154 android_create_auto_prober,
155155+#endif
156156+157157+#ifdef XRT_BUILD_DRIVER_ILLIXR
158158+ illixr_create_auto_prober,
151159#endif
152160153161#ifdef XRT_BUILD_DRIVER_DUMMY