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

enter image description here

My current solution for locating the ball is: Turn 360 degrees and find the closest object. This part works.

After obtaining the ball it needs to be dropped in the reserved triangular area. What can I do to make the sonic sensor distinguish between the ball, walls, and the triangular drop area?

  • Are you limited to only the ultrasonic sensor on your robot?
    – JohnnyB
    Commented Aug 25, 2019 at 8:45

1 Answer 1


It's been quite a while since I've programmed a robot, but using only the sonic sensor does make it a bit more challenging. Also, not knowing anything else about the robot you've built (it's size, other sensors & their location, the ball grabbing mechanism, etc.) it further complicates any possible advice.

That being said, the only solution I could think of would be to use the opening/doorway to the room as a reference point for the robot. The sensor should be able to locate it since it's "open", and the robot sent towards it. The line on the ramp leads me to believe your robot has a color sensor for line following, therefore should be able to detect the line at the doorway once it arrives. This will also allow the robot to "true" its location, which would allow rotating "x" degrees to have you pointing directly at the drop-off point. Then straight forward and (?) because I have no idea how your robot even picks the balls up or drops them.

My other solution would be to have a mechanical release lever for the ball. The lever would be positioned so only the low wall of the triangle could push it. This would be a much more simple solution in theory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.