Collaboration diagram for mapfile:
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.
- Compile-time dependencies
- gdk-pixbuf-2.0 (usually installed as part of GTK)
- Configuration requests
- Configuration file options
- filename (string)
- Default: NULL
- The image file to read.
- resolution (length)
- Default: -1.0
- Resolution (length per pixel) of the image.
- negate (integer)
- Default: 0
- Should we negate (i.e., invert) the colors in the image before reading it? Useful if you're using the same image file as the world bitmap for Stage 1.3.x, which has the opposite semantics for free/occupied pixels.
- origin ([length length angle] tuple)
- Default: [-width*resolution/2 -height*resolution/2 0]
- The real-world coordinates of the lower-left pixel in the image. The default puts (0,0,0) in the middle of the image. The angle is currently ignored.
driver ( name "mapfile" provides ["map:0"] filename "mymap.pgm" resolution 0.1 # 10cm per pixel )