7

I'm still new to NXT, I try to make the robot locate a ball using the ultrasonic sensor, while there I should be in a square area marked by white color.

How can I make the robot locate the object (by ultrasonic), stop, get the distance, then move until it stops exactly in contact with the object?

Here is my project

2 Answers 2

5

The ultrasonic cannot detect the color of objects. It's just to detect the distance between the sensor and an object in it's line of sight.

To find objects in the surrounding area of your robot you have to look all around. This is simply done by rotating your robot or your sensor. When you measure a distance in a certain range (best results between aprox. 10-50cm) you can stop rotating and you have your direction. Then you start to move and check for better results every 10cm or something like that again if you are still facing the right way.

Stoping exactly in contact won't be possible unless you can say I am Xcm away and now can move exactly Xcm in this direction since the ultrasonic sensor cannot measure distances below a certain level (around 5-10cm depending on the size/shape/material of your object).

2

Regarding the white square on the ground, the robot can not sense this using the ultrasonic sensor. This is because the ultrasonic sensor uses echolocation to navigate (hence the name "ultrasonic") If there is a white square on the ground such as a piece of paper which is essentially 2 dimensional, the sensor will not 'notice' the square. Try another method, perhaps using a 3 dimensional object, and a color sensor while you're at it.

Your Answer

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

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