Classes | Defines | Typedefs | Functions | Variables

map.h File Reference

#include <stdbool.h>
#include <robodim.h>
Include dependency graph for map.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  map_cell
struct  map

Defines

#define MAP_NEW_OBSTACLE   255
#define MAP_NO_OBSTACLE   0
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.

Typedefs

typedef unsigned int map_cell_detobst_t
typedef unsigned int map_cell_flag_t
typedef struct map_cell MapCell

Functions

void ShmapAllFreeSpace (void)
 Initialize Map Memory with MAP_FREE value and MAP_FLAG_NO_FLAG flag.
struct mapShmapInit (int init_flag)
 Init Shared Map memory.
void ShmapFree (void)
 Free Shared Map memory.
void ShmapDt (void)
 Deatach Shared Map memory.
struct mapShmapIsMapInit (void)
 Check if Shared Map memory is init.
void ShmapPoint2Cell (double x, double y, int *cx, int *cy, bool *valid)
 Translates real point coordinates (in meters) to cell grid coordinates.
int ShmapCell2Point (int ix, int iy, double *x, double *y)
 Translates from cell grid coordinates to real coordinates.
void ShmapUpdateTmpObstacles (map_cell_detobst_t val)
int ShmapIsFreeCell (int x, int y)
 Give information about if a cell is free.
int ShmapIsFreePoint (double x_m, double y_m)
int ShmapSetRectangleFlag (double x1, double y1, double x2, double y2, map_cell_flag_t set_flags, map_cell_flag_t clear_flags)
 Creates an obstacle in the map.
int ShmapSetCircleFlag (double xs, double ys, double r, map_cell_flag_t set_flags, map_cell_flag_t clear_flags)
 Creates an obstacle in the map with a square shape.

Variables

struct map_cell ShmapNoCell
 See ShmapCellAtPoint().

Define Documentation

#define MAP_NEW_OBSTACLE   255
#define MAP_NO_OBSTACLE   0

Typedef Documentation

typedef unsigned int map_cell_detobst_t
typedef unsigned int map_cell_flag_t
typedef struct map_cell MapCell

Function Documentation

void ShmapAllFreeSpace ( void   ) 

Initialize Map Memory with MAP_FREE value and MAP_FLAG_NO_FLAG flag.

See also:
map MAP_FREE

Here is the caller graph for this function:

int ShmapCell2Point ( int  ix,
int  iy,
double *  x,
double *  y 
)

Translates from cell grid coordinates to real coordinates.

Coordinates set to x and *y are coordinates of the center of given cell.

Parameters:
ix given x index of grid cell
iy given y index of grid cell
*x is set to real x coordinate corresponding to given ix
*y is set to real y coordinate corresponding to given iy
Returns:
0 if and only if given grid indices fall into playground, otherwise returns -1

Here is the caller graph for this function:

void ShmapDt ( void   ) 

Deatach Shared Map memory.

void ShmapFree ( void   ) 

Free Shared Map memory.

Here is the caller graph for this function:

struct map* ShmapInit ( int  init_flag  )  [read]

Init Shared Map memory.

Parameters:
init_flag 1 to init the map memory and set all cells with MAP_FREE and MAP_FLAG_NO_FLAG, 0 only init map
Returns:
Pointer to the map. In case of error, exit() is called.

This function allocates memory for shared map if this memory does not exists.

Here is the call graph for this function:

Here is the caller graph for this function:

int ShmapIsFreeCell ( int  x,
int  y 
)

Give information about if a cell is free.

Parameters:
x Coordonate of a cell
y Coordonate of a cell
Returns:
1 if the cell is not an obstacle, -1 if the cell is not in the map, 0 otherwise

Following cells are consider as free cells: MAP_START, MAP_GOAL, MAP_PATH, MAP_FREE.

Here is the caller graph for this function:

int ShmapIsFreePoint ( double  x_m,
double  y_m 
)

Here is the call graph for this function:

Here is the caller graph for this function:

struct map* ShmapIsMapInit ( void   )  [read]

Check if Shared Map memory is init.

Returns:
Pointer to the map or NULL if not initialized.

Here is the caller graph for this function:

void ShmapPoint2Cell ( double  x,
double  y,
int *  ix,
int *  iy,
bool *  valid 
)

Translates real point coordinates (in meters) to cell grid coordinates.

Parameters:
x given x coordinate [meters]
y given y coordinate [meters]
*ix referenced int is set to grid index corresponding to x
*iy referenced int is set to grid index corresponding to y
*valid referenced bool is set to true if and only if position given by (x,y) falls into playground

Here is the caller graph for this function:

int ShmapSetCircleFlag ( double  xs,
double  ys,
double  r,
map_cell_flag_t  set_flags,
map_cell_flag_t  clear_flags 
)

Creates an obstacle in the map with a square shape.

Parameters:
xs Coordonate X (in m) of the central point
ys Coordonate Y (in m) of the central point
r Radius (in m)
cell Type of obstacle.

Here is the call graph for this function:

Here is the caller graph for this function:

int ShmapSetRectangleFlag ( double  x1,
double  y1,
double  x2,
double  y2,
map_cell_flag_t  set_flags,
map_cell_flag_t  clear_flags 
)

Creates an obstacle in the map.

Parameters:
x1 Coordonate X (in m) of the first point
y1 Coordonate Y (in m) of the first point
x2 Coordonate X (in m) of the second point
y2 Coordonate Y (in m) of the second point
cell Type of obstacle.

Here is the call graph for this function:

Here is the caller graph for this function:

void ShmapUpdateTmpObstacles ( map_cell_detobst_t  val  ) 

Variable Documentation