Implementation of driftless pitch
Posted: Fri Jan 02, 2015 5:48 pm
Happy new year to all
I had mentioned on a few occasions my troubles with drift using GlovePIE (and FreePIE). I just managed to write and test a driftless pitch script for GlovePIE. I thought I'd post it here if it could serve as an inspiration for enhancing the current fusion implemented in FreePIE (on my PC FreePIE and GlovePIE had a very significant drift). I think it might also be a good idea if as a first stage at least the gyro readings are exposed to FreePIE users (it seems now only a Pitch value is available and not the original PitchSpeed value that the gyro measures, forgive me if I am wrong). I tried to put as many explanations to the script as I could think of, but forgive me for any bad scripting techniques or cumbersome appropaches, I am only an enthusiast and not a professional.
The technique employed might seem too trivial for most of you, but feel free to suggest improvements. Basically, I have the gyro readings over time (with a Delta(timestamp)) accumulate in a variable and then every 0.05 radians of gyro-measured movement I trigger alignment to unfiltered accelerometer readings for the pitch based on the G measurements over the z and y axes. Pitch based on the accelerometer readings appeared trickier than I thought initially since there is a loooot of noise around 90 degrees along the z and x axes, so I had to switch from aSIN to aCOS. I know that it's usually aTAN that is used, but having the two accelerometer readings of z and y as an argument increased the noise levels twice. Same is the reason why I did not implement a compensation for roll (by having the combined x and y vectors or 1-z^2), it simply suffers from too much noise.
The script is highly customizable, so anyone can experiment with the variables, if he wants to.
Here is the link to the script
https://drive.google.com/file/d/0B_7L0f ... sp=sharing
And a collection of all earlier versions of the script, including some alternative methods that I tried, but thought they gave worse results.
https://drive.google.com/file/d/0B_7L0f ... sp=sharing
I also made a short and simple video of how the alignment works with the built in GlovePIE 3d simple rendering and a short Crysis 2 demo:
http://youtu.be/jPP8XQRqlLA
My interest now is how to implement this in FreePIE.
I had mentioned on a few occasions my troubles with drift using GlovePIE (and FreePIE). I just managed to write and test a driftless pitch script for GlovePIE. I thought I'd post it here if it could serve as an inspiration for enhancing the current fusion implemented in FreePIE (on my PC FreePIE and GlovePIE had a very significant drift). I think it might also be a good idea if as a first stage at least the gyro readings are exposed to FreePIE users (it seems now only a Pitch value is available and not the original PitchSpeed value that the gyro measures, forgive me if I am wrong). I tried to put as many explanations to the script as I could think of, but forgive me for any bad scripting techniques or cumbersome appropaches, I am only an enthusiast and not a professional.
The technique employed might seem too trivial for most of you, but feel free to suggest improvements. Basically, I have the gyro readings over time (with a Delta(timestamp)) accumulate in a variable and then every 0.05 radians of gyro-measured movement I trigger alignment to unfiltered accelerometer readings for the pitch based on the G measurements over the z and y axes. Pitch based on the accelerometer readings appeared trickier than I thought initially since there is a loooot of noise around 90 degrees along the z and x axes, so I had to switch from aSIN to aCOS. I know that it's usually aTAN that is used, but having the two accelerometer readings of z and y as an argument increased the noise levels twice. Same is the reason why I did not implement a compensation for roll (by having the combined x and y vectors or 1-z^2), it simply suffers from too much noise.
The script is highly customizable, so anyone can experiment with the variables, if he wants to.
Here is the link to the script
https://drive.google.com/file/d/0B_7L0f ... sp=sharing
And a collection of all earlier versions of the script, including some alternative methods that I tried, but thought they gave worse results.
https://drive.google.com/file/d/0B_7L0f ... sp=sharing
I also made a short and simple video of how the alignment works with the built in GlovePIE 3d simple rendering and a short Crysis 2 demo:
http://youtu.be/jPP8XQRqlLA
My interest now is how to implement this in FreePIE.