Jump to content

how to get head position / rocation / timestamps of log data of headtracking and eyetracking ?


dilab

Recommended Posts

I am a newbie of everything (unity, vive stuffs ) and i Really need your help . 

What i want is to get the log data of eyetracking data( origin , direction ) , head data (position , rotation ) from focus 3 and the timestamp when that data changes.  I want those data to print it to the console window and also save it as a csv. 

 

I used  wave unity sdk  5.6.0 , focus 3, essence package , unity editor 21.3.9 

What I have accomplished so far is to create an eyemanager to get the origin and direction of the eyetracker. 


1. now I want to get the tracker manager to get the head position and head rotation, but I don't see the 'use xr device' in the tracker manager.  Please let me know what is wrong. 

2. how to get the timestamp of eyetracking data and head track data?

3. if there is a way to log these data and save them as a csv, please let me know. Currently direct preview doesn't work due to the internet problem . intoduce other way . 

4. if it is possible to change the output frequency of the eyetracker of focus 3, please let me know how to do that. 

 

캡처.PNG

Edited by dilab
type error
Link to comment
Share on other sites

Hi @dilab

1. Tracker manager is the one provided by Wave SDK? If yes, then it is only for tracker not HMD.

Alternative method, you can get pos/rot from Camera.main.gameObject.transform instead.

2. For timestamp, you can get from DateTime.Now

3. To save your data as csv, you can collect your data then output as string and save as csv file type.

Your data needs to separate by comma(,) for each column.

For example, time stamp, eye origin, eye direction, head pos, head rot

image.png.689610a89382300f9f8ea696a579fcac.png

Hint: You can simply open a csv file by TextEditor and you can see actually the data is just text with , to separate them

4. I will need to check internally, get back to you later

UPDATE: There is no way to change the output frequency.

Current frequency is >90Hz, if you want to lower it, then you can do it manually.

Link to comment
Share on other sites

I'm having a hard time conveying what I want because there are a lot of omissions in my message, so I'm going to ask again. 

1. is there a way to get the head postion/ rotation through the sdk besides getting it as a camera object?
2. currently i am building with unity as apk file, installing it and playing inside hmd, so i can get data related to head, and eye only inside apk file.  What I want is to get the head and eye data out of the apk file and save it as a csv.  The method I tried was to install Direct Preview and Business streaming app that can play together on unity and hmd without build and play through both apps, but currently my desktop is not connected to the LAN line, so I can't get the data because the connection is unstable (this is just my guess).  Besides this method, is it possible to get the DATA value from the APK file already built and save it in CSV form?  
3.could you please explain in detail how to change the output frequency of focus3 eyetracker to be mannually? 
4. last question... I wrote the update function (i.e., requesting data with code in apk) to get eye and head data, but could you please tell me the C# code to write the code with callback (i.e., receiving data sent by device from app). I want to receive the data itself, which changes according to the output frequency of the device. Currently, I have created an eyemanger in wave unity sdk 5.6.0 to receive the eyetracking data. Please keep that in mind.

 

I posted a direct preview error video when playing both on focus 3 and unity editor and C# code I made for tracking . ( I used update fuction in this script ) 
 

EyeWaveSystem.cs

Link to comment
Share on other sites

Hi @dilab,

1. I am not sure if you place WaveRig in your scene?

If yes, then you can get it by using WaveRig.Instance.transform.

But, it should be the same as getting it from Camera.main.

2. I might need to check internally whether DirectPreview supports eyetracking.

Like I said before if you would like to output your data, just save them as string then output as csv.

UPDATE:

image.png.d8a54ec4b7bfb827a4ba35bfcbb907c4.png

3. For frequency, you can simply collect your data in Update function but in specific time.

For example, if you would like to get 60Hz, it will be 0.0167s.

So you can calculate the delta time greater than 0.0167s then collect your data.

OR

You can collect data by frame count, like collect once per 10 frames.

To get frame count by Time.frameCount.

4. I am not quite sure about using callback to collect eyetracking data.

According to Wave SDK's EyeManager.cs, it is also calling in Update function.

I will get back to you when I have any updates.

UPDATE: No callback.

 

By looking at the script you provided, so you should be collecting your data when it hits the object?

Link to comment
Share on other sites

thank you soooo much   for your kind reply .  It made a lot easier 🙂 

most of it was solved except for saving string file for csv 

from what I saw in docs , in order to save s/th from prebuilt apk file to certain path ,    you need to create Androidmanifest.xml and modify it to request file system access internally and externally.  unfortunately , if i create Androidmanifest.xml by going into project setting > wave XR > XRSDK > custom AndroidManifest , I can not see my app in library of focus 3.  I can see my app in library only when I deleted AndroidManifest.xml file before building.  So far,  I've been checking data by looking at the textmeshpro after building .  ( building my app in the Unity Editor, moving that APK file to my Focus 3 download folder, installing it, and clicking My Apps in the library to play. )  
So my question is, how can I save sting file gotten from prebuilt apk file ?  I don't know where / how to save . 
 

Link to comment
Share on other sites

 thank you soooo much   for your kind reply .  It made a lot easier 🙂 

most of it was solved except for saving string file for csv 

from what I saw in docs , in order to save s/th from prebuilt apk file to certain path ,    you need to create Androidmanifest.xml and modify it to request file system access internally and externally.  unfortunately , if i create Androidmanifest.xml by going into project setting > wave XR > XRSDK > custom AndroidManifest , I can not see my app in library of focus 3.  I can see my app in library only when I deleted AndroidManifest.xml file before building.  So far,  I've been checking data by looking at the textmeshpro after building .  ( building my app in the Unity Editor, moving that APK file to my Focus 3 download folder, installing it, and clicking My Apps in the library to play. )  
So my question is, how can I save sting file gotten from prebuilt apk file ?  I don't know where / how to save . 
EyeWaveSystem.csEyeWaveSystem.cs

I will post  C# script I wrote. 

Thank u again for your replay and look forward to new one. 🙂

EyeWaveSystem.cs

Edited by dilab
Link to comment
Share on other sites

Hi @dilab,

You can reference to this script, StoragePermissionManager.cs.

https://github.com/icosa-foundation/open-brush/blob/platform/wave/Assets/Scripts/StoragePermissionManager.cs

Please note that after you added correctly, you open your app, it will request for permission.

If don't see this, then there is problem.

For AndroidManifest.xml, please place the file attached to Assets\Plugins\Android folder.

Let me know if you have further questions.

AndroidManifest.xml

Link to comment
Share on other sites

  • 2 months later...

Hello. 
I am struggling with csv output in vive elite as well.
Can I get csv output if I install the apk in internal storage for vive elite as well?
I would like to know. Thank you in advance.

Link to comment
Share on other sites

 

Thank you for your reply.
Unfortunately, the problem has not been resolved.
I have created a project according to the link below and attached the attached script to the game object.
At the same time,
https://github.com/icosa-foundation/open-brush/blob/platform/wave/Assets/Scripts/StoragePermissionManager.cs
is also attached.

I placed AndoroidManifest.xml in Asset/Plugin/Android.

Changed external storage writing to "Allow" in the vive elite menu.
TargetAPI in Unity's Project Setting is now android 30.
Other Settings"/"Write Permission" was changed to "External(SDCard)" and built.
I copied the build to the internal storage of vive elite and installed it as @dilab did, and then ran it.

The application works, but the csv file is not output.
Thank you in advance for your help.

 

https://developer.vive.com/resources/vive-wave/tutorials/installing-wave-xr-plugin-unity/

WaveMain.cs

Link to comment
Share on other sites

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...