Search the Community
Showing results for tags 'quaternions'.
DanD posted a topic in MPU-6050 6-axis accelerometer/gyroscope (InvenSense)Would anyone be able to explain these general terms about the library? 1. How does the Digital Motion Processing (DPM) within the chip work? What does it do?2. How does the interrupt work? What is it caused by? I have a heavy sketch going on in the meantime (SD card, display, heart rate sensor.etc) in the background. Can it still be used with all these modules without delaying other functions?3. How does the library incorporate quaternions? Thanks Daniel
I was hoping someone in this forum could help me understand the quaternion data output from the MPU-6050 when using the MPU6050-DMP6 code by Jeff Rowberg. I'm working on a project that contiuously records 3D positioning. Previously I had been recording euler angles, however, I ran into problems with Gimbal lock. Now I've started recording quaternions to avoid Gimbal lock, but the math involved is a little beyond me at the moment. I'm having a hard time making sense of the quaternion values I get from the device and relating them to real world dimensions. I want to be able to tilt the device sensor 90 degrees and confirm in the device data that this was accurately recorded. Here is some recorded quaternion data using the Arduino Pro Mini 3.3V, 8MHz ATmega 328 board: MPU-6050 at baseline pointing straight (after waiting 10 seconds) quaternion_straight: .4337, .2398, -.4392, -.7495 MPU-6050 pointing 90 degrees downward (attitude/pitch =-90 degrees) quaternion_down: -.1815, .4730, -.1089, -.8553 MPU-6050 pointing 90 degrees upward (attitude/pitch =+90 degrees) quaternion_up: .8190, -.1508, -.4704, -.2919 MPU-6050 tilted 90 degrees right (banking/roll =+90 degrees)quaternion_right: .0665, .5426, -.8361, -.0451MPU-6050 tilted -90 degrees left (banking/roll =-90 degrees)quaternion_left: .5125, -.0204, -.0079, -.8584 In an attempt to make sense of the data I have tried to convert the quaternion values to euler angles by using the following formula (http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles): When I apply this formula I get euler values. As I believe the formula above gives me radian values all euler values below are already *(180/pi) to convert radian -> degrees. MPU-6050 at baseline pointing straight (after waiting 10 seconds) euler_straight: .60.04, -1.23, -120.61 MPU-6050 pointing 90 degrees downward (attitude/pitch =-90 degrees) euler_down: 1.58, 58.06, 156.92 MPU-6050 pointing 90 degrees upward (attitude/pitch =+90 degrees) euler_up: 3.087, -59.15, -40.98 MPU-6050 tilted 90 degrees right (banking/roll =+90 degrees) euler_right: 171.50, -3.57, -113.77 MPU-6050 tilted -90 degrees left (banking/roll =-90 degrees)euler_left: -0.42, -2.47, -118.31 The above values do not seem to correlate with the movements of the sensor described - e.g. the calculated euler values report movement in >1 dimensions (φ pitch -1.23 -> 58.06 and ψ roll -120.61 -> 156.92) In an attempt to calibrate the device to match up with real world dimensions I've tried: quaternion_straight*inverse(quaternion_straight)= 1, 0, 0, 0 quaternion_down*inverse(quaternion_straight)= 0.7236, 0.5427, -0.2764, -0.3254 euler conversion(quaternion_down*inverse(quaternion_straight))= 75.02, -2.68, -50.49 Once again 75.02, -2.68, -50.49 does not correspond to a 90 tilt in one direction/dimension. And I've also tried: euler_straight-euler_straight= 0, 0, 0 euler_down-euler_straight= -58.47, 59.30, 277.53 -58.47, 59.30, 277.53 does not correspond to a 90 tilt in one direction and does not match with the above mentioned 75.02, -2.68, -50.49 which I might have expected. As you might be able to see from what I have tried above, I have so far been unsuccessful in demonstrating that the device data is recorded accurately when I move the device 90 degrees in one direction. Do you have any suggestions of things to try and/or read up on? Does anyone see any obvious mistakes in my calculations above or how I'm approaching the problem? Let me know if my explanations above need further elaboration. I know everyone is very busy but any ideas or help would be greatly appreciated if you have time.