
NYP.Shank_95
India
Asked
— Edited

I want to make my robot do a function in such a way that for example, when it detects a red colour object, the robot responses as "I see a red colour object" and it does the same thing for blue or green object.
Use the tracking script in the camera control and the variable $CameraObjectColor to return the colour detected...
this is a portion of script I am using to track a red tag to navigate in a room:
Search for color tag containing QR code to help find destination
set Color tracking ex:red
start scanning for red card
move to an open space ( adjust distance sensors to a larger detection area)
if not found move to next open space
on tracking result successful move toward it
set QR code tracking on
read code and move according to the code
$target=0
$CameraVerticalQuadrant= "Unknown" # reset variable for subsequent reading
RepeatUntil ($CameraVerticalQuadrant="Middle") # Variable switching state when red color is detected
Sleep(500)
EndRepeatUntil
$CameraVerticalQuadrant= "Unknown" # reset variable Say("found red tag")
Aerius, I dont want it to detect one colour. I want multiple colours. If it detects Red colour, i expect the robot to do action A. If it detects Blue, action B and if Yellow, Action C.
@NYP.Shank_95 ... See my post above... You use $CameraObjectColor to determine which colour the camera is tracking....
@NYP.Shank_95 Here's a script that does what you want. You have to calibrate your colors in the "Multi Color" tab in the Camera control.
You can put in whatever you want the robot to do after it detects the color. I have it just saying the color it sees.
Edit: It says the last color detect over and over again until it sees a different color. I'm working on that, if anyone has any suggestions, let me know
https://synthiam.com/Community/Questions/6489
please look at this forum ..there is a video and some code. Please let me know if you need any other help.
look in the cloud storage for a Script Example Project called "JD vision"
Quick link to files https://synthiam.com/Community/EZCloud/RobotApps.aspx
Richard, it has been there right from beginning. I was actually looking for something like what bhouston commented.
@NYP.Shank_95 You mean you wanted one of us to write the code for you?.... Ok, but it is hard to learn when you just copy someone else's work... I always try to do something myself first. I don't like asking for help (because I feel like I am admitting defeat) but sometimes If I get really stuck I ask here as there are a lot of smarter guys on here than me...