Tacho Navigator

Post your NXJ projects, project ideas, etc here!

Moderators: roger, imaqine, 99jonathan

westes
New User
Posts: 21
Joined: Wed Jul 22, 2009 12:38 am

Tacho Navigator

Postby westes » Thu Jul 23, 2009 4:08 pm

I get a error with eclipese when importing lejos.navagation.TachoNavigator.

The error is : The import lejos.navigation.TachoNavigator conflicts with a type defined in the same file.

My code is below:

Code: Select all

import lejos.navigation.TachoNavigator;
import lejos.nxt.Button;
import lejos.nxt.Motor;



public class TachoNavigator {


   public static void main(String[] args) {
      
            TachoNavigator tacho=new TachoNavigator(5.6F,12F,Motor.B,Motor.A);
             
               tacho.setSpeed(500);
      
               while(true)
               {
                   tacho.forward();
                   tacho.stop();
                   Button.ENTER.waitForPressAndRelease();
                   tacho.rotate(90);
                   Button.ENTER.waitForPressAndRelease();
               }


   }

}

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

Postby gloomyandy » Thu Jul 23, 2009 4:15 pm

Hi,
The clue is in the error message. You have already defined a class called TachoNavigator (your own public class), so this will now clash with the imported version from the leJOS class files. To fix it call your class something other than TachoNavigator....

Andy

westes
New User
Posts: 21
Joined: Wed Jul 22, 2009 12:38 am

Postby westes » Thu Jul 23, 2009 4:21 pm

Thanks! I only had a two week course on java and learned a lot but not everything. :D

westes
New User
Posts: 21
Joined: Wed Jul 22, 2009 12:38 am

Postby westes » Thu Jul 23, 2009 4:24 pm

I have warnings now.
The import gives me this warning:
The type TachoNavigator is deprecated

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

Postby gloomyandy » Thu Jul 23, 2009 4:27 pm

Hi,
Yes this class has been replaced and is no longer recommended for us in new code. You can use SimpleNavigaotr instead. Take a look at the leJOS API documentation...
http://lejos.sourceforge.net/nxt/nxj/api/lejos/navigation/TachoNavigator.html

Andy

westes
New User
Posts: 21
Joined: Wed Jul 22, 2009 12:38 am

Postby westes » Thu Jul 23, 2009 4:29 pm

Does simple navigator do the same as tacho navigator?

lawrie
leJOS Team Member
Posts: 960
Joined: Mon Feb 05, 2007 1:27 pm

Postby lawrie » Thu Jul 23, 2009 8:13 pm

Yes, it does.


Return to “NXJ Projects”

Who is online

Users browsing this forum: No registered users and 1 guest