Programming a Vision Sensor

Hello!
Our team started programming with VCS about two months ago and we wanted to explore sensors. We now have a vision sensor and we are trying to make the robot position itself in front of a flag, for example, or follow a ball. We’ve only started this week and we’re noticing that the camera will pick up on everything: we wanted it to follow a green rectangle and if we removed it from its view, it would still continue moving in every direction. The camera is too sensitive to lighting and to different environements. Is there a way to improve the accuracy in identifying the right objects.
Also, I was wondering what the whole code part in the vision sensor configuration is.
Thank you
Capture d’écran (68).png

I’m not sure what to say about the sensitivity issues… our team is in early exploration of the vision sensor, and have not seen those issues yet. The codes are combinations of signals. For example: REDBLOB, GREENBLOB would be a red flag. REDBLOB, BLUEBLOB would be a cap (although its pretty optimistic for the sensor to pick up both colors in bad lighting.) You can also type in 1,3 in the code field, and the utility will fill in the signal name for signals 1 and 3 for you. The order of the signal is not important – only that two+ colors combined are identified as a single object.

That screen shot doesn’t look too good, something is not happy and the vision utility has messed up the layout somehow, what OS are you running ?

I am having the same problem, even after I adjust sensitivity and brightness of the vision sensor/specific object, and I run some code, the object count is 0.

Did you make sure that you are telling the robot to stop moving after it no longer detects an object? Otherwise the motors will continue to run.

PROS allows for manual setting of the sensor’s White Balance, Exposure, and Zero Point, consider swapping to PROS to try these features if you really need vision.

I found that the easiest way for me to get consistent readings were half brightness in the vision utility, and putting the color to scan filling up the camera’s vision, freezing the camera, and then selecting it, worked well with flags.

Also try putting some sort of background behind the field for more consistent readings.

Codes are for reading specific object types. Not entirely sure how well they work.

I had some wierd issues using codes. I would get useless object counts for some reason, either zero or occassionally one. It showed them tracking in the vision utility, but nothing worked on my program for some reason. As soon as a switched to just using the red and blue color signitures everything worked as expected. I suspect I was configuring something wrong, but it’s worthwhile trying just signitures instead of codes.

@jpearman I’m using Windows 10.

@AidanM_1356 We did tell the robot to stop after but I think we found our issue. We’re going to add codes so that the robot will only detect flags and not everything that’s green or red.
We’ll continue using VCS because we’re preparing for regionals and we’re too far along to change now but thank you for the suggestion!

Does someone have a more detailed VCS program with their vision sensor? I’m trying to use codes but now, the sensor doesn’t even detect the object anymore…

Does your vision sensor work if you use signitures instead of codes?

@R47 It works with signatures. So should I just use signatures then? What’s the point of codes then?

Codes should work better than signitures, in theory, as the objects they would filter out tracking unwanted objects and only lock onto flags, as they could see both the red and green for example, and only return that data, and not unwanted data, such as opponent liscence plates. For some reason, though, I could not for the life of me get color codes to return proper data from the sensor in my program. They worked perfectly in the vision sensor utility, and I could see the color codes being displayed, but object count was always zero or randomly 1 in my program. I spent months wondering if something was wrong with my code, but everything works perfect now that I switched to signitures. I suspect there must be some way to properly configure codes, but I haven’t been able to figure it out, so for the time being until I see a way to configure them I’m sticking with signitures.

@R47 Thank you for sharing this, I’ll stick to signatures until I find the right way to use color codes. If I do find the solution, I’ll let you know.