Ultrasonic Issues

Post your NXJ projects, project ideas, etc here!

Moderators: roger, imaqine, 99jonathan

Vandiver247
New User
Posts: 1
Joined: Fri Mar 04, 2011 5:20 pm

Ultrasonic Issues

Postby Vandiver247 » Fri Mar 04, 2011 5:24 pm

So I'm currently working on a robot for the TCEA state robotics competition. I am having a problem that I was wondering if anyone could help me on. I'm trying to program my Ultrasonic Sensor to stop the robot if it detects it is too close to an object. The issue I'm running into is that when I test the sensor using the getDistance() method, it keeps returning as 255 even if I put it literally right next to the wall. Any ideas?

User avatar
gloomyandy
leJOS Team Member
Posts: 4418
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby gloomyandy » Fri Mar 04, 2011 6:46 pm

You may need an updated classes.jar. See this thread...
viewtopic.php?t=1883

Andy

s.frings
Active User
Posts: 131
Joined: Tue Jul 20, 2010 2:01 pm

Postby s.frings » Fri Mar 04, 2011 6:49 pm

With the older classes.jar from Lejos 0.8.5, the sensor does not work in Port 4.

The ultrasonic sensor fails to work if you query it too quickly. Wait 200ms between each query.

Also ensure that the distance to the next wall is less than 200cm during startup, since the automatic calibration might faile otherweise.

In my living room, the sensor returns very often random values, but in other rooms it works fine. I assume that the sensor is very sensitive to multiple reflections because my other sensor (SRF-02) works more stable in that room.


Return to “NXJ Projects”

Who is online

Users browsing this forum: No registered users and 1 guest