19 #ifndef YARP_OVRHEADSET_OVRHEADSET_H
20 #define YARP_OVRHEADSET_OVRHEADSET_H
34 #include <OVR_CAPI_GL.h>
41 namespace yarp {
namespace os {
template <
typename T>
class BufferedPort; }}
42 namespace yarp {
namespace os {
class Bottle; }}
106 bool getHatCount(
unsigned int& Hat_count)
override;
109 bool getStickDoF(
unsigned int stick_id,
unsigned int& DoF)
override;
110 bool getButton(
unsigned int button_id,
float& value)
override;
112 bool getHat(
unsigned int hat_id,
unsigned char& value)
override;
113 bool getAxis(
unsigned int axis_id,
double& value)
override;
121 bool createWindow(
int w,
int h);
122 void onKey(
int key,
int scancode,
int action,
int mods);
123 void reconfigureRendering();
124 void reconfigureFOV();
126 static void glfwKeyCallback(GLFWwindow* window,
int key,
int scancode,
int action,
int mods);
127 static void glfwErrorCallback(
int error,
const char* description);
128 static void ovrDebugCallback(uintptr_t userData,
int level,
const char* message);
129 static void DebugHmd(ovrHmdDesc hmdDesc);
130 void errorManager(ovrResult error);
131 void fillAxisStorage();
132 void fillErrorStorage();
133 void fillButtonStorage();
134 void fillHatStorage();
152 std::vector<guiParam> huds;
154 ovrEyeRenderDesc EyeRenderDesc[2];
156 ovrLayerQuad logoLayer;
158 ovrLayerQuad crosshairsLayer;
160 ovrLayerQuad batteryLayer;
161 ovrMirrorTexture mirrorTexture{
nullptr };
162 GLuint mirrorFBO{ 0 };
165 GLFWwindow* window{
nullptr };
167 ovrPoseStatef headpose;
168 ovrPoseStatef predicted_headpose;
169 unsigned int guiCount;
170 bool guiEnabled{
true };
171 std::mutex inputStateMutex;
172 ovrInputState inputState;
173 bool inputStateError{
false };
175 std::vector<ovrButton> buttonIdToOvrButton;
176 std::vector<float*> axisIdToValue;
177 std::map<int, int> DButtonToHat;
178 std::map<ovrResult, std::string> error_messages;
182 std::string left_frame;
183 std::string right_frame;
184 std::string root_frame;
187 bool closed{
false };
188 long long distortionFrameIndex{ 0 };
190 unsigned int texWidth;
191 unsigned int texHeight;
197 bool flipInputEnabled{
false };
198 bool imagePoseEnabled{
true };
199 bool userPoseEnabled{
false };
202 bool logoEnabled{
true };
203 bool crosshairsEnabled{
true };
204 bool batteryEnabled{
true };
Interface implemented by all device drivers.
JoypadCtrl_coordinateMode
Common interface for devices that act like services (by which we mean they do something for remote us...
Device that manages the Oculus Rift Headset.
bool getStickDoF(unsigned int stick_id, unsigned int &DoF) override
Get the Degree Of Freedom count for desired stick.
virtual void threadRelease()
Release method.
virtual bool startService()
Initiate the service, whatever it is.
virtual bool close()
Close the DeviceDriver.
bool getButtonCount(unsigned int &button_count) override
Get number of Buttons.
bool getHat(unsigned int hat_id, unsigned char &value) override
Get the value of an Hat.
virtual bool stopService()
Shut down the service, whatever it is.
bool getHatCount(unsigned int &Hat_count) override
Get number of Hats.
bool getButton(unsigned int button_id, float &value) override
Get the value of a button.
bool getStick(unsigned int stick_id, yarp::sig::Vector &value, JoypadCtrl_coordinateMode coordinate_mode) override
Get the value of a stick if present, return false otherwise.
bool getTouchSurfaceCount(unsigned int &touch_count) override
get the number of touch surface.
bool getTrackballCount(unsigned int &Trackball_count) override
Get number of trackballs.
virtual bool threadInit()
Initialization method.
virtual bool open(yarp::os::Searchable &cfg)
Open the DeviceDriver.
bool getStickCount(unsigned int &stick_count) override
get the number of the sticks
bool getTouch(unsigned int touch_id, yarp::sig::Vector &value) override
Get the value of a touch if present, return false otherwise.
virtual bool updateService()
Give the service the chance to run for a while.
bool getAxis(unsigned int axis_id, double &value) override
Get the value of an axis if present, return false otherwise.
virtual void run()
Loop function.
bool getTrackball(unsigned int trackball_id, yarp::sig::Vector &value) override
Get the axes change of a Trackball.
bool getAxisCount(unsigned int &axis_count) override
Get number of Axes.
A container for a device driver.
An abstraction for a periodic thread.
A base class for nested structures that can be searched.
The main, catch-all namespace for YARP.