Skip to content

Commit

Permalink
Added option to enable the automatic launching of the joypad control …
Browse files Browse the repository at this point in the history
…server
  • Loading branch information
S-Dafarra committed Nov 14, 2024
1 parent c45a68f commit a3ada7d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/devices/openxrheadset/OpenXrHeadset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -1046,6 +1048,11 @@ bool yarp::dev::OpenXrHeadset::startJoypadControlServer()
{
std::lock_guard<std::mutex> lock(m_mutex);

if (!m_launchJoypadControlServer)
{
return true;
}

yarp::os::Property options;
options.put("device", "joypadControlServer");
options.put("name", m_prefix);
Expand Down
1 change: 1 addition & 0 deletions src/devices/openxrheadset/OpenXrHeadset.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ class yarp::dev::OpenXrHeadset : public yarp::dev::DeviceDriver,
std::vector<float> m_axes;
std::vector<Eigen::Vector2f> m_thumbsticks;

bool m_launchJoypadControlServer{ false };
std::unique_ptr<yarp::dev::PolyDriver> m_joypadControlServerPtr;
yarp::dev::IWrapper* m_joypadControlServerWrapper = nullptr;
yarp::dev::PolyDriver m_thisDevice;
Expand Down

0 comments on commit a3ada7d

Please sign in to comment.