Robotc - Finding balls, grab and drop

I have to solve a problem with EV3, using language C with ROBOTC.

I am trying to find a ball in the field, grab it and drop in the triangle area. I’m using a ultrasonic sensor in front of the robot.

My solution for now is:

Turn 360 degrees and find the closest object. After finding the ball, I would like to drop it in the reserved area. That’s ok.

The big problem is:

How can I distinct the balls with the triangle area? After grabbing the ball, I need to drop in the trinagle.

How about the walls? How can I differentiate?

Steps: Turn 360 and find the closest ball. Go to the triangle. Drop it. Turn 360 and find the closest ball. And so on.

But with sonic sensor, I can’t distinct what’s the triangle area and balls.

Can you help me the best way?

It’s following the images:

foto mesa

1 Like

Um, I’m not sure that this belongs in the edr section. Find the ev3 category and place this topic there. Itll help you get more relevant answers. If that category doesn’t exist, then put vex IQ, since it’s the most similar, unless edr is the only place that robotc is listed as a subcategory
As for the solution, I’ve noticed that the triangular border is raised, so maybe you could use the ultrasonic detector to find that.
Keep in mind that with only a single sensor, an “adaptive” autonomous is next to impossible and or inconsistent

1 Like

If you really wanted to, it’s possible to give the robot odometry (it knows where it is using the last known position and the motion of the wheels), and then you could calculate if what you are seeing is a wall or a ball.
However, that is very complicated and probably beyond the scope of this forum for people to help you. You would have to do your own research.
Your problem is very difficult to solve, so if I were you I would find a way to relax the constraints of the problem. Maybe you introduce a colour sensor, or you make something physical that can differentiate between a wall or a ball.
To try to do this via programming would be a feat indeed.

3 Likes