Hi Myles,
> Thanks Brian for the additional information. When I use
> "NXTCommand.setVerify(true)", the ultrasonic sensor seems to work fine on
> a
> Mac. I managed to port my localization lab to icommand yesterday and
> everything seemed to work. (You can see the RCX-LeJOS version at
> http://www.mcs.alma.edu/LMICSE/LabMaterials/AI/MonteCarloLoc/MonteCarlo.htm
> - NXT version still to come.) So thanks again.
That's really cool stuff. Can't wait to see how the NXT performs without
being tethered to the IR port. If you are planning to use the
icommand.robotics.Navigation classes, they are not very reliable at the
moment since the tacho counts overshoot quite a bit. We're working on
getting more accuracy from the Motor class.
> However, the getDistance command doesn't work without
> "NXTCommand.setVerify(true)". I did try to the for loop idea, and all I
> get
> are error messages and returned values of zero. So obviously there are
> some Mac-related issues there. But with "setVerify" I am all good for
> now...
Can you try this code and paste the results here:
import icommand.nxtcomm.NXTCommand;
import icommand.platform.nxt.Sensor;
import icommand.platform.nxt.Ultrasonic;
/**
* Outputs some data from an Ultrasonic sensor in port 1.
*
* @author BB
*
*/
public class DistanceTest {
public static void main(String[] args) {
NXTCommand.open();
//NXTCommand.setVerify(true);
Ultrasonic us = new Ultrasonic(Sensor.S1);
System.out.println("Version: " + us.getVersion());
System.out.println("Product ID: " + us.getProductID());
System.out.println("Sensor Type: " + us.getSensorType());
System.out.println("Measurement Interval: "
+ us.getMeasurementInterval());
for(int i=0;i<10;i++)
System.out.println("Distance: " + us.getDistance());
System.out.println("Factory scale factor: "
+ us.getFactoryScaleFactor());
System.out.println("Factory scale divisor: "
+ us.getFactoryScaleDivisor());
byte[] distances = us.getDistances();
for (int i = 0; i < distances.length; i++)
System.out.println("Distance " + i + " = " + distances[i]);
NXTCommand.close();
}
}
- Brian
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Lejos-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lejos-discussion