Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
Asked — Edited

Ar Drone Colour Tracking

Hi,

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

AI Support Bot
Related Content
Synthiam
PRO
Synthiam
#1  
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.
#2  
Wow.:) Thanks a lot. That idea worked.
The software is too good.
PRO
Synthiam
#3  
Thanks! Glad to hear it worked:) Would you mind sharing a video? I would enjoy seeing it in action
#4  
ma.manoj

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.
PRO
Synthiam
#5  
CpE, I removed the duplicate thread. We can have that conversation here where it belongs.
Canada
#7  
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.
#8  
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*
#9  
repeatuntil($i=10)
if($CameraObjectWidth > 70)
stop()
endif
endrepeatuntil

i used repeat because I want it to continuously check it.
#10  
Hi Dj,

I am on a vacation. I will upload a video once I am back.
#11  
What is your variable $I?

Is that the Height?
PRO
Synthiam
#12  
This is what you need...

Code:


:loop

if($CameraObjectWidth > 70)
stop()
endif

Sleep(100)

goto(loop)
#13  
$i is just a loop variable for infinite loop. You can use the script as suggested by DJ .. More clear. Thank you.
#14  
That really helps me, thank you DJ and manoj~