Asked — Edited

Ar Drone Colour Tracking


I tried the colour tracking in the ar drone v2. It works perfectly well. But the problem is, the drone comes racing towards the object as close at it can get. Can you tell me what I can do so that the drone stays a little bit far away from the coloured object always.

Thanks & Regards Manoj


Upgrade to ARC Pro

Take control of your robot's destiny by subscribing to Synthiam ARC Pro, and watch it evolve into a versatile and responsive machine.


You will have to write a short script that measures the size of the detected object and uses that to determine how close it is.

There are no distance sensors on the drone. There is no way to determine distance with a single camera, either.

The best way is to always use the same object and tell the drone to "stop!" When the detected object is a specific width or height.

You can put that code in the "tracking start" script for the camera control. Find it under the config button.

The code can check the detected object with. It's a variable. Look at the variable tab and determine the max width of your object before stopping the drone.


Wow.:) Thanks a lot. That idea worked. The software is too good.


Thanks! Glad to hear it worked:) Would you mind sharing a video? I would enjoy seeing it in action



How was your script written to measure the object? I know it would use x and y coordinates. Just not sure about the syntax in scripting.


CpE, I removed the duplicate thread. We can have that conversation here where it belongs.


This is good stuff DJ, I'm having a great time with ez-robot. Determining object size with the camera is a great idea. Could you post a quick and short example of a script that could do this, I would like to try this myself, thanks.


I can do it in C no problem, the logic is easy but I also am having trouble with scripting.

if($CameraObjectWidth == 20 && $CameraObjectHeight == 20) { Stop() } else { Forward() } confused


repeatuntil($i=10) if($CameraObjectWidth > 70) stop() endif endrepeatuntil

i used repeat because I want it to continuously check it.


Hi Dj,

I am on a vacation. I will upload a video once I am back.


What is your variable $I?

Is that the Height?


This is what you need...


  if($CameraObjectWidth > 70)




$i is just a loop variable for infinite loop. You can use the script as suggested by DJ .. More clear. Thank you.


That really helps me, thank you DJ and manoj~