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

leJOS Navigation: Mapping

This is the fifth in a series of posts on leJOS navigation.

The first covered moving robot around using pilots, the second covered localization and pose providers, the third covered object detection and the fourth waypoint navigation.

This post covers how to produce a static map the environment you are using for navigation. Such maps are needed for various navigation capabilities, including path finding and Monte Carlo Localization.

The maps that leJOS uses for these purposes need to support the RangeMap interface.

The only current implementation of this is LineMap, which is a map consisting of a set of line segments.

You can produce a line map by hand but it is easier to use an editor to produce the map. leJOS includes two map loaders to produce a line map from the output of an editor. SVGMapLoader creates a line map from a .svg file. There are many SVG editors around, including online ones such as svg-edit. Note that the only the line elements in the .svg file are used to produce the line map. Anything else is ignored. You should use the line tool for creating lines.The y co-ordinate in svg files increases down the screen, which is the opposite convention to leJOS navigation. LineMap has a flip method to cope with this. Making 1 pixel represent 1 cm produces reasonable sized maps for most indoor environments.

Here is a very simple svg map of part of a room:

<svg width="132.0" height="340.0" xmlns="http://www.w3.org/2000/svg">
<g>
<line stroke="#000000" x1="32.0" x2="32.0" y1="0.0" y2="88.0"/>
<line stroke="#000000" x1="32.0" x2="0.0" y1="88.0" y2="88.0"/>
<line stroke="#000000" x1="0.0" x2="0.0" y1="88.0" y2="340.0"/>
<line stroke="#000000" x1="0.0" x2="95.0" y1="340.0" y2="340.0"/>
<line stroke="#000000" x1="95.0" x2="95.0" y1="340.0" y2="294.0"/>
<line stroke="#000000" x1="95.0" x2="132.0" y1="294.0" y2="294.0"/>
<line stroke="#000000" x1="132.0" x2="132.0" y1="294.0" y2="0.0"/>
<line stroke="#000000" x1="132.0" x2="32.0" y1="0.0" y2="0.0"/>
</g>
</svg>

There is also ShapefileLoader which creates a line map from a Shapefile using either polygons or polylines.

Advertisements

Discussion

One thought on “leJOS Navigation: Mapping

  1. You started so well, what happened?

    Posted by Nick Thompson | 2016/04/12, 10:44

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

You are commenting using your Google+ 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: