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

DIY Robocars via Twitter
yesterday
DIY Robocars via Twitter
RT @SahikaGenc: AWS DeepRacer & Hot Wheels Track https://youtu.be/4H0Ei07RdR4 via @YouTube
Sep 14
DIY Robocars via Twitter
Sep 8
DIY Robocars via Twitter
RT @davsca1: We are releasing the code of our Fisher Information Field, the first dedicated map for perception-aware planning that is >10x…
Sep 8
DIY Robocars via Twitter
RT @SmallpixelCar: How this works: 1)object detection to find cones in single camera image, 30 frames/sec on @NVIDIAEmbedded Xavier. 2)comp…
Sep 8
DIY Robocars via Twitter
RT @SmallpixelCar: Use two color cones to guide the robocar. No map needed, on onsite training needed. Just place the cones and it will fol…
Sep 7
DIY Robocars via Twitter
Sep 7
DIY Robocars via Twitter
RT @roboton_io: Great to see http://roboton.io running at 60fps on the cheapest #chromebook we could find! #edtech #robotics #educat…
Sep 3
DIY Robocars via Twitter
RT @openmvcam: Crazy in-depth article about using the OpenMV Cam for Astrophotography: https://github.com/frank26080115/OpemMV-Astrophotography-Gear https://t.co/BPoK9QDEwS
Sep 3
DIY Robocars via Twitter
RT @openmvcam: Hi folks, it's finally here! Our first draft of our Arduino Interface Library is out! It works over SoftwareSerial, Hardware…
Sep 3
DIY Robocars via Twitter
RT @chr1sa: Please let them have an open API. This would be perfect for @DIYRobocars races https://twitter.com/NintendoAmerica/status/1301513099707658246
Sep 3
DIY Robocars via Twitter
RT @SmallpixelCar: Lanenet pretty much used all my GPU power on @NVIDIAEmbedded Xavier since I optimized with tensorRT. I need to run anoth…
Sep 3
DIY Robocars via Twitter
RT @LyftLevel5: Our @kaggle competition on Motion Prediction for Autonomous Vehicles is now live! Experiment with the largest-ever self-dri…
Aug 24
DIY Robocars via Twitter
RT @chr1sa: Our next @DIYRobocars virtual AI car race will be on Sept 26th. Sign up here https://www.meetup.com/DIYRobocars/events/272786977/ https://t.co/UENKGSOWO8
Aug 24
DIY Robocars via Twitter
New ready-to-run @NVIDIAEmbedded JetRacer car from Waveshare. Perfect for the next @diyrobocars race as soon as we… https://twitter.com/i/web/status/1297960223013867520
Aug 24
DIY Drones via Twitter
RT @chr1sa: The US government just approved 5 US-made drones for purchase, all based on the @Dronecode @PX4Autopilot standard. Great news f…
Aug 20
More…