Hi David,

Reading raw values won't give anything meaningful since it's an I2C sensor. 
Try out iCommand 0.5, which contains a new I2CSensor code as well as 
Ultrasonic (one relies on the other). getDistance() should work 100% of the 
time (make a program to loop and keep calling to give it a good test). The 
methods that return up to 8 bytes will work *most* of the time. The 
Ultrasonic sensor does a good job, but the Compass sensor was really poor 
and I had to override a method to read each byte individually, which slows 
down some of the method calls in the Compass class. I think Lego might patch 
their firmware with this eventually and these methods will become more 
reliable.

- Brian

----- Original Message ----- 
From: "David Schlangen" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, October 30, 2006 3:34 PM
Subject: [Lejos-discussion] Ultrasonic sensor in icommand 0.5


> Hi,
>
> I'm probably overlooking something very trivial, but even with the
> latest version of icommand pulled from the repository (0.5) I don't
> get any reliable readings from the ultrasonic sensor.
>
> From:
>     System.out.println("Sensor1 raw: " + Sensor.S1.readRawValue());
>     System.out.println("Sensor1 norm: " +
> Sensor.S1.readNormalizedValue());
>     Ultrasonic us = new Ultrasonic(Sensor.S1);
>     System.out.println("Dist: " + us.getDistance() );
>     System.out.println("ID: " + us.getId() );
>     System.out.println("type: " + us.getSensorType() );
>     System.out.println("scale fact: " + us.getScaleFactor() );
>
> all I get is:
> Sensor1 raw: 1023
> Sensor1 norm: 1023
> NXTCommand.LSGetStatus() error: Pending communication transaction in
> progress
> No bytes to be read in I2CSensor.getData(). Returning 0.
> Dist: 0
> ID: 0
> NXTCommand.LSGetStatus() error: Pending communication transaction in
> progress
> type: r
> NXTCommand.LSGetStatus() error: Pending communication transaction in
> progress
> scale fact: 255
>
> Note the weird response to getSensorType() . If I comment out
> getDistance(), I get the correct reply "Sonar" here. All this makes
> me suspect that something weird is going with lower level
> communication via bluetooth (not enough bytes read?). This is on Mac
> OS X, by the way.
>
> Anyone else having problems with this? Help would be much
> appreciated, because at the moment getting readings from the
> ultrasonic sensor is actually what's most important for me.
>
> Cheers,
> David.
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job 
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Lejos-discussion mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/lejos-discussion
> 


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Lejos-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lejos-discussion
  • ... David Schlangen
    • ... JAB , http : //www . juanantonio . info/p_research/robotics/robotics . htm
    • ... Brian Bagnall

Reply via email to