jrowberg / i2cdevlib

I2C device library collection for AVR/Arduino or other C++-based MCUs
http://www.i2cdevlib.com
3.92k stars 7.52k forks source link

Will DMP help with my camera gimbal #25

Closed Tom11Films closed 11 years ago

Tom11Films commented 11 years ago

Hi Jeff, I'm working on a 3 axis self-balancing camera gimbal. Most of the projects that are out there are just 2 axis, and use arduino and a 6050IMU. I believe they are doing the fusion on the arduino side, and thus the update rate on the motors that balance the camera isn't as high as possible, and there is also the occasional drift that happens. I'm wondering if implementing your DMP code will help this problem?

Please excuse my ignorance, but will the addition of a magnetometer also make a difference for this application?

Gimbal would be mounted on a vehicle, cablecam, RC helicopter or hand held.

Thanks,

-Tom

jrowberg commented 11 years ago

Hi @Tom11Films,

The DMP would most likely help in this case, since it would offload a large portion of the work onto the sensor itself instead of the Arduino. Note that the DMP algorithm takes ~8 seconds to self-calibrate, though I think there is a way to improve this by proper usage of the various OFFSET registers on the MPU6050. I have not explored this yet though.

Adding a magnetometer is absolutely necessary in order to eliminate yaw drift, though exactly how to do this is something I haven't grasped yet either. I know conceptually how it works, but not mathematically/physically. With only a gyro and accel, the DMP algorithm is rock-solid except for yaw drift, which is incredibly slow but still present.

Tom11Films commented 11 years ago

This page seems to have some good info on adding compas into the mix with Kalman filter, though obviously it doesn't have anything to do with DMP on the 6050. http://ardadv.blogspot.com/2012/05/combining-measurements-from-l3g4200d.html

Any word from invensense on when they might shed some more light on how to use DMP?

And is the proper place to have this discussion?

jrowberg commented 11 years ago

That's an interesting page...I'll have to read through that a couple of times. The best luck I had was with a 6-DOF IMU filter from Seb Madgwick, and the paper I got it from has a 9-DOF MARG filter as well which I haven't tried yet. That would be a raw implementation though, where the host MCU does all of the work. I'm not sure how to take the fused quaternion that the DMP spits out and then filter it based on an external magnetometer.

InvenSense is not likely to explain exactly how to use the DMP, ever. The best they have done is release "portable" 6-axis version of their MotionApps platform for (I believe?) a PIC platform, or possibly MSP430, which is locked down by some restrictive anti-reverse-engineering ToS.

This probably isn't the best place for this discussion, but I don't have a forum up on the site yet (which would be the best place). Most people just do direct email, though that's getting a bit unmanageable. :-)

Tom11Films commented 11 years ago

Have you read what the recently deceased Fabio Varesano did with FreeIMU? http://www.varesano.net/projects/hardware/FreeIMU

Seems like he's got 9dof working with a MPU6050 gyroscope+accelerometer, the HMC5883L magnetometer and the MS5611-01BA high resolution altimeter. I'm not sure how well it works, but seems like it's a pretty advanced project. Unfortunately we don't know what will become of it...

Tom11Films commented 11 years ago

I've now done a ton more research, and I believe the Timecop at multiwii http://www.multiwii.com/forum/viewtopic.php?f=8&t=1080&start=70#p11489 got it to work- he's got 200hz refresh rate going using DMP to fuse the ACC and gyro, then combining in the mag separately on the flight control chip- STM32F4 @ 72mhz. I'm going to look into his code to try to go that route as it seems like the current fastest open source method.

jrowberg commented 11 years ago

My goodness! I had no idea that he died. That's terrible.

He did a lot of work with this sensor and understood the motion algorithms much better than I do. The MultiWii solution is definitely interesting also. I'll have to check that out, to see if there's a good way for me to roll bits of it into the Arduino release. It's probably not possible to get the same performance on a 16MHz or 8MHz 8-bit AVR though.