Compiling Optical Flow Sensor example sketch

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. DIYDrones.com
*/

#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 ArduPilotMega1.02.zip for the libraries, and got AP_DCM from the repository.

Error messages are all from following libs:

AP_OpticalFlow

AP_DCM

FastSerial

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

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

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

  • Randy,
    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

      Thanks

  • 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.
    Thanks,
    Ravi Kishore MV
  • Randy,
    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.
  • Randy,
    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.
    Thanks.
  • Randy,
    I followed the link http://copter.ardupilot.com/wiki/optical-flow-sensor/#Testing_the_s... 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.
  • Hi Randy,
    I donno whats the problem, I uploaded the pre-built hex file into my APM2.5 and after connecting it to the terminal I pressed i but again it is showing failed to find first pixel.... can you please suggest me good solution for this problem. Thanks in advance.
  • Developer

    I've updated the wiki page and also added a pre-built hex file that can be uploaded to the APM2 directly using the Mission Planner's INITIAL SETUP > Install Firmware screen's "Load custom firmware" link.

  • The bot-thoughts code for optical flow sensor is not working, can you please help me. The sensor is not able to find the first pixel.
This reply was deleted.

Activity