Some help tweaking a script

Official forum for open source FreePIE discussion and development.
Post Reply
thantos2024
One Eyed Hopeful
Posts: 1
Joined: Thu Dec 25, 2014 2:32 pm

Some help tweaking a script

Post by thantos2024 »

I have been working on a script for a diy rift, but have a hugh problem with yaw drift, and I am trying to write a script to help compensate.

Atm I have been able to write the a script that will keep centerYaw perfectly aligned while looking ahead, but the drift is so bad, that as soon as I face of center and look back again centerYew can be of by 30 degrees or more.

What I would like to achieve is to be able to get a yaw reading A wait a couple of milliseconds, take a yaw reading b, then get the difference between the 2, then dived that by the time between yawA and yewB to give me a rough amount to adjust centerYaw

any help any can give would be apprieciated
konstantin_lozev
Cross Eyed!
Posts: 192
Joined: Fri Jul 04, 2014 1:43 am

Re: Some help tweaking a script

Post by konstantin_lozev »

Hi, can you tell us what is your setup, IMUs, do you have a magnetometer, trackIR setup, etc., and also your usage scenario (at the desk, or standing doing 360 degree vr). Is your drift consistent or random? I will post today a GlovePIE script (I am still a newbie to Python) that has driftless pitch implementation (combining gyro and accelerometer data). However, without an external reference frame (e.g. magnetometer, freetrack/trackIR setup) I doubt whether you can achieve driftless yaw.
Just a small piece of advice: if you want to emulate mouse movement, first collect the IMU readings over time to a variable, instead of assigning only the delta to a variable. At least in GlovePIE (I guess in FreePIE too) the MouseDirectinput is in mickeys by default and of course rounds out the readings that it gets assigned. If you assign to MouseDirectinput the delta at each frame, the remainders after the rounding build up and create additional drift. If you first store the accumulated readings in a variable (see below in the part of the GlovePIE script), there is one rounding and the remainders do not accumulate. That may not solve all your drift issues, but at least will not create unnecessary ones.

See below:

var.fakex += (Removeunits(wiimote.YawSpeed in radians per second)*Removeunits(Delta(timestamp)))*var.sensitivity+var.corryaw // this is a simple yaw assignment of gyro readings to the mouse horisontal movement
Mouse.DirectinputX = var.fakex // the same approach of passing through a fake variable that stores unrounded data is applied

Good luck :)
Post Reply

Return to “FreePIE”