Our team recently debuted a new robot design utilizing a color sensor to sort rings as they are picked up off the floor. The robot performed nearly flawlessly in our robotics room in our basement. It also sorted well on our practice field at yesterday’s competition. However, during the actual matches (in a school gymnasium), the lighting threw off the readings, and the sensor often malfunctioned, putting the green rings on the robot’s blue scoring post. Red seemed consistent. Blue seemed consistent. It was often the green getting mixed up with the blues. The program is in three color mode. Before the competition we added a second color sensor set in gray scale and used as a light, hoping that would help prevent shadows and problems. But the robot still had problems! Any tips or suggestions? Some of the other teams competing suggested using a color sensor in 12 color mode measuring the ‘hue’ rather than ‘ambient’ readings. One also suggested putting in a repeat ‘block’ in the program to take multiple readings before registering the color based on the one with the most readings. Any tips, ideas or suggestions? Thank you!
I always say have it display output to the screen so you can see what it’s registering.
Also… check the distance from the sensor to the ring.
@turbodog Thanks! We have already implemented those ideas… Will keep trying. LMK if you have any other suggestions!
You need some way at the beginning of the program to calibrate the sensors. One of my groups has it detect maximum and minimum values before they run the program. The average value form white to black is the cut off.
You need to do that for each color. It will take a second before each match but it should do the trick.
In ROBOTC, I have always had much better results with the sensor in reflective mode, that is to say forcing the LED to be on so everything is matched against a consistent dominant light source.
I’ll generally use the hue values and calibrate an upper and lower threshold for each colour.
In Modkit, I can’t remember if you can use reflective mode (I don’t think you can) but you can get the hue value which would allow your programmer to calibrate an upper and lower threshold for each colour which would give them a bit more flexibility. They might need to check these upper and lower thresholds at each event and make adjustments depending on the lighting.
So for example (using made up numbers):
Red gives you a hue value of between 0 and 20
Green gives you a hue value of between 100 and 150
Blue gives you a hue value of between 200 and 250
You can then look for values > lower threshold but < upper threshold for each colour,
Can you do that in ROBOTC Graphical? Using graphical with the variables you can do just about everything but that. Adding another sensor to get the light is alot easier than getting the kids comfortable with text.
@sankeydd I don’t think so, but you can work round it by creating a base graphical file and saving it. Then edit it in notepad and just add a line in to set the colour sensor mode
Your students could then use that as a template to carry on the program in graphical.
For me In ModKit, I added two sensors one for just light by keeping it on grayscale. other on 3 color to sort ring on the belt. but accuracy is very low. Do you suggest to use gray scale instead of 3 color for ring master to sort moving ring.?
There a hue ranges for the different rings. You can filter on that.