I use it and it works quite well.
I don't know what kind of test-program you mean, this is a very simple
one (maybe too simple :-) )
// Class Test:
import lejos.navigation.TachoNavigator;
import lejos.nxt.Motor;
import lejos.nxt.Button;
public class Test
{
public static void main (String[] aArg)
throws Exception
{
TachoNavigator tacho=new TachoNavigator(5.6F,12F,Motor.B,Motor.A);
Display display=new Display(tacho);
tacho.setSpeed(500);
while(true)
{
tacho.forward();
Thread.sleep(500);
tacho.stop();
display.dis();
Button.ENTER.waitForPressAndRelease();
tacho.rotate(90);
display.dis();
Button.ENTER.waitForPressAndRelease();
}
}
}
// Class Display:
import lejos.navigation.TachoNavigator;
import lejos.nxt.LCD;
public class Display
{
String getx = "getx:";
String gety = "gety:";
String geta = "geta:";
TachoNavigator tacho;
public Display(TachoNavigator tacho)
{
this.tacho=tacho;
}
public void dis()
{
LCD.clear();
LCD.drawString(getx,0,1);
LCD.drawString(gety,0,2);
LCD.drawString(geta,0,3);
LCD.drawInt((int)tacho.getX(),7,1);
LCD.drawInt((int)tacho.getY(),7,2);
LCD.drawInt((int)tacho.getAngle(),7,3);
LCD.refresh();
}
}
This program makes the robot move forward during 500 milliseconds, stop,
wait for the user to press and release the ENTER button (orange). Then
it makes the robot turn 90 degrees and wait again for the user to press
the button. After each translation or rotation, the screen displays the
position and orientation of the robot. After 4 cycles, the path of the
robot should be a square and the robot should be back to the initial
position.
Hope it helps,
Emmanuel
Michael Wiedau wrote :
> Hi,
>
> can anyone tell me if the TachoNavigator Class in lejos.navigation
> works already?
> Has anyone a simple Test-Program?
>
> thx
> Michael
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Lejos-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lejos-discussion