you're reading...
leJOS Features, Moving around

leJOS Navigation: Waypoint Navigator

This is the fourth in a series of posts about leJOS navigation.

The first dealt with moving the robot around using pilots, the second with finding out the robot’s location and heading using pose providers, and the third with detecting obstacles and other objects.

This post deals with navigating using co-ordinates including following a series of waypoints.

This is achieved using the Navigator class.

You create a navigator, by first creating a pilot and supplying the pilot object to the Navigator constructor. You can also, optionally, supply a pose provider, with OdometryPoseProvider being used if you don’t.

The pilot allows the navigator to move the robot around, and the pose provider allows it to keep track of its (x,y) location and its heading. You can still move the robot around using the pilot, and the co-ordinates will be updated, but the navigator adds new ways to move the robot around.

The most basic method that the Navigator adds is goTo. There are several variants of goTo, but they all supply either the point or the pose to go to. If a pose is supply, the heading of the robot when it reaches its destination is defined. Often you will not be concerned about which way the robot is heading when it reaches its destination, but for some applications it is important.

The goTo method drives the robot to its destination by the most direct route ignoring obstacles, maps, etc. If you want to take these things into account you need to follow a path using waypoints as described below.

The most direct route to the destination is not always a straight line, however. This is because some robots cannot turn on the spot and go in a straight line to the destination. If a robot has car steering, it needs to follow a curved path to get to the destination. For this reason the navigator takes into account the capabilities of its pilot, and in particular whether the pilot implements RotateMoveController or ArcMoveController. The class ArcAlgorithms is used to calculate paths for robots with car steering.

Another method that Navigaor supports it rotateTo, which allows you to rotate the robot to s specific heading, provided that the pilot supports RotateMoveController. Note that the pilot cannot do his as it does not understand co-ordinates or absolute headings (just relative ones).

When you cannot go directly to a destination because there are obstacles in the way, or there is no road leading there, you need to follow a path. In a later post in this series we will look at path finders, which calculate a path for you. For the moment, we will look at manually specifying a path.

A Path consists of a series of waypoints represented by the Waypoint class. A Waypoint is basicalliy a point or a pose. If it is a pose the heading is defined when you reach the waypoint, otherwise not.

There are several ways of specifying the waypoints to follow. You can add them one at a time using one of the addWaypoint methods or you can specify a complete path to the followPath method. If you add them one at a time, you need to use the parameterless followPath() method to start the robot following the manually created path.

The navigator can follow a pre-created path, but it also allows the path to be generated as you move by adding new waypoints to it. This would be needed for a robot executing a SLAM algorithm and finding a path as it as its environment.

As the robot progresses allow its path to each waypoint, you may want to do some action as each waypoint is reached, or when the destination is reached. You can add a NavigationListener to you navigator to achieve this.



No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

About leJOS News

leJOS News keeps you up-to-date with leJOS. It features latest news, explains cool features, shows advanced techniques and highlights amazing projects. Be sure to subscribe to leJOS News and never miss an article again. Best of all, subscription is free!
Follow leJOS News on WordPress.com
%d bloggers like this: