problem with import lejoj.navigation.Pilot;

Post your NXJ projects, project ideas, etc here!

Moderators: 99jonathan, roger, imaqine

problem with import lejoj.navigation.Pilot;

Postby faheim » Thu Oct 14, 2010 1:01 pm

Hello
I found this code on http://lejos.sourceforge.net/nxt/nxj/tu ... hicles.htm on this address but there is some problem when I compile it, it gives an error that lejos.navigation does not exits. Any one has any idea, any kind of help will be appreciated.

CODE:

import lejos.nxt.*;
import lejos.navigation.Pilot;

/**
* Robot that stops if it hits something before it completes its travel.
*/
public class TravelTest {
Pilot pilot;
TouchSensor bump = new TouchSensor(SensorPort.S1);

public void go() {
pilot.travel(20, true);
while (pilot.isMoving()) {
if (bump.isPressed()) pilot.stop();
}
System.out.println(" "+pilot.getTravelDistance());
Button.ewaitForPress();
}

public static void main(String[] args) {
TravelTest traveler = new TravelTest();
traveler.pilot = new Pilot(2.25f, 5.5f, Motor.A, Motor,C);
traveler.go();
}
}


Thanks
Faheim
I am Faheim
faheim
New User
 
Posts: 6
Joined: Thu Oct 14, 2010 12:55 pm
Location: denmark

need help

Postby faheim » Fri Oct 15, 2010 12:41 pm

Any one please.
I am Faheim
faheim
New User
 
Posts: 6
Joined: Thu Oct 14, 2010 12:55 pm
Location: denmark

Postby gloomyandy » Fri Oct 15, 2010 1:01 pm

The structure of the API is still evolving (often quicker than the tutorial!). Have you tried looking at the API documentation here:
http://lejos.sourceforge.net/nxt/nxj/ap ... mmary.html
You may notice that Pilot is now in lejos.robotics.navigation. You may also notice that it is now an interface. So you probably need to change the code to use a class that actually implements that interface... Another look at the doc would suggest that TachoPilot may do the trick...
http://lejos.sourceforge.net/nxt/nxj/ap ... Pilot.html

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

Thanks Andy

Postby faheim » Sat Oct 16, 2010 5:33 pm

Hello
Thanks you so much Andy. It is compiling now without any problem I am posting a changed code.

import lejos.nxt.*;
import lejos.robotics.navigation.TachoPilot;

/**
* Robot that stops if it hits something before it completes its travel.
*/
public class TravelTest {
TachoPilot pilot;
TouchSensor bump = new TouchSensor(SensorPort.S1);

public void go() {
pilot.travel(30, true);
while (pilot.isMoving()) {
if (bump.isPressed())
pilot.stop();
}
System.out.println(" "+pilot.getTravelDistance());
Button.waitForPress();
}

public static void main(String[] args) {
TravelTest traveler = new TravelTest();
traveler.pilot = new TachoPilot(2.25f, 5.5f, Motor.A, Motor.B);
traveler.go();
}
}

once agian thankyou so much:-)
I am Faheim
faheim
New User
 
Posts: 6
Joined: Thu Oct 14, 2010 12:55 pm
Location: denmark


Return to NXJ Projects

Who is online

Users browsing this forum: No registered users and 1 guest

more stuff