Basic questions about Pilot, Pose & Navigation

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: roger, 99jonathan, imaqine

Basic questions about Pilot, Pose & Navigation

Postby ak2012 » Sat Feb 02, 2013 9:29 pm

Hello everybody,

I'm working on a school project with NXT and leJOS.
So far I used the DifferentialPilot class to control the movements of my robot.
Does this class automatically update the robot location which I could access with the Pose class or do I have to use the OdometryPoseProvider class?
I found this in the API:

It automatically updates a OdometryPoseProvider which has called the addMoveListener method on this object.


Or do I have to use the TachoNavigator class and use the updatePosition() method everytime manually?

I am a little bit confused with all the information in the API and all the different methods that can control the robot and update positioning information and which classes / methods work with each other.

Thank you guys in advance!
Best
Aron
ak2012
New User
 
Posts: 7
Joined: Sat Feb 02, 2013 9:01 pm

Re: Basic questions about Pilot, Pose & Navigation

Postby roger » Mon Feb 04, 2013 7:44 am

You are correct: you use the OdometryPoseProvider to keep the robot pose updated. The DifferentialPilot does not do the update, but it informs the OdometryPoseProvider every time it completes a movement. This is how the automatic update happens. The OdometryPoseProvider will also return an update pose whenever getPose() is called as stated in the javadocs for this class.
There are two ways to establish the link between the two objects. After you have created your Differential Pilot, pass it in the constructor of the DifferentialPoseProvider. Alternatively, create both objects then call addMovementListener() on the DifferentialPilot.
AFIK, the TachoNavigator class is obsolete, and it does not appear in the latest Lejos API documentation. BTW, you might want to look at the documentation for the Navigator .
Roger
roger
Moderator
 
Posts: 308
Joined: Fri Jun 01, 2007 4:31 am
Location: Berkeley, CA

Re: Basic questions about Pilot, Pose & Navigation

Postby ak2012 » Mon Feb 04, 2013 5:32 pm

Hi Roger, thank you for your reply!
I implemented the code and going to test it at the end of the week. I don't have access to our NXT at the moment unfortunately.


Code: Select all
public class AK2012 {

   private final DifferentialPilot pilot;
   private final OdometryPoseProvider opp;
   private final Pose pose;

   public AK2012() {
      // Create pilot & with pose provider
      final double wheelDiameter = 4.32;
      final double trackWidth = 11.3;
      pilot = new DifferentialPilot(wheelDiameter, trackWidth, Motor.A, Motor.B, false);
      opp = new OdometryPoseProvider(pilot);
      pose = opp.getPose();
      
   }
}
ak2012
New User
 
Posts: 7
Joined: Sat Feb 02, 2013 9:01 pm


Return to NXJ Software

Who is online

Users browsing this forum: Google [Bot], pcProfie and 2 guests

more stuff