Jump to content
I2Cdevlib Forums

Need help defining new virtual 'default' position for the gyro


Recommended Posts

Hello,

First I'd like to thank Jeff and all the people involved in the creation and update of this fantastic library, thanks to you I'm beeing able do advance in my projects using the MPU6050 on an easy and precise manner.

 

I'm using a arduino mini pro, a bluetooth module and the Invensense MPU6050 on a e-textile project.
I'm beeing able to read the Quaternions and Acceleration from the DMP and the data seems very precise after the calibration I made using the "setXGyroOffset/setYGyroOffset/setZGyroOffset/setZAccelOffset/etc" functions.

I'm using a modified version of the MPU6050_DMP example file and everything seems to be working O.K.

 

I'm comunicating the arduino board via bluetooth with Processing reading a comma-separated string on the virtual serial port.
With the DMP readings and I'm beeign able to make a 3D visual representation of the rotation of the board, wich made me notice that tough the rotations are consistent with the real world, the Y axis of the gyro seems to initiate always a little off the direction the board is really pointing when the power is turned on... sometimes it's default position is 25 to 45º to the left, sometimes way off, like +120º (but even then the rotation of the 3D figure works consistently, only with the 'north' of the board misaligned with the real world)


My question is: How can I make the arduino or processing sketch allow the user to set a new x,y,z 0,0,0 'default' position, based on his desired 'north' or 'front'?
I tried to convert the quaternion to angles on processing and do a subtraction, using the new 'set' position minus the current reads, but that only seems to give consistent results when the sensor is standing still, leveled and facing the new 'north'  ... After that if it rotates on any angle the readings get really inconsistent


Any of you guys had similar trouble? Did you find a solution for that?

Am I missing something with the 'w' axis of the gyro reading or something like that?



Thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...