From a3ada7d0de621ae8aa9d1bd72a066141b2a05b0d Mon Sep 17 00:00:00 2001 From: Stefano Date: Thu, 14 Nov 2024 17:40:44 +0100 Subject: [PATCH] Added option to enable the automatic launching of the joypad control server --- src/devices/openxrheadset/OpenXrHeadset.cpp | 7 +++++++ src/devices/openxrheadset/OpenXrHeadset.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/devices/openxrheadset/OpenXrHeadset.cpp b/src/devices/openxrheadset/OpenXrHeadset.cpp index bfe0fbc..cf84972 100644 --- a/src/devices/openxrheadset/OpenXrHeadset.cpp +++ b/src/devices/openxrheadset/OpenXrHeadset.cpp @@ -251,6 +251,8 @@ bool yarp::dev::OpenXrHeadset::open(yarp::os::Searchable &cfg) double period = cfg.check("vr_period", yarp::os::Value(0.011)).asFloat64(); this->setPeriod(period); + m_launchJoypadControlServer = cfg.check("launch_joypad_control_server") && (cfg.find("launch_joypad_control_server").isNull() || cfg.find("launch_joypad_control_server").asBool()); + m_useNativeQuadLayers = cfg.check("use_native_quad_layers") && (cfg.find("use_native_quad_layers").isNull() || cfg.find("use_native_quad_layers").asBool()); m_openXrInterfaceSettings.posesPredictionInMs = cfg.check("vr_poses_prediction_in_ms", yarp::os::Value(0.0)).asFloat64(); @@ -1046,6 +1048,11 @@ bool yarp::dev::OpenXrHeadset::startJoypadControlServer() { std::lock_guard lock(m_mutex); + if (!m_launchJoypadControlServer) + { + return true; + } + yarp::os::Property options; options.put("device", "joypadControlServer"); options.put("name", m_prefix); diff --git a/src/devices/openxrheadset/OpenXrHeadset.h b/src/devices/openxrheadset/OpenXrHeadset.h index 1203e78..7d19dc7 100644 --- a/src/devices/openxrheadset/OpenXrHeadset.h +++ b/src/devices/openxrheadset/OpenXrHeadset.h @@ -343,6 +343,7 @@ class yarp::dev::OpenXrHeadset : public yarp::dev::DeviceDriver, std::vector m_axes; std::vector m_thumbsticks; + bool m_launchJoypadControlServer{ false }; std::unique_ptr m_joypadControlServerPtr; yarp::dev::IWrapper* m_joypadControlServerWrapper = nullptr; yarp::dev::PolyDriver m_thisDevice;