Forum Discussion
amigob
10 years agoHonored Guest
SDK Version 0.2.3: only head tracking
Hi All
I am not that good with C++, and run in to problems with that
I took the head tracking part, from the SDK 0.2.3 World demo and stripped until I had the head tracker to
create the pitch/roll/yaw. But the application was still in C++.
Now I moved the part that was left in to a main() application and can't get it to work any more.
I am getting segmentation fault after number 2.
Can some one help me getting this simple head tracking application to work. Without putting it in a C++ application environment, because it needs to be added to an existing application.
I am not that good with C++, and run in to problems with that
I took the head tracking part, from the SDK 0.2.3 World demo and stripped until I had the head tracker to
create the pitch/roll/yaw. But the application was still in C++.
Now I moved the part that was left in to a main() application and can't get it to work any more.
I am getting segmentation fault after number 2.
Can some one help me getting this simple head tracking application to work. Without putting it in a C++ application environment, because it needs to be added to an existing application.
#include <unistd.h>
#include "OVR.h"
using namespace OVR;
int main(void)
{
Quatf hmdOrient;
float yaw = 0.0f;
float Pitch = 0.0f;
float Roll = 0.0f;
Ptr<DeviceManager> pManager;
Ptr<SensorDevice> pSensor;
MessageHandler handler;
SensorFusion SFusion;
// *** Oculus HMD & Sensor Initialization
// Create DeviceManager and first available HMDDevice from it.
// Sensor object is created from the HMD, to ensure that it is on the
// correct device.
printf("test1\n");
pManager = *DeviceManager::Create();
printf("test2\n");
// We'll handle it's messages in this case.
pManager->SetMessageHandler(&handler);
printf("test3\n");
// If we didn't detect an HMD, try to create the sensor directly.
// This is useful for debugging sensor interaction; it is not needed in
// a shipping app.
pSensor = *pManager->EnumerateDevices<SensorDevice>().CreateDevice();
printf("test4\n");
if(pSensor)
{
// We need to attach sensor to SensorFusion object for it to receive
// body frame messages and update orientation. SFusion.GetOrientation()
// is used in OnIdle() to orient the view.
SFusion.AttachToSensor(pSensor);
SFusion.SetDelegateMessageHandler(&handler);
SFusion.SetPredictionEnabled(true);
}
for ( int i = 0 ; i < 1000; i++)
{
hmdOrient = SFusion.GetPredictedOrientation();
hmdOrient.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(&yaw, &Pitch, &Roll);
printf("test %2.10f \n", Pitch);
usleep(100000);
}
pSensor.Clear();
return 0;
}
1 Reply
- amigobHonored Guestmhh
pManager = *DeviceManager::Create();
this already returns a NULL pointer.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 2 years ago
- 4 years ago