Library to manage the map

This libary implements a discrete map use wich can be use in robotics. More...
The features are:

Shared Memory Map

There are two important methods to acces to the shared map. Before using shmap, it should be init by the function ShmapInit(). After finishing using it the shmap should be clear by ShmapFree().
Warning:
If the program exit without a ShmapFree(), the memory will stay in Linux SHM. You can verify it with command "ipcs -m". For further details, read shm documentation.

The map

The real space

The map size is (MAP_PLAYGROUND_WIDTH_MM x MAP_MAP_PLAYGROUND_HEIGHT_MM). This space discretization is explained in section The discrete Map .
                                0                                       MAP_PLAYGROUND_WIDTH_MM
 MAP_PLAYGROUND_HEIGHT_MM       +---------------------------------------+
                                |                                       |
                                |                                       |
                                |                                       |
                                |                                       |
                                |                                       |
                                |                                       |
                                |                                       |
                                |                                       |
                                |                                       |
                                |                                       |
                                |                                       |
                                |                                       |
                                |                                       |
                                |                                       |
                                |                                       |
                           y=0  +---------------------------------------+ 0
                               x=0                                      MAP_PLAYGROUND_WIDTH_MM

The discrete Map

Map library uses a discrete representation of the space. This representation has been implemented as a cell grid (matrix). Each cell (pixel) is represents MAP_CELL_SIZE mm square. We can consider a cell as a set of points. All the points of a cell have the same value that the cell. The origin is located in up left corner.
                                X 0   1   2   3   4   5   6   7   8   MAP_WIDTH-1
                              Y +---+---+---+---+---+---+---+---+---+---+
                              0 |0,0|   |   |   |   |   |   |   |   |   |
                                +---+---+---+---+---+---+---+---+---+---+
                              1 |   |   |   |   |   |   |   |   |   |   |
                                +---+---+---+---+---+---+---+---+---+---+
                                |   |   |   |   |   |   |   |   |   |   |
                                +---+---+---+---+---+---+---+---+---+---+
                                |   |   |   |   |   |   |   |   |   |   |
                                +---+---+---+---+---+---+---+---+---+---+
                                |   |   |   |   |   |   |   |   |   |   |
                                +---+---+---+---+---+---+---+---+---+---+
                                |   |   |   |   |   |   |   |   |   |   |
                                +---+---+---+---+---+---+---+---+---+---+
                                |   |   |   |   |   |   |   |   |   |   |
                                +---+---+---+---+---+---+---+---+---+---+
                                |   |   |   |   |   |   |   |   |   |   |
                                +---+---+---+---+---+---+---+---+---+---+
                                MAP_HEIGHT-1
Note:
Matrix convention is usally (row, column). In this program the convention will be (column, row) in order to keep real coordonates relation. C language stockes matrix in rows, so a cell coordonate (x,y) will be in a C matrix [y][x].

Map Content

Each cell/point of the map (MapCell) contains two types of information:

Map Values

This information is of the type MapCellValue.The value that the map contains can be:

One special type is MAP_NOT_IN_MAP. It is a error code return when we try to acces to a space wich is not in the map. (i.e. the request cell/point exceeds map dimensions.)

Note:
The configuration space is a special obstacle type that depends on the geometry of the robot. For more information, read a book about robotics.

Cell Flags

The possible cell flags are:

Accessing to map information

To read and write cell values, use functions ShmapGetCellValue() and ShmapSetCellValue(). If you want to acces directly to points, you can also use ShmapGetPointValue() and ShmapSetPointValue(). There are similar functions to get and set flags: ShmapGetCellFlag() and ShmapSetCellFlag(), ShmapGetPointValue() and ShmapSetPointFlag(). It can be possible also to edit more than a point at the same time with function ShmapSetRectangleType(). If you want to know if a cell is free see ShmapIsFreeCell() and ShmapIsFreePoint().

ShmapUpdateTmpObstacles() is a specific function created for Eurobot Project. Please, see an example in testmap.c file


Generated on Thu Sep 13 11:28:29 2007 for DCE-Eurobot by  doxygen 1.5.3