I've done a blog post several months ago on this.
Here are two decent papers I've read on the subject:
The trick is that you need to compensate for the roll/pitch and also the values returning from the sensor will depend upon your altitude. If you're high up, you'll see less movement, if you're very close to the ground, you'll see more.
Currently I am using the mouse sensor from Sparkfun. I have found that the code from your blog and the arducopter site cannot be found. The sensor used in the arducopter site is different from the one that I am currently using, so is the code useful for my sensor?
ok, so yes, we recently moved to git and that branch apparently got blasted because it wasn't very active. In terms of the math that's required to compensate for the roll/pitch you can find it in the optical flow library here. In paritcular look at the update_position function.
Sadly this library won't work for the sparkfun sensor because it's designed for the ADNS3080 while the Sparkfun one is the (less advanced sorry!) ADNS2620. By the way - the link you've posted for the sensor is the simple breakout board. Really you probably should have purchased the evaluation board. The big difference is that the evaluation board includes a Atmel 328 which makes talking to the sensor a lot easier because the ADNS2620 is not using a pure I2C. So for example you couldn't easily connect up the board you've purhcased to the APM and still use a magnetometer!
Randy, is the Optflow mixed in now? What's the best way to test it?
Need a sensor first right?! Working on it!
I was one of the lucky ones to get an early board. =)
I have tested the library provided on the sparkfun product page. I face problem reading the value from the X and Y coordinate of the mouse sensor. The only value that I read from the serial terminal of X and Y is purely FF. And I try moving the sensor around and the value remain the same. I am using Ardupilot board and have connected the data pin from the Mouse sensor to analog pin 4 and clock pin to analog pin 5. Anyone manage to read the X and Y coordinate using the provided library?
I used the sparkfun library but found a bug in the pins they had specified for communicating with the mouse. after i fixed that it worked ok ( but i was using the evaluation board with the 328 on it not the breakout board).
Only FF returning could mean that you have a wiring problem. maybe the pull up resistors on the set-up are too strong and the sensor doesn't have the strength to pull them down to zero. Just a guess.
So, I looked at the AP2 code, and looks like support for optical flow sensor (ADNS3080) is in the code. Optical flow position is being blended with gps. Is it safe to enable it and how well does it work right now? What kind of range can the optical flow sensor work at, and what other conditions can I look out for?
Looks like Avnet has the ADNS3080 in stock pretty cheap @ $2.90 each, but shipping is $22, which is not too bad compared other sensors. Maybe if enough people are interested, we can do a group buy to reduce the unit cost.
Is it worthwhile to get the sensor at this point? Is there a tutorial for integrating this? Can it share the same I2C as the magnetometer.
Sorry for all the questions.
Sorry I see it's SPI and not I2C.
What you'll get from Avnet is just the chip itself. It's not horribly complex to build a breakout board for it but it does need the appropriate resistors and regulators to get it from 5v (APM) down to 3.3 (ADNS3080) and more importantly, you need to get the right lens (8mm works best in my testing) and lens mount.
I think you should wait about a month and hopefully my prototype will be available.
In terms of integration with ACM code, it's getting there but not ready yet.