My quad copter can balance itself in the air using data collected from mpu6050. With the sonar sensor, it can hover at a specific height, but it moves on the horizontal plane in a random direction. If i put an object below it, it will ascend to keep the distance between the sonar senor and the object.

Now i want to make it have the ability to hover stably. Is it possible to add a downward-facing camera to calculate the speed of optical flow in order to keep it hovering on the same point in the horizontal plane? Could I use a forward-facing camera to stabilize its vertical speed?

  • 2
    $\begingroup$ It sounds like you want to use cameras to (1) keep the quadcopter in one place on the X-Y plane, and (2) stabilize the vertical speed. What does it mean to stabilize the vertical speed? Are you trying to avoid the case where the quadcopter ascends in response to an object underneath it, or just smooth that motion? $\endgroup$
    – Ian
    Sep 12 '13 at 15:39
  • $\begingroup$ If i use two cameras and remove the sonar sensor. Can it work as i think--hover in the air. Or are there any methods to achieve my goal. $\endgroup$
    – refent
    Sep 13 '13 at 1:05

The following diagram (1) illustrates a method by which a Lancaster navigator determined airplane height above the water of a lake. Such a method is useful if the ground lacks features needed for other forms of Visual Servoing. A program I saw about mission Chastise showed one spotlight shining green and the other red, to avoid confusion about which way to go to get to correct altitude. Note, the bomb aiming rangefinder used similar geometric principles.

2-spotlight height-method

With a quadcopter, you could use red and green lasers, eg from a red laser pointer and a green laser pointer. You could also add servos to rotate one or both of the lasers to adjust the altitude setpoint. A camera or a line sensor would detect the relative positions where the lights hit the ground.

  • $\begingroup$ This is a good idea. Nice trick, loved it! $\endgroup$
    – metsburg
    Sep 14 '13 at 5:19
  • 1
    $\begingroup$ cool... but how does that answer the question about stabilising the quad in the x-y plane? $\endgroup$
    – dm76
    Jan 14 '14 at 15:39
  • $\begingroup$ @dm76, my answer was about holding a given altitude, and I didn't have more to say about Visual Servoing than was in the other answers. (This method, like sonar and VS, could be fooled by an object added below the quadcopter.) Note, range finder sights as mentioned in answer might be usable to hold XY position via a camera looking at distant landmarks. $\endgroup$ Jan 14 '14 at 16:52
  • $\begingroup$ @jwpat7, "my answer was about holding a given altitude". Indeed, hence my comment since the question was not about holding altitude... $\endgroup$
    – dm76
    Jan 15 '14 at 9:39

Using a so-called optical flow sensor is the best way to help with holding the horizontal (i.e. in X-Y plane) position. I don't see any reason why you couldn't do the same for vertical control, although a sonar is probably easier and cheaper to use for this (likewise, if you are indoors, you could use 2 sonars for the horizontal position as well)

People used to hack the sensors of optical mice to achieve this:

http://makezine.com/2007/12/15/using-an-optical-mouse-for-rob/ http://areciv.com/index.php?aid=18 http://home.roadrunner.com/~maccody/robotics/croms-1/croms-1.html http://home.roadrunner.com/~maccody/robotics/mouse_hack/mouse_hack.html

Some ready-made sensors are available: http://www.buildyourowndrone.co.uk/Optical-Flow-Sensor-p/op-fs.htm

Some explanation on how to use such device with an Arduino can be found here:https://code.google.com/p/arducopter/wiki/AC2_OptFlow

Nowadays, better sensors are out there (but much more expensive) that works in low-light conditions (i.e. indoors) and are even combined with a sonar (as it makes senses to hold altitude in order to get a better/stable optical reading for XY positioning), such as this one:

px4flow http://store.3drobotics.com/products/px4flow


You can definitely use Visual Servoing for pose maintenance in the X-Y plane. You need to have sufficient distinct features on the ground to get a good estimate of drift/spin etc. For example, on an uniform and large ground/field, lack of features might become a problem. But things will be more in your control and you can add visual cues into the scene to assist the image processing.

The forward facing camera is quite different. If your quadcopter flies high enough and is staring right into the horizon, precise pose maintenance will be very difficult (roll/pitch stabilisation might become easy in that case). But stabilising the vertical speed based on solely its front facing camera may not be a very good idea.


It sounds like you want to control the position of your quadcopter, and although it's possible to do with a camera I don't think optical flow is the right way to approach the problem.

Rather than measure the motion of the quadcopter, you should measure the position. For that, you'll want to use the camera to identify features in its field of vision, then attempt to keep them in the same place relative to the vehicle. This is called Visual Servoing.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.