[Help] Correcting Roll with MPU6050 pitch/yaw

Official forum for open source FreePIE discussion and development.
Post Reply
ElectricPotato
One Eyed Hopeful
Posts: 5
Joined: Mon Jan 21, 2019 8:37 am

[Help] Correcting Roll with MPU6050 pitch/yaw

Post by ElectricPotato »

OK, so I've built myself a DIY VR headset using an MPU6050 gyroscope/accelerometer (Originally intended as an ETracker, but with the software replaced with a FreePIE interaction for 360 degree rotation) - however, I've run into a small hiccup.
When rotated to the left or right in yaw (So, turned left or right) I've noticed that the roll goes completely haywire - even reversing if you go far enough. Also, things go slightly weird with pitch/roll too - that ones difficult to explain though, and I have a feeling that any roll fix could be adapted to fix this as well.

Also, I'm a complete noob when it comes coding Arduino, and only slightly less of a noob with FreePIE - I'm using a slightly modified version of this Github Project:
https://github.com/mirkoBastianini/Head ... no-FreePie
with a few of the axis' swapped since I think I might have the tracker backwards - it's glued in place now, and there's nothing I can do to change it. (-‸ლ)

I'm attaching my modified versions just in case it's something I did wrong - if anyone can help with what's going on here that'd be amazing!
You do not have the required permissions to view the files attached to this post.
Leshchuk
One Eyed Hopeful
Posts: 4
Joined: Mon Jan 14, 2019 9:05 am

Re: [Help] Correcting Roll with MPU6050 pitch/yaw

Post by Leshchuk »

Hey there! From what I can see, your MPU does not utilize magnetic sensor, so it is subject to gyroscopic drift over time, but that is probably just part of the issue. Next thing is that you are using wrong centering algorithm. Rotatition transformation along three axes is sensitive to application order. What you are doing is simply substituting euler angles of initial frame and "center" frame of reference. That might be accurate enough for small deviations, but would provide you overlapping or inverted axes at higher ones. https://math.stackexchange.com/question ... 0a78037acd here is the correct procedure for "centering". For that you'll need to implement some matrix or quaternion math in your sketch as, sadly, there's no support for numpy in FreePie.
andreaparisi
One Eyed Hopeful
Posts: 6
Joined: Thu Sep 29, 2016 7:29 pm

Re: [Help] Correcting Roll with MPU6050 pitch/yaw

Post by andreaparisi »

hi, I ask if a modification is possible, I would like to use the project only to have the x, y, z displacements, without using yaw, roll, pitch. Thanks.
Post Reply

Return to “FreePIE”