My libraries are in the right place, and I've tried compiling the sketch with both the Arduino 1.0 relaxed as well as the Arduino 0.22 relaxed version. Arduino Mega2560 selected.

Reference from the sketch:

  Example of AP_OpticalFlow library.
  Code by Randy Mackay.

#include <FastSerial.h>
#include <AP_Common.h>
#include <AP_Math.h>        // ArduPilot Mega Vector/Matrix math Library
#include <SPI.h>              // Arduino SPI library
#include <AP_DCM.h>            // ArduCopter DCM Library
#include "AP_OpticalFlow.h" // ArduCopter OpticalFlow Library


I downloaded for the libraries, and got AP_DCM from the repository.

Error messages are all from following libs:




I'd appreciate a pointer to where I'm flying off course!

Views: 2513

Reply to This

Replies to This Discussion


     My guess is that there's an issue with how the sensor is connected to the APM...

I followed the link to connect the APM2.5 with the optical plow sensor. But Still its not working, and even I uploaded the test code using mission planner, but no use. Please help me to solve this problem.
I worked with the bot-thoughts code also and that one also not at all working but the thing is that using arduino mega i can initialize the sensor but failed to find the first pixel, and with the Leonardo i got the first pixel but flow continuity is not there. Please help me to solve this problem.
Thanks in Advance.


     I'm really not sure what's wrong.  Maybe you're using a sensor with the pins in a different order from the 3dr optical flow sensor.

     You know I wrote the code, I wrote the wiki page, I tried it out myself just two days ago to ensure it all worked including reading the image back from the sensor..not sure what else I can do.

I purchased it from jDrones, is it differs from 3dr optical flow sensor? but today I ordered new optical flow sensor from 3dr. I hope this one will work with your code.

Ok, so the jDrones one has a different pin ordering.  That's likely the problem.

The new PX4Flow sensor from 3DR is not compatible with arducopter yet.  I hope we will add support for it in AC3.2 but that's a few months from now.

Today I uploaded ArduCopter V 3.2-Dev FW to my APM2.5 and then i made necessary changes on board n I connected the Optical Flow Sensor, but still its not working. Is this the problem with APM2.5 or with the firmware or with OFS, right now i'm using jDrones optical flow sensor. the pin config is same as the 3DR robotics OFS. Please help me.
Hi Randy,
Today I tried to do of_loiter but after switching flight mode to OF_LOITER form STABILIZE is simply flying here and there and altitude is increasing in step wise. but if I switch to OF_LOITER with less than 50% throttle then its simply landing. I'm not getting whats the problem. So please help me to sort out this problem.
Ravi Kishore MV


     It's best to provide logs or it's all guess work I'm afraid.

One of my friend suggested that there is a change in PID from OF_LOITER to STABILIZE flight lodes, if is it so can you please send me those PID values? I donno why but the logs are not getting logged in my APM2.5 and even I'm not able to find out where is the problem, so can you suggest me a solution please.
Thanks in Advance.

Hi Randy,

I have same problem. My have setup everything and grabbed image from python but the of_loiter mode doesn't performs good and even though I have enabled NTUN for data log its not saving that in Log file...?

Please help


Could anyone help with connection pinout and working example of Optical flow with any arduino (mini, nano, mega).
Thank you!"

Reply to Discussion


© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service