Skip to main content
Up and Coming
August 15, 2014

Porting to new SDK

Hi there, I'm having trouble porting to the new SDK

I have this

extern "C"
{
#include "../include/ovr_freepie.h"
}
#include <OVR.h>

using namespace OVR;

ovrHmd HMD;

int ovr_freepie_init(float dt)
{
ovr_Initialize();
HMD = ovrHmd_Create(0);
if (!HMD) return 1;

ovrHmd_SetEnabledCaps(HMD, ovrHmdCap_DynamicPrediction);

ovrHmd_ConfigureTracking(HMD, ovrTrackingCap_Orientation |
ovrTrackingCap_MagYawCorrection |
ovrTrackingCap_Position, 0);

return 0;
}

int ovr_freepie_reset_orientation()
{
ovrHmd_RecenterPose(HMD);
return 0;
}

int ovr_freepie_read(ovr_freepie_3dof *output)
{
ovrTrackingState ts = ovrHmd_GetTrackingState(HMD, ovr_GetTimeInSeconds());

Posef pose = ts.HeadPose.ThePose;

pose.Rotation.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(&output->yaw, &output->pitch, &output->roll);

return 0;
}

int ovr_freepie_destroy()
{
ovrHmd_Destroy(HMD);
ovr_Shutdown();

return 0;
}


It takes several seconds until init returns and then I get a null HMD, so I guess something in the library is timing out?
I got the DK1

I'm getting this in debug

Debug: Performance timer Vista flag = 1
Debug: [NetClient] OnConnectionAttemptFailed
Debug: [NetClient] OnConnectionAttemptFailed
Debug: [NetClient] OnConnectionAttemptFailed

    22 replies

    Up and Coming
    August 18, 2014
    Thanks for feedback, will look at it when I get home from work, thanks
    Up and Coming
    August 18, 2014
    This is very strange, it all of the sudden started working, I added the ovrHmd_Detect() function, which return 0 by the way. And now it works :D

    Does it work for you DK2 guys?
    Up and Coming
    August 18, 2014
    Yeah, it seems to work.

    The ovrHmd_Detect() call should return the number of detected devices though, so it should normally return 1.
    Kaetemi | Ryzom Core MMORPG Engine
    Up and Coming
    August 18, 2014
    Yeah, its very strange that it returns zero and works :D

    I also added Transaltion to the output doing

    	output->x = pose.Translation.x;
    output->y = pose.Translation.y;
    output->z = pose.Translation.z;


    And that also gives some kind of output from the IMU sensors? Whats going on their? Shouldnt it return zero on a DK1? :D
    Up and Coming
    August 18, 2014
    Does translation work in this version?
    Up and Coming
    August 18, 2014
    Here is a fresh build of FreePIE
    Up and Coming
    August 19, 2014
    I would love to know if translation works for you DK2 guys, so that I can mark this feature as resolved in FreePIE, thansk guys
    Participant
    August 19, 2014
    Hmm... according to the output of my slightly modified RiftMouse.py script:
    def update():
    yaw = math.degrees(oculusVR.yaw)
    pitch = math.degrees(oculusVR.pitch)

    deltaYaw = filters.delta(yaw)
    deltaPitch = filters.delta(pitch)

    if (enabled):
    mouse.deltaX = -deltaYaw*multiply
    mouse.deltaY = -deltaPitch*multiply

    if starting:
    enabled = True
    multiply = 17
    #oculusVR.center()
    oculusVR.update += update

    recenter = keyboard.getPressed(Key.PageDown)
    toggle = keyboard.getPressed(Key.PageUp)

    if toggle:
    enabled = not enabled

    if recenter:
    oculusVR.center()

    diagnostics.watch(oculusVR.yaw)
    diagnostics.watch(oculusVR.pitch)
    diagnostics.watch(oculusVR.roll)
    diagnostics.watch(oculusVR.x)
    diagnostics.watch(oculusVR.y)
    diagnostics.watch(oculusVR.z)


    .....


    IT WORKS!
    At least my Watch output sees the values for x,y and z changing according to translation of my rift.
    I havent even taken the time to adapt mouse positioning or something else before i posted this ;-)
    Just start the script, Page up lets you toggle mouse control, Page down recenters.

    cu,
    Neo
    Up and Coming
    August 19, 2014
    Nice! Thanks for testing!
    August 20, 2014
    Fantastic work! I can confirm that this works also. Virtual Desktop + FreePie + GTA IV (Windowed Mode) + ENB Mods = awesomeness.