0 votes
by (370 points)

Hi there,

I am looking for a way to store eye tracking data obtained from the Pico Neo 3 Eye HMD into a .csv file. I have made the file and I am able to store other variables there successfully. However I cannot find a way to access the eye tracking data using the Pico Unity XR SDK (v2.0.4). Can somebody provide a minimum workable example on how to get simple eye tracking variables using C#(e.g., PXREyeTracking.GetCombineEyeGazePoint, PXREyeTracking.GetCombineEyeGazeVector)???

1 Answer

0 votes
by (2.8k points)

You can find the eye tracking section in the documentation
https://developer.pico-interactive.com/document/doc
enter image description here

by (370 points)
edited by

I have gone through the documentation and I have written the below code to get the gaze vector and display it on a text on the screen. But it doesn't work, it throws an error:

PXRLog Failed at GetEyeTrackingDevice devices.Count

The code I have written is:

using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Unity.XR.PXR;

public class EyeRecord : MonoBehaviour
{

    public Text textElement;
    public static List<Vector3> eyeGazeDirectionList = new List<Vector3>();
    // Start is called before the first frame update
    void Start()
    {
        if (PXR_Manager.Instance.eyeTracking)
        {
            Debug.Log("Eye tracking instance found");
        }
        else
        {
            Debug.Log("Eye tracking instance not found");
        }
    }

    // Update is called once per frame
    void Update()
    {
        PXR_EyeTracking.GetCombineEyeGazeVector(out Vector3 eyeGazeDirection);
        eyeGazeDirectionList.Add(eyeGazeDirection);
        textElement.text = eyeGazeDirection.ToString("F1");

    }
}

I have added the PXR_Manager to the XRrig and enabled the eye-tracking component as shown below:
enter image description here

Unity v. 2019.4.38f1
PICO XR SDK 2.0.4
PUI v4.6.3

by (2.8k points)

I got the data in the following way, you can try using an empty project with the sdk to see if you can get the data.

void Update()
{
    PXR_EyeTracking.GetCombineEyeGazeVector(out Vector3 eyeGazeDirection);
    //eyeGazeDirectionList.Add(eyeGazeDirection);
    //textElement.text = eyeGazeDirection.ToString("F1");
    if (eyeGazeDirection != null)
    {
        Debug.Log("eyeGazeDirection isn't null");
        Debug.Log(eyeGazeDirection.ToString());
    }
    else
    {
        Debug.Log("eyeGazeDirection is null");
    }
}

enter image description here

by (370 points)

Thanks. I fixed it yesterday. However, I have 2 questions:

  1. I also tried to get the values for the GetCombineEyeGazePoint
    but I couldn't. I was getting (0,0,0) all the time.

  2. Your EyeGazeVector values look a bit weird. Mine go from
    -1 to 1. Why is that difference?

Thanks, again.

...