# Different ways to automate sorting

Hey guys, i was just posting this to ask around about different ways to automate sorting balls without using a vision sensor. What ways do you guys think would be effective?

Just to confirm i mean sorting different coloured balls inside a hood of a hoodbot

A line follower is a very nice tool to determine the color of items that pass from a fixed area and point, but one thing that I have struggled with is the differences of light at home vs in competition. But I have a theory to determine the color of an object in different conditions.

I havenâ€™t tried this before but I am thinking that if you use a line follower then you can have a random light sensor as well facing upwards on the top of the robot to track the current lighting condition. Then you change the light conditions and the line followerâ€™s value from that condition to develop an equation that you would utilize to adapt to the lighting conditions.

Considering that we dont have to be complex with this, we can just do a linear equation and it would be just fine. So if we have LF value be 1000 at LS value of 100, then LF value of 1250 at LS value of 150 with a red ball, we can get the slope by this equation:

Y - Y(1) = m(X - X(1))

1250 - 1000 = m(150 - 100)

Slope = 5

So then we can apply it with:

``int LFTuned = 5 * (LS - 100) * LF``

Or

``````int Y1 = 1000;
int Y2 = 1250;
int X1 = 100;
int X2 = 150;

int Slope = (Y1 - Y2)/(X1 - X2);
int LFTuned = Slope * (LS - X1)  * LF;``````

Then you can use simple if statements to reliably determine what color a ball is:

``````if (LFTuned > 1500){
//isBlue
}
else if (LFTuned > 1700){
//isRed
}``````
14 Likes

Thank you, I will definitely test this out

1 Like

Although I think this is a great idea, Iâ€™ve heard from many people that using a line tracker to detect different colors is really unreliable (especially since youâ€™re trying to detect moving spheres).

I have run some extensive testing using the line sensor to detect the color of TP caps (since I did not have the balls at the time) and it is not something that I would want to depend on. The reflective values where not far apart enough for me to feel comfortable with using the line sensor in differing light conditions. Even when I assigned a higher priority to values closest to what I tested to be the red and blue reflectivity the results simply were not accurate enough to detect which color an object was without some very specific light settings. However something I noticed was that when a red light source was being used the difference between the values for red and blue increased significantly. I was going to run some more tests with light filters but I stopped one the color sensor announcement was made.

3 Likes

The lighting issues I had were not really from varying lighting conditions it was from shadows and not having a bright enough light to actually reflect anything. Ambient lighting did not throw enough light onto the game elements to actually differentiate between the colors. If you were to attempt this I highly recommend not taking an instantaneous measurement of the light values and instead averaging them over the entire period of time that the ball is in range of the sensor.

4 Likes

I have tried using both line trackers and visions sensors to tell the difference between the ball colors. line tracker didnâ€™t really work at all for me, the values from the blue balls were pretty much the same as the red ones. and the vision sensor only works in really good lighting conditions, otherwise its basically a black and white camera. and my roomâ€™s lighting with all the lights on and windows open is about the same as youâ€™d find in most competitions, so I donâ€™t want to rely on that. idk what else you could use though.

5 Likes

If youâ€™re willing to wait a few months, the V5 Optical Sensor will hopefully work pretty well.

25 Likes

Ships in 8 weeks

5 Likes

8â€¦ weeks? As it is still a product in development, I would plan forâ€¦ 8 monthsâ€¦ If you are luckyâ€¦

1 Like

Realistically we wonâ€™t get until very late season, maybe not until worldsâ€¦

1 Like

Or next yearâ€¦

Yeah realistically I wouldnâ€™t plan on using it for change upâ€¦

1 Like

Lol. My original plan WAS going to have a program that auto-sorted the ballsâ€¦

Well Q3 begins on July 1st and ends in September and based on how well they shipped out inertial sensors iâ€™m pretty sure that you will be able to use these sensors for the majority of the competition season and definitely for state championships.

9 Likes

how about using the vex LEDs to increase the light inside the hood? would that be viable?

1 Like

Are the vex LEDs bright enough? You could also the red ones so the red balls reflect more of the light.

i dont know, dont have them yet

I mean that could work but like I said you need a ton of light. In order to get decent results I had to surround the line sensor on all sides with my own led strip.

1 Like