Jump to content

getting started with srapinal sdk and obtaining gaze data


Recommended Posts

Hi all,

 

I've just got my hands on the Vive Pro and like to get some gaze data out of it in Unity. I notice that in SRapinal_eye.cs all the functions are boolean. Can somebody tell me how can I get some gaze position data and other gaze features (such as timestamp and pupil position , etc ) in my own c# file?

 

Link to comment
Share on other sites

Here's some sample code to help you get started in Unity.

 

private static EyeData eyeData;private static VerboseData verboseData;private float pupilDiameterLeft, pupilDiameterRight;private Vector2 pupilPositionLeft, pupilPositionRight;private float eyeOpenLeft, eyeOpenRight;void Update(){    SRanipal_Eye.GetEyeData(ref eyeData);    SRanipal_Eye.GetVerboseData(out verboseData);    // pupil diameter    pupilDiameterLeft = eyeData.verbose_data.left.pupil_diameter_mm;    pupilDiameterRight = eyeData.verbose_data.right.pupil_diameter_mm;    // pupil positions    pupilPositionLeft = eyeData.verbose_data.left.pupil_position_in_sensor_area;    pupilPositionRight = eyeData.verbose_data.right.pupil_position_in_sensor_area;    // eye open    eyeOpenLeft = eyeData.verbose_data.left.eye_openness;    eyeOpenRight = eyeData.verbose_data.right.eye_openness;}
Link to comment
Share on other sites

  • 6 months later...

Hi, I'm just wondering whether having the "SRanipal_Eye_Framework" attached to a game object with "Enable Eye" was your issue with this? I have all of that done, and included the above script and still get zero values in my Debug.Log. I'm very new to Unity, sorry if my question is simple.

Thank you in advance.

Link to comment
Share on other sites

On 7/15/2019 at 6:45 PM, Corvus said:

Here's some sample code to help you get started in Unity.

 


private static EyeData eyeData;private static VerboseData verboseData;private float pupilDiameterLeft, pupilDiameterRight;private Vector2 pupilPositionLeft, pupilPositionRight;private float eyeOpenLeft, eyeOpenRight;void Update(){    SRanipal_Eye.GetEyeData(ref eyeData);    SRanipal_Eye.GetVerboseData(out verboseData);    // pupil diameter    pupilDiameterLeft = eyeData.verbose_data.left.pupil_diameter_mm;    pupilDiameterRight = eyeData.verbose_data.right.pupil_diameter_mm;    // pupil positions    pupilPositionLeft = eyeData.verbose_data.left.pupil_position_in_sensor_area;    pupilPositionRight = eyeData.verbose_data.right.pupil_position_in_sensor_area;    // eye open    eyeOpenLeft = eyeData.verbose_data.left.eye_openness;    eyeOpenRight = eyeData.verbose_data.right.eye_openness;}

Why don't you create a subthread to read and send the data so that to have the data with 120 Hz? 

Did you try that (I fail to do that because I don't know how to manage the thread in Unity3d). Thank you if you have any ideas. 

 

Edited by alwyuyang
Link to comment
Share on other sites

On 2/12/2020 at 3:53 AM, Corvus said:

I tried with that code, but I cannot close my application when it should be closed( like crash) . Do you have any updated version which can overcome this problem? Thank you very much. 

 

@Corvus

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...