-
I have a tilted 6050 chip in my bot but I need the yaw value referenced around the gravity vector. In other words I need a world-based yaw. I see world-based acceleration but nothing world-based for ypr. Am I missing something simple? I assume it would be some math on the quaternion. Actually I would be happy with a fixed rotation on just one axis since my sensor is fixed in my bot and is only rotated on one axis. I noticed the orientation stuff for the dmp but it seems to be fixed to 90 degree rotations, in other words flipping the axes around. I need a 60 degree rotation. This is a bit of a duplicate of #637 but I've figured out this simpler shorter way of asking. |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 2 replies
-
World-based yaw requires a magnetometer, which allows full 9-DOF sensor fusion. Gravity provides world reference for the accelerometer anywhere on the planet, and the gyro is entirely relative anyway, but the only way to establish a common heading reference is with a compass. Without that, you have to pick an arbitrary heading value as your virtual north/zero starting point. |
Beta Was this translation helpful? Give feedback.
-
Quaternion math should handle that. Z |
Beta Was this translation helpful? Give feedback.
-
Ah, I think I finally got it (although I thought I had it several times before). I just need to get the yaw relative to the chip and rotate that vector to give me the yaw relative to the world.
If the above is correct, then all I need to do is figure out the I'll test this out. If it works then this post should help others with tilted chips. I have googled on and off for days and the tilted chip question has been asked often with no answers. |
Beta Was this translation helpful? Give feedback.
-
When you succeed, please share your code so we can create additional helper functions math functions. |
Beta Was this translation helpful? Give feedback.
-
I'm baffled but happy. Weirdness follows ...
Oh well. All is good that ends well. I'll use what works and just continue to be baffled. |
Beta Was this translation helpful? Give feedback.
-
For lurkers who also have tilted chips: There is no need to do anything special if you have a tilted chip. The sample code works for any chip orientation. I found out why my results were so screwed up in the first place that caused me to think a tilted chip was a problem. If the chip is not tilted then numbers stabilize in 0.5 seconds. If the chip is tilted the stabilization time is much longer. In my case it takes 7 seconds (!) to get usable numbers. I assume the more the chip is tilted the longer it takes and my chip is tilted 80 degrees. I just now found this out after spending many days doing experiments that sometimes worked and sometimes gave horrible results. The amount of time I waited to start the test was the difference and I just figured that out by pure luck. But a tilted chip is a problem after all for my product. The user will turn my bot on and expect it to work right away. Seven seconds is an eternity. I guess I'll have to put up a box on the phone screen saying "warming up" until the numbers stabilize. |
Beta Was this translation helpful? Give feedback.
-
Note that the functions:
are used to calibrate the chip with it as flat as possible. This sets the offsets Use What calibration does is find the point where there is no acceleration in any of the 6 axes with gravity below the Z-axis Now use the resulting offsets to replace the following numbers
your chip will be calibrated except for minor deviations caused by temperature changes. Z |
Beta Was this translation helpful? Give feedback.
-
Thanks. That is what I have been doing. I did suspect calibration problems but after many trials I'm pretty sure my calibration was good all along. I used a bubble level clamped to my PCB with the chip. I found that the tiniest deviation of the bubble changed the results and the bubble in the middle gave the best results. |
Beta Was this translation helpful? Give feedback.
For lurkers who also have tilted chips: There is no need to do anything special if you have a tilted chip. The sample code works for any chip orientation.
I found out why my results were so screwed up in the first place that caused me to think a tilted chip was a problem. If the chip is not tilted then numbers stabilize in 0.5 seconds. If the chip is tilted the stabilization time is much longer. In my case it takes 7 seconds (!) to get usable numbers. I assume the more the chip is tilted the longer it takes and my chip is tilted 80 degrees.
I just now found this out after spending many days doing experiments that sometimes worked and sometimes gave horrible results. The amount of time I w…