Take the 2-minute tour ×
LEGO® Answers is a question and answer site for LEGO® and building block enthusiasts. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers

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.

share|improve this answer
add comment

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).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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