Page 1 of 3

Zeiss headtracker input/trackIR output?

Posted: Tue May 14, 2013 4:08 pm
by Mars
I've recently purchased the Zeiss Cinemizer OLED & Headtracker. The headtracker works well imitating a mouse but the game I mostly play (Rise of Flight) has a nasty habit of recentering the mouse in the wrong place when changing the FOV (something you do a lot). This does not happen with trackIR (or FacetrackNoIR in my case) and apears t be something built into the games mouselook implementation.

As the zeiss headtracker appears to the system as a mouse, is it possible to pass the headtracker mouse input through the games inbuilt trackir interface using FreePIE?

Re: Zeiss headtracker input/trackIR output?

Posted: Wed May 15, 2013 1:33 am
by CyberVillain
Mars wrote:I've recently purchased the Zeiss Cinemizer OLED & Headtracker. The headtracker works well imitating a mouse but the game I mostly play (Rise of Flight) has a nasty habit of recentering the mouse in the wrong place when changing the FOV (something you do a lot). This does not happen with trackIR (or FacetrackNoIR in my case) and apears t be something built into the games mouselook implementation.

As the zeiss headtracker appears to the system as a mouse, is it possible to pass the headtracker mouse input through the games inbuilt trackir interface using FreePIE?
FreePIE does not support Zeiss Cinimizer, what outputs other than mouse does it have?

Re: Zeiss headtracker input/trackIR output?

Posted: Wed May 15, 2013 12:15 pm
by Mars
Sorry it getting was late when I posted.

The headtracker operates as a standard mouse (albeit with roll). What i'm trying to do is to trick the game into thinking i'm using TIR by sending the headtracker mouse input through FreePIE i.e.

headtracker mouse --> freepie --> game sees input as TIR input and not mouse input

FreePIE does see the headtracker as mouse input but I don't seem able to output it as TIR input.

Re: Zeiss headtracker input/trackIR output?

Posted: Wed May 15, 2013 4:34 pm
by CyberVillain
Mars wrote:Sorry it getting was late when I posted.

The headtracker operates as a standard mouse (albeit with roll). What i'm trying to do is to trick the game into thinking i'm using TIR by sending the headtracker mouse input through FreePIE i.e.

headtracker mouse --> freepie --> game sees input as TIR input and not mouse input

FreePIE does see the headtracker as mouse input but I don't seem able to output it as TIR input.
What game is it? Some games need the TrackIR fixer to work

http://naturalpointofview.blogspot.se/p ... fixer.html

Are there no other outputs than mouse emulation from that tracker driver? Sounds shitty to me

Re: Zeiss headtracker input/trackIR output?

Posted: Wed May 15, 2013 4:59 pm
by Mars
Theres an SDK apparently which you have to register for - the mouse emulation works well its just the game's (rise of flight) implementation of mouselook thats shitty; changing FOV centres the mouse on where you happen to be looking at the time.

The tracker is very impressive - no discernable latency. Your head is the limiting factor ;-). I've seen more latency using TIR or Facetracknoir.

Re: Zeiss headtracker input/trackIR output?

Posted: Thu May 16, 2013 6:27 am
by CyberVillain
Mars wrote:Theres an SDK apparently which you have to register for - the mouse emulation works well its just the game's (rise of flight) implementation of mouselook thats shitty; changing FOV centres the mouse on where you happen to be looking at the time.

The tracker is very impressive - no discernable latency. Your head is the limiting factor ;-). I've seen more latency using TIR or Facetracknoir.
The problem is that FreePIE wont stop the mouse from bubble its data to the game so you will receive both mouse and TIR data.
Is the SDK free? I can look at it if you register and download it for me.

Re: Zeiss headtracker input/trackIR output?

Posted: Thu May 16, 2013 11:15 am
by Mars
Fortunately ROF disables mouse look when TIR is detected so that should not be an issue (I hope).

I've registered for teh SDK but I'm waiting for a response.

Ideally I'd like to get to a point where I can use the headtracker with FaceTrackNoIR with a PS3 eye to provide 6DOF. I think that a plugin for FTNIR (which supports primary/secondary input soucres) would be required and for that I need the sdk.

Re: Zeiss headtracker input/trackIR output?

Posted: Tue May 21, 2013 9:06 am
by InrealMike
Hey,

I'm one of the developers of the cinemizer Headtracker. Should you have any more questions feel free to contact me.
Have you received the SDK? The second HID-Interface of the Tracker offers raw Quaternion output.

Re: Zeiss headtracker input/trackIR output?

Posted: Tue May 21, 2013 10:46 am
by CyberVillain
@InrealMike Hi Mike, thanks for showing interest in FreePIE. Are you having a dialog with Mars?
Let me know if the FreePIE team can assist you, we very much want support for your products...

Re: Zeiss headtracker input/trackIR output?

Posted: Tue May 21, 2013 11:25 am
by Mars
Hi,

No I haven't received the SDK but I may have been a bit thick and not checked the box that says 'yes I want the SDK'. Second registration e-mail sent!

Regards

Mars

Re: Zeiss headtracker input/trackIR output?

Posted: Tue May 21, 2013 12:21 pm
by greenlantern
Hey

Re: Zeiss headtracker input/trackIR output?

Posted: Tue May 21, 2013 2:47 pm
by Mars
Blimey, thats service for you!

Re: Zeiss headtracker input/trackIR output?

Posted: Wed May 22, 2013 12:31 am
by InrealMike
I just send you the SDK and a link to the Tray-Icon tool

Re: Zeiss headtracker input/trackIR output?

Posted: Wed May 22, 2013 1:24 am
by InrealMike
@CyberVillain:

I will gladly send you the SDK as well and can assist you to integrate it in FreePie.
The Tracker delivers absolute Quaternions, through an HID-Device at 200Hz.
It should be fairly easy to integrate this into FreePie.
Just send me a PN with your email and I will send you the SDK.

Re: Zeiss headtracker input/trackIR output?

Posted: Wed May 22, 2013 11:59 am
by Mars
SDK email received (I was already using the headtracking applet).

Now, I just need the time to do something with it!

Re: Zeiss headtracker input/trackIR output?

Posted: Fri May 31, 2013 2:05 pm
by Mars
Finally had time to have brief look at the SDK and I see that there is a C-compatible dll.

Am I right in thinking that this could be called by FreePIE as an external plugin without too much difficulty? Willing to have a crack but I haven't touched .Net/C# for nearly 10 years...

@Cybervillain: did Inreal send you the sdk?

Re: Zeiss headtracker input/trackIR output?

Posted: Fri May 31, 2013 2:19 pm
by InrealMike
Hey Mars

Yes that's how it should be done. I suspect it to be fairly easy to integrate it into FreePie. Especially since it already has support for other IMUs. So instead of grabbing the tracker data through the COM port it can access it via the dll which handels all the USB communication and delivers the precalculated quaternions.

I did send the SDK to Cybervillan.

Re: Zeiss headtracker input/trackIR output?

Posted: Sat Jun 01, 2013 4:55 am
by CyberVillain
Sorry ive been super busy with other projects. I havent looked and it will take me some time todo it, but i can give you some pointers. First create a branch on github, do not work directly in the master branch.

If the sdk is C then you can use DllImport to import the fnctions you need. You can look in the Yei 3 branch how to use dllimport
https://github.com/AndersMalmgren/FreeP ... ace/Api.cs

edit: I can create a branch for you with a embryo that you can work on. Give me an hour or so

Re: Zeiss headtracker input/trackIR output?

Posted: Sat Jun 01, 2013 5:25 am
by Mars
If you can create the embryo that will give me a start. Now, to try and find my brain!

Re: Zeiss headtracker input/trackIR output?

Posted: Sat Jun 01, 2013 5:28 am
by CyberVillain
Is freeglut.dll required by tracker.dll?

Re: Zeiss headtracker input/trackIR output?

Posted: Sat Jun 01, 2013 5:53 am
by Mars
From my reading of the SDK docs I think that is just used in the example c# gui .exe that gives a visualisation of the tracker movement.

Re: Zeiss headtracker input/trackIR output?

Posted: Sat Jun 01, 2013 6:12 am
by CyberVillain
I couldnt test it more than I get a device not found..

https://github.com/AndersMalmgren/FreePIE/tree/Zeiss

Re: Zeiss headtracker input/trackIR output?

Posted: Sat Jun 01, 2013 10:06 am
by Mars
Its working!

After 3 hours of thinking wtf I just needed to comment out the bits that were calling setbootloader mode. The headtracker is not in bootloader mode for normal use so the dll was unable to find it when called and thus gave an error. Now I can see data being returned in the watch window!

Re: Zeiss headtracker input/trackIR output?

Posted: Sat Jun 01, 2013 10:23 am
by CyberVillain
Nice i just copied that stuff from the example.
Should I just remove that part all together or send in true?

Re: Zeiss headtracker input/trackIR output?

Posted: Sat Jun 01, 2013 10:38 am
by Mars
Your chocie I think, the bits I commented out are as follows:

api.cs:

Code: Select all

 /*public static bool SetBootloaderMode(bool activationMode, out int error)
        {
            var result = Tracker_SetBootloaderMode(false);
            error = GetLastError();

            return result;
        }*/
ZeissPlugin.cs:

Code: Select all

/*result = Api.SetBootloaderMode(false, out error);
            if (!result)
            {
                throw new Exception(string.Format("Error while setting bootloader mode: {0}", Api.GetError(error)));
            }*/
Just tried ROF using the following script:

Code: Select all

def update():
#Zeiss2TrackIR output
 trackIR.yaw = zeiss.Yaw
 trackIR.pitch = zeiss.Pitch
 trackIR.roll = zeiss.Roll
 
 diagnostics.watch(zeiss.Yaw);
 diagnostics.watch(zeiss.Pitch);
 diagnostics.watch(zeiss.Roll);
 
if starting:
 zeiss.update += update
Pitch & Roll do nothing but I get movement (a twitch is the best I can describe it) with roll. I don't think whatever units are currently being passed to ROF via FreePIE, ROF's TIR interface understands. perhaps I need one of the other outputs of the API?

Re: Zeiss headtracker input/trackIR output?

Posted: Sat Jun 01, 2013 10:40 am
by CyberVillain
trackIR uses deegrees while zeiss uses radians

convert using math.degrees in script

Re: Zeiss headtracker input/trackIR output?

Posted: Sun Jun 02, 2013 8:59 am
by Mars
zeiss using radians and TIR using degrees was only part of the problem. As it stands, when held with the clip on top (which fixes the tracker to the cinemizer glasses), the tracker axis are scrambled as follows:

Tracker --> TIR
yaw --> roll
roll --> pitch
pitch --> yaw

Note that it is the movement of the tracker that is wrong.

The sdk c# examples uses RotateTrackerToCinemizer(). i've tried the following code in Zeissplugin.cs but it has no effect:

Code: Select all

 if (!(Api.WaitNextFrame())) Thread.Sleep(10);
                
                var frame = new Frame();
                var euler = new Euler();
                var quat = new Quat(); //mars

                if (Api.GetFrame(ref frame))
                {
                    Api.RotateTrackerToCinemizer(ref quat, frame.Rot); //mars
                    Api.QuatGetEuler(ref euler, frame.Rot);
                    Euler = euler;

                    newData = true;
                }
The sdk also mentions ApplyAutoRollAdjust () being used to orientate the tracker to the cinemizer glasses. Not sure how I would call that as it seems to be internal to the tracker.dll.

I take it I am missing something fundamental here! Any ideas?

Re: Zeiss headtracker input/trackIR output?

Posted: Sun Jun 02, 2013 12:23 pm
by CyberVillain
Sorry cant help :/ Have to wait for the Zeiss guys to get back to us

Re: Zeiss headtracker input/trackIR output?

Posted: Mon Jun 03, 2013 2:09 pm
by Mars
Getting closer - tracker now orientates correctly (zeissPlugin):

Code: Select all

                if (!(Api.WaitNextFrame())) Thread.Sleep(10);
                
                var frame = new Frame();
                var euler = new Euler();
                var cinemizerRot = new Quat(); //mars
                var cinemizerEuler = new Euler(); //mars

                if (Api.GetFrame(ref frame))
                {
                    Api.QuatGetEuler(ref euler, frame.Rot);
                    Api.RotateTrackerToCinemizer(ref cinemizerRot, frame.Rot); //mars
                    Api.QuatGetEuler(ref cinemizerEuler, cinemizerRot); //mars
                    
                    Euler = cinemizerEuler; //mars euler to cinemizerEuler

                    newData = true;
                }
Using this in freePIE as it centres correctly when 'z' is pressed:

Code: Select all

def update():
   global yaw,roll,pitch,caly,calr,calp
   
   yaw = math.degrees(zeiss.Yaw)
   roll = math.degrees(zeiss.Roll)
   pitch = math.degrees(zeiss.Pitch)
   
   trackIR.yaw=yaw+caly
   trackIR.roll=roll+calr
   trackIR.pitch=pitch+calp

if starting:
   yaw=0
   roll=0
   pitch=0
   caly=0
   calr=0
   calp=0
   
   zeiss.update += update

diagnostics.watch(yaw+caly)
diagnostics.watch(roll+calr)
diagnostics.watch(pitch+calp)

if (keyboard.getPressed(Key.Z)):
   caly=0-yaw
   calr=0-roll
   calp=0-pitch
Yaw is inverted and jumps when looking left (have to move tracker to the right)

Re: Zeiss headtracker input/trackIR output?

Posted: Mon Jun 03, 2013 4:04 pm
by CyberVillain
Nice work!

Can you please push it to your Github fork? (Without your "mars" comments :D I can track whats changed using Git)

So its only a matter of chaning sign and then your set?

Re: Zeiss headtracker input/trackIR output?

Posted: Mon Jun 03, 2013 4:34 pm
by Mars
What the fork!, I was working off cloned branch and did not fork... I take it i will need to fork it and then commit?

Did some more testing (TV program interrupted things earlier):

Cause of jump in game is the yaw switching from -17x to 170 and hence the jump in view.

Comments were as much for my benefit as for posting on here ;-D

Re: Zeiss headtracker input/trackIR output?

Posted: Tue Jun 04, 2013 12:14 am
by CyberVillain
Aha, thats a common problem when going from absolute to delta (mouse). Continues yaw fixes this which some plugins have, might have to fix that for all imu plugins.

I a read only clone won't help, you need an account at github and then fork my repo.

Re: Zeiss headtracker input/trackIR output?

Posted: Tue Jun 04, 2013 11:52 am
by Mars
Right, I've forked instead of cloned and commited the changes i made:

https://github.com/marcfellows/FreePIE/

Re: Zeiss headtracker input/trackIR output?

Posted: Tue Jun 04, 2013 1:47 pm
by CyberVillain
cool dude will check it out

Re: Zeiss headtracker input/trackIR output?

Posted: Tue Jun 04, 2013 2:16 pm
by Mars
Still trying to figure out this lack of continous yaw problem :

Tracker, converting from radians to degrees, origin 0 is rotated 90deg from the position you actually hold the tracker . So when looking straight ahead, right is 0 deg, left 179. The rear arc behind you is then negative e.g (please excuse the crap diagram):

******* 90deg

179deg ********** 0deg
-179deg

******* -90deg

The view jumps in game with the change from 179 to -179

Any ideas on how to get around this? Maths was never my best subject (Biology was).

BTW thanks for all the help - I would not have got this far otherwise!

Re: Zeiss headtracker input/trackIR output?

Posted: Tue Jun 04, 2013 2:31 pm
by CyberVillain
Leave that part to me :D i'm planning on doing something generic that all plugins can use.
Im just checking out your code

edit: by the way we are talking about mouse emulation now right?

Re: Zeiss headtracker input/trackIR output?

Posted: Tue Jun 04, 2013 2:51 pm
by Mars
Yes, its probably a good thing I don't do this for a living. I would starve!

Nope - the game seems to want 0-360 with no negative numbers. I've just tested with the following freepie script:
def update():
yaw = math.degrees(zeiss.Yaw)
...
if starting:
if yaw < 0:
yaw = yaw + 360
else:
yaw = yaw
This gives yaw of 0-360. Panning is smooth with no jumps but it is the default rotation of the tracker with 0 to the right that is screwing it up now.

edit: talking about TIR not mouse

Re: Zeiss headtracker input/trackIR output?

Posted: Tue Jun 04, 2013 3:09 pm
by CyberVillain
no tir goes from 0 to -90 and 0 to +90 (And can go futher but since it optic that the ranges most games implement)
Which game?

edit: Here is a android > TIR script i did thats worked well with all TrackIR titles i tried

Code: Select all

def update(): 
   global yaw 
   yaw = android.yaw
   global pitch 
   pitch = -android.roll
   global roll 
   roll = android.pitch

if starting:
   centerYaw = 0
   centerPitch = 0
   centerRoll = 0
   
   yaw = 0
   pitch = 0
   roll = 0
   android.update += update

trackIR.yaw  = math.degrees(yaw - centerYaw)
trackIR.pitch =  math.degrees(pitch - centerPitch)
trackIR.roll =  math.degrees(roll - centerRoll)

if keyboard.getKeyDown(Key.LeftControl) and keyboard.getPressed(Key.C):
   centerYaw = yaw
   centerPitch = pitch
   centerRoll = roll

Re: Zeiss headtracker input/trackIR output?

Posted: Tue Jun 04, 2013 3:23 pm
by Mars
No, that script still jumps and has the 90 deg rotation of 0 to the right. Rise of flight is a very peculiar game in many respects so it wouldn't surprise me if they decided to do something different (russians do love their wodka).

Re: Zeiss headtracker input/trackIR output?

Posted: Tue Jun 04, 2013 3:48 pm
by CyberVillain
Strange game :D

Try to send in constant values and see what the reference points are, find center left and right

trackIR.yaw = -90 should give you full left in a game that follows TIR protocoll

edit: btw, I pulled your changes. Should I merge the Zeiss branch into master, or does it need more work?