Search the Community
Showing results for tags 'gravity'.
-
My question is simple. Is it possible to use the DMP output without using the interruptions method? My goal is also simple. I'm trying to read 3D acceleration without gravity by taking advantage of the actual dedicated processor for that task. I took the example that comes with the Jeff's library and got it complied and executed just perfectly. The thing is I don't want the interruption system because half I don't completely understand the code, half I need to take samples at a fixed rate. I'm pretty sure the DMP is way faster than my sampling rate, and even though it isn't, skipping a couple of random samples is not an issue in my project. So it would be awesome if I could do just something like this (my imagination coming out now) void loop() { mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetAccel(&aa, fifoBuffer); mpu.dmpGetGravity(&gravity, &q); mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity); Serial.print(aaReal.x); // awfully printed just to make my point Serial.print(aaReal.y); Serial.println(aaReal.z); delay(100); } to get acceleration without gravity using only a few functions. Note: I already did the corresponding calibration to get my offsets.
-
- dmp
- interruption
-
(and 3 more)
Tagged with:
-
Hello! I have installed Jeff Rowberg's i2cdevlib library which I can use for my MPU-6050 to make it interact with Arduino. However, I have an odd problem with one of its functions. It's got a function to turn the accelerometer & gyroscope readings into linear acceleration. This is the definition of the function: uint8_t MPU6050::dmpGetLinearAccel(VectorInt16 *v, VectorInt16 *vRaw, VectorFloat *gravity) { // get rid of the gravity component (+1g = +8192 in standard DMP FIFO packet, sensitivity is 2g) v -> x = vRaw -> x - gravity -> x*8192; v -> y = vRaw -> y - gravity -> y*8192; v -> z = vRaw -> z - gravity -> z*8192; return 0; } However, whenever the function is called in the example code: // display real acceleration, adjusted to remove gravity mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetAccel(&aa, fifoBuffer); mpu.dmpGetGravity(&gravity, &q); mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity); Serial.print("areal\t"); Serial.print(aaReal.x); Serial.print("\t"); Serial.print(aaReal.y); Serial.print("\t"); Serial.println(aaReal.z); I get values way off, when I'm not even moving my MPU-6050! These are a few of the values I get: areal -473 423 -425 areal -460 400 -450 areal -471 522 -458 areal -322 276 -582 Do you know how I can fix this? Thanks! -George
- 2 replies
-
- linear acceleration
- mpu-6050
- (and 8 more)
-
I've seen a couple posts on here asking about incline. Like this one in which Jeff gives a knowing smile at the end when he says the math is beyond him: http://www.i2cdevlib.com/forums/topic/37-incline-of-the-sensor/ But then in this one says the DMP is awesome because it can do those calculations for us: http://www.i2cdevlib.com/forums/topic/29-how-to-calculate-yaw-roll-pitch-from-mpu6050/ So I'm confused as to whether or not we can already calculate pitch and roll minus any gravity affects based on the current MPU6050 library in the I2CDev package? I thought maybe OUTPUT_READABLE_YAWPITCHROLL would provide those values but they definitely seem affected by gravity when I move the sensor around. There's a note above that constant declaration that says "this also requires gravity vector calculations" but I didn't know if that meant "requires you to do them yourself" or just that a note that they are required and being performed behind the scenes. Help me Jeff, you're my only hope! Thanks for the awesome library by the way!