Singapore
Asked — Edited
Resolved Resolved by Steve G!

Do Different Actions When It Detects Different Colours

Hi everyone,

I am trying to make my JD do different actions when it detect different colours in one single script. I have made it such that it is able to perform different actions when a colour is detected in individual scripts but know I want it to be dynamic, performing different actions when a colour is detected. What do I add to my script?

$CameraObjectColor = ("Unknown") ControlCommand("Camera", CameraMultiColorTrackingEnable)

:loop $CameraObjectColor = ("Unknown")
SayEZBWait("Let me look for a colour that I know")

If ($CameraObjectColor = "Unknown") SayEZBWait(" No I do not see any colours that I know")

ElseIf ($CameraObjectColor !="Unknown")
SayEZBWait("Yes, yes I see " +$CameraObjectColor) SayEZBWait("The object is in " +$CameraVerticalQuadrant +" column " +$CameraHorizontalQuadrant + "row")

EndIf Goto(loop)

Second question... How do I make JD's head move when it sees an object, say like a blue pen?

Please help me answer these questions or if possible redirect me to an existing thread of the same question. Thanks All!


ARC Pro

Upgrade to ARC Pro

Stay on the cutting edge of robotics with ARC Pro, guaranteeing that your robot is always ahead of the game.

United Kingdom
#1  

There is a link to a thread that I've linked below that I think does something similar to what you want, and may be worth your while checking out...

https://synthiam.com/Community/Questions/7205

To make JD's head move when tracking an object, insure that "Servo tracking" is enabled. There is a lot of information in the thread linked below that should help...

https://synthiam.com/Community/Questions/7039

I don't know if you have read it ready, but there is a camera tutorial that you should have a look at as well.

Camera device tutorial.

Also, when doing any kind of camera tracking and recognition, make sure you are in a well lit area and objects are not too close to the camera as this makes a huge difference. You asked about detecting a blue pen. For this you could use "Colour tracking" or train the camera to recognise the pen with "Object tracking".

Hope that helps. :)