This libary implements a discrete map use wich can be use in robotics. More...
Map constaints | |
| |
#define | MAP_CELL_SIZE_MM 50 |
Size of a cell in mm. | |
#define | MAP_CELL_SIZE_M (MAP_CELL_SIZE_MM/1000.0) |
Size of a cell in mm. | |
#define | MAP_WIDTH (PLAYGROUND_WIDTH_MM / MAP_CELL_SIZE_MM) |
Field width. | |
#define | MAP_HEIGHT (PLAYGROUND_HEIGHT_MM / MAP_CELL_SIZE_MM) |
Field height. | |
#define | MAP_PLAYGROUND_WIDTH_MM (MAP_WIDTH*MAP_CELL_SIZE_MM) |
Playground width depends on width and cell size. | |
#define | MAP_PLAYGROUND_WIDTH_M (MAP_PLAYGROUND_WIDTH_MM/1000.0) |
Size of a cell in mm. | |
#define | MAP_PLAYGROUND_HEIGHT_MM (MAP_HEIGHT*MAP_CELL_SIZE_MM) |
Playground width depends on height and cell size. | |
#define | MAP_PLAYGROUND_HEIGHT_M (MAP_PLAYGROUND_HEIGHT_MM/1000.0) |
Size of a cell in mm. | |
Cell Flags | |
| |
#define | MAP_FLAG_WALL 1 |
Known wall. | |
#define | MAP_FLAG_PATH 2 |
Known wall. | |
#define | MAP_FLAG_START 4 |
Known wall. | |
#define | MAP_FLAG_GOAL 8 |
Known wall. | |
#define | MAP_FLAG_DET_OBST 16 |
Set when an obstacle is detected, cleard on every "map forget cycle". | |
#define | MAP_FLAG_SIMULATED_WALL 32 |
Used by robomon to simulate obstacles. | |
#define | MAP_FLAG_IGNORE_OBST 64 |
If obstacle is detected here, ignore it. | |
#define | MAP_FLAG_PLAN_MARGIN 128 |
"Safety margin" around obstacle - used only during A* planning and not during runtime obstacle avoidance. | |
#define | MAP_FLAG_INVALIDATE_WALL 256 |
Area, where the wall should be forgotten. | |
Shared Memory macros | |
| |
#define | SHM_MAP_KEY 555 |
Key use to share the memory SHM. |
This libary implements a discrete map use wich can be use in robotics.
The features are:
There are two important methods to access 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().
The map size is (MAP_PLAYGROUND_WIDTH_MM x 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.
There are only a coordonates difference between points and cells. Cell which cordonates [0,0] represents all the points contained in a square sited up left corner.
X 0 1 2 3 4 5 6 7 8 MAP_WIDTH-1 Y +---+---+---+---+---+---+---+---+---+---+ 0 |0,0| | | | | | | | | | +---+---+---+---+---+---+---+---+---+---+ 1 | | | | | | | | | | | +---+---+---+---+---+---+---+---+---+---+ | | | | | | | | | | | +---+---+---+---+---+---+---+---+---+---+ | | | | | | | | | | | +---+---+---+---+---+---+---+---+---+---+ | | | | | | | | | | | +---+---+---+---+---+---+---+---+---+---+ | | | | | | | | | | | +---+---+---+---+---+---+---+---+---+---+ | | | | | | | | | | | +---+---+---+---+---+---+---+---+---+---+ | | | | | | | | | | | +---+---+---+---+---+---+---+---+---+---+ MAP_HEIGHT-1
Each cell/point of the map (MapCell) contains two types of information:
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.)
The possible cell flags are:
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.)
FIXME: Obsolete: ShmapGetPointValue(), ShmapSetPointValue(), ShmapSetPointValue(), ShmapSetCellValue() do not exist
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
#define MAP_CELL_SIZE_M (MAP_CELL_SIZE_MM/1000.0) |
Size of a cell in mm.
The cell is a square.
#define MAP_CELL_SIZE_MM 50 |
Size of a cell in mm.
The cell is a square.
#define MAP_FLAG_DET_OBST 16 |
Set when an obstacle is detected, cleard on every "map forget cycle".
#define MAP_FLAG_GOAL 8 |
Known wall.
#define MAP_FLAG_IGNORE_OBST 64 |
If obstacle is detected here, ignore it.
#define MAP_FLAG_INVALIDATE_WALL 256 |
Area, where the wall should be forgotten.
#define MAP_FLAG_PATH 2 |
Known wall.
#define MAP_FLAG_PLAN_MARGIN 128 |
"Safety margin" around obstacle - used only during A* planning and not during runtime obstacle avoidance.
#define MAP_FLAG_SIMULATED_WALL 32 |
Used by robomon to simulate obstacles.
#define MAP_FLAG_START 4 |
Known wall.
#define MAP_FLAG_WALL 1 |
Known wall.
#define MAP_HEIGHT (PLAYGROUND_HEIGHT_MM / MAP_CELL_SIZE_MM) |
Field height.
#define MAP_PLAYGROUND_HEIGHT_M (MAP_PLAYGROUND_HEIGHT_MM/1000.0) |
Size of a cell in mm.
The cell is a square.
#define MAP_PLAYGROUND_HEIGHT_MM (MAP_HEIGHT*MAP_CELL_SIZE_MM) |
Playground width depends on height and cell size.
#define MAP_PLAYGROUND_WIDTH_M (MAP_PLAYGROUND_WIDTH_MM/1000.0) |
Size of a cell in mm.
The cell is a square.
#define MAP_PLAYGROUND_WIDTH_MM (MAP_WIDTH*MAP_CELL_SIZE_MM) |
Playground width depends on width and cell size.
#define MAP_WIDTH (PLAYGROUND_WIDTH_MM / MAP_CELL_SIZE_MM) |
Field width.
#define SHM_MAP_KEY 555 |
Key use to share the memory SHM.