Our team tried to make an automated sorting program to get rid of balls of the opposing alliance and eject balls of our alliance. We mounted an optical sensor on the side of the robot, near the middle of the rollers system. The program worked, but we ran into an issue where sometimes (about 40% of the time) the wrong colored ball gets carried up to the flywheel along with the correct colored balls. The problem might be that the rollers are too fast for the optical sensor to detect colors (they run at 600 rpm), but I wouldn’t want to reduce the rollers’ speed for it’s lost in cycle speed. What might I be able to do to combat this problem?
Are the balls close to the sensor when they roll up the flywheel? It might cause no light to enter the camera. This makes it unable to pick up color as all it sees is black. I know that’s one of the problems my team had. You can move it back.
There is about 1 inch of space between the ball and the sensor when the ball is carried up. There is also lighting from the sensor.
If your problem is that the balls move so fast that the sensor cannot detect the color of it as it rolls by, perhaps having multiple sensors spaced out along the path of the ball before the discarder could help with reliably capturing the color of the ball.
alternatively, moving your sensor further away might help it get a clearer image on a fast moving ball (I’m not sure since I’ve never used the optical sensor)
I would recommend figuring out WHY it isn’t working. RIght now it seems that your issues might be too fast or too far. I would recommend slowing down the motors to see if that improves your accuracy. If that doesn’t work, then try moving the sensor distance.
We had the same issue at the beginning (had our bottom rollers running at 1000rpm). We moved the sensor back and to the pooper so it would start viewing the balls as they came into the intake rather than as they moved through the intake.
I think I can help here. My team uses the optical sensor, along with a line sensor outside the ejector. For reference, our conveyor also spins at 600 rpm. There are a few key points that will make your sorting more consistent.
- Make sure the LED is on full power. This will help ensure consistent color readings.
- Don’t only check for color, check for distance. You only want to eject when the ball is right up against the sensor.
- Mount your sensor lower than the ejector, to allow for lag time. For us, this is about 4" before the ejector.
- Make sure you have an “endpoint” where the system knows it has ejected the ball. For us, this was in the form of a line sensor (ambient light sensor) that allowed us to know when a ball passed it.
I’m hesitant to share code, but if you need more guidance let me know and we’ll go from there.
Do you use the “gesture” method using the optical sensor or an additional sensor tracking distance?
Since the optical sensor has a distance sensor, I use: