Ultrasonic reading time,with icommand

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: roger, imaqine, 99jonathan

socrates
New User
Posts: 12
Joined: Sun Oct 28, 2007 7:36 pm

Ultrasonic reading time,with icommand

Postby socrates » Fri Nov 23, 2007 7:22 pm

It appears that the time it takes to get a ultrasonic sensor reading with icommand takes 100-200ms. Is that normal? Here's the code.

time = System.currentTimeMillis();
reading = sensor.getDistance();
logger.info("time "+ (System.currentTimeMillis()-time));

Is this due to the communication latency from the PC to the NXT?

Regards,
Rupert

User avatar
bbagnall
Site Admin
Posts: 392
Joined: Fri Aug 04, 2006 4:03 pm

Postby bbagnall » Thu Nov 29, 2007 6:39 pm

Yes, there's another workaround by using this command after open():
NXTCommand.setVerify(true);

I'll probably take a look at the UltrasonicSensor code soon and make it work more like the leJOS NXJ code (for upcoming 0.5 version) which has the timing issue worked out.


Return to “NXJ Software”

Who is online

Users browsing this forum: No registered users and 3 guests