Library to manage the map
This libary implements a discrete map use wich can be use in robotics.
More...
The features are:
- Shared map memory (Shared Memory Map) : the map memory is shared using interprocess comunication methods.
- Discrete Space (The discrete Map): the real space is divided into cells of variable size. Each cell has its own propieties.
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 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
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].
Each cell/point of the map (MapCell) contains two types of information:
- Value (MapCellValue) : It determins the type of cell. It is the information used by A* algorithm.
- Flag (MapCellFlag) : It is extra information.
This information is of the type MapCellValue.The value that the map contains can be:
- MAP_WALL: Wall of the map. A fixed obstacle.
- MAP_WALL_CSPACE : Configuration Space of a wall.
- MAP_PATH: A part of path.
- MAP_START: The Start
- MAP_GOAL: The Goal
- MAP_NEW_OBSTACLE: New obstacle. This type is set when the sensors found an obstacle. It can be view as a moving obstacle.
- MAP_NEW_OBSTACLE_CSPACE: Configuration Space of the obstacle .
- MAP_FREE: Free space.
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.
The possible cell flags are:
- MAP_FLAG_NO_FLAG
- MAP_FLAG_WALL
- MAP_FLAG_PATH
- MAP_FLAG_START
- MAP_FLAG_GOAL One special type is MAP_FLAG_ERROR. 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.)
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
1.5.3