Navigator / Pose don't work together

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

Moderators: roger, 99jonathan, imaqine

Navigator / Pose don't work together

Postby ak2012 » Mon Feb 18, 2013 2:18 pm

Hello everybody,

coming from my previous posts (#1 & #2) I managed to create a working method to find the tin cans of my robot and correct the heading angles, so the robot really "hits" the tin cans in most cases.

Now I want to use a navigator to let the robot drive to a certain location and bring the collected can there.

I'm using a navigator class, I construct in a sub-method which is simplified in this bit of code (I left out all my debugging stuff and so on).

Code: Select all
Navigator navigator = new Navigator(pilot);
navigator.goTo(50,50);
navigator.waitForStop();
pose = opp.getPose();


Now, the thing is, that navigator does not pilot the robot to the mentioned point 50,50 but somewhere else.
I drew a grid on my floor and extracted the different robot locations through the debugging console and compared the locations. The console values match the real values.

Code: Select all
driveToDestination()
# Current position
X:38.12924 Y:-22.02335 H:-30.01062
# Current waypont of navigator
Point2D.Float[50.0, 50.0]
# Position after navigator.waitForStop()
X:106.4106 Y:-3.598501 H:14.71859


Why does the navigator not pilot the robot to 50,50.

I also tried out to use the navigator.getPoseProvider(); and navigator.clearPath(); commands directly after constructing the navigator, but somehow it doesn't work out that the robot drives to 50,50 but ends up in another place.

Could you again help me out to get further!
Thank you in advance!
Best, Aron
ak2012
New User
 
Posts: 7
Joined: Sat Feb 02, 2013 9:01 pm

Re: Navigator / Pose don't work together

Postby roger » Tue Feb 19, 2013 9:34 pm

Hi Aron,
When I run this
Code: Select all
   public  static void main(String[] arga)
   {
      DifferentialPilot pilot = new DifferentialPilot(5.6,14, Motor.A, Motor.C);
      Navigator nav = new Navigator(pilot);
      OdometryPoseProvider opp =  (OdometryPoseProvider) nav.getPoseProvider();
      new DifferentialPilot(5.6,13.9, Motor.A, Motor.C);
      nav.goTo(new Waypoint(50,50));
      nav.waitForStop();   
      Pose pose = opp.getPose();
      System.out.println(""+pose)   ;
      Button.waitForAnyPress();   
   }
the reported pose is within 1/10 of a cm of the target. You might want run this test to verify that the Lejos classes are working correctly.
Roger
roger
Moderator
 
Posts: 308
Joined: Fri Jun 01, 2007 4:31 am
Location: Berkeley, CA

Re: Navigator / Pose don't work together

Postby ak2012 » Wed Feb 20, 2013 11:34 am

Hi roger,

we also ran some tests and noticed that the navigator does not account for the current pose of the robot.
It just takes the current pose as "relative" 0 | 0 with 0° heading and moves to 50 | 50 from this position.

How do I transmit the current pose (which is correct) to the navigator?

Thank you again!
Best,
Aron


// I found this: http://lejos.sourceforge.net/p_technolo ... tion(float, float, float)
But I cannot call this method on my Navigator object. Can you see why?


/// I'm a moron ... ;-)

http://lejos.sourceforge.net/nxt/nxj/ap ... seProvider)
So in my case navigator.setPoseProvider(opp); did the trick.
Thanks for the effort still!
ak2012
New User
 
Posts: 7
Joined: Sat Feb 02, 2013 9:01 pm

Re: Navigator / Pose don't work together

Postby roger » Wed Feb 20, 2013 4:02 pm

the navigator does not account for the current pose of the robot.

How do I transmit the current pose (which is correct) to the navigator?

It's not the Navigator that maintains the pose, but the PoseProvider. It listens to the pilot and uses the move data provided by the pilot when a move starts or ends for the update. The Navigator gets a pose from the PoseProvider whenever it needs it. Look at methods for PoseProvider to find out to set the initial pose.
Roger
roger
Moderator
 
Posts: 308
Joined: Fri Jun 01, 2007 4:31 am
Location: Berkeley, CA

Re: Navigator / Pose don't work together

Postby roger » Wed Feb 20, 2013 4:07 pm

PS All this is explained in the tutorial "Controlling Wheeled Vehicles"
roger
Moderator
 
Posts: 308
Joined: Fri Jun 01, 2007 4:31 am
Location: Berkeley, CA

Re: Navigator / Pose don't work together

Postby Gosthrizo » Mon Apr 01, 2013 4:46 pm

roger wrote:PS All this is explained in the tutorial "Controlling Wheeled Vehicles"


You can leave me the link of this tutorial "Controlling Wheeled Vehicles" plz.

Thanks
Gosthrizo
New User
 
Posts: 6
Joined: Thu Mar 28, 2013 5:40 pm

Re: Navigator / Pose don't work together

Postby gloomyandy » Mon Apr 01, 2013 5:33 pm

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

Re: Navigator / Pose don't work together

Postby Gosthrizo » Mon Apr 01, 2013 6:10 pm

thanks :D
gloomyandy wrote:It is part of the leJOS tutorial...
http://lejos.sourceforge.net/nxt/nxj/tu ... hicles.htm
Gosthrizo
New User
 
Posts: 6
Joined: Thu Mar 28, 2013 5:40 pm


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 4 guests

more stuff