Read grid maps from image files. More...
Read grid maps from image files.
The mapfile driver reads a occupancy grid map from a bitmap image file and provides the map to others via the map interface. Since gdk-pixbuf is used to load the file, pretty much all bitmap formats are supported.
Each cell in an occupancy grid map takes 1 of 3 states: occupied (1), unknown (0), and free (-1). The mapfile driver converts each pixel of an image to a cell with one of these states in the following way: average the color values; divide this average by max value to get a ratio; if this ratio is greater than .95, the cell is occupied; if ratio is less than 0.1, the cell is free; otherwise it is unknown. In other words, "blacker" pixels are occupied, "whiter" pixels are free, and those in between are unknown.
Note that map devices produce no data; the map is delivered via a sequence of configuration requests.
driver ( name "mapfile" provides ["map:0"] filename "mymap.pgm" resolution 0.1 # 10cm per pixel )