Tacho Navigator

Post your NXJ projects, project ideas, etc here!

Moderators: 99jonathan, roger, imaqine

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();
               }


   }

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

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
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3645
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

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
westes
New User
 
Posts: 21
Joined: Wed Jul 22, 2009 12:38 am

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
User avatar
gloomyandy
leJOS Team Member
 
Posts: 3645
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

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

Does simple navigator do the same as tacho navigator?
westes
New User
 
Posts: 21
Joined: Wed Jul 22, 2009 12:38 am

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

Yes, it does.
lawrie
leJOS Team Member
 
Posts: 842
Joined: Mon Feb 05, 2007 1:27 pm


Return to NXJ Projects

Who is online

Users browsing this forum: Google [Bot] and 1 guest

more stuff