We represent the world as a grid, each cell having 0-255 value. The grid overlaps the map of the world and provides an additional information about cost of driving across the terrain. There is a minimum and maximum tresholds: if the value of a grid's cell above max. treshold (and still below 255), it is perfectly driveable, if it is less than min. treshold (and still >= 0), it is not driveable at all (for example, it is a wall across the road). Values in between are interpreted as somewhat driveable areas.
As was mentioned in "that earlier section about keepout maps", there are 3 common modes that are used to interpret values in a grid cells: binary, ternary and scale. My AStarGrid class uses "scale". Also, there are two ways to scale the values: 0 - 100 or 0 - 255; I use 0 - 255.
The information about keepout map is stored in .yaml file, for example (perfect_map_01.yaml):
This is a standard file format (for example, Nav2 understands it). Note resolution field: I have an image for a base map, that is 1600x1600 pixels. And I have a world that is 800x800 meters. So I have 0.5 meters per pixel.
The image field points to a .pgm file, which can be created using picture editor, like Gimp or Photoshop. The base for this work (road network) can be exported from my Map Editor Utility. .pgm is a grayscale image with 256 shades, which is exactly what we need for keepout map.
Before we continue: keep in mind that keepout map is a primitive way of doing things, it is not the way humans or animals do it, and it can be improved. A simple example: a road with right side traffic. You can drive forward on your lane, but if you turn around, your lane suddenly becomes non-driveable, while the opposite lane turns "white".
If you want an off-road example, here it is: my robot can not drive up, if the hill is too steep, so i have no choice but to mark it black. Yet, it can drive downhill on the same route! So keepout map is not necessarily accurate. Or should I say - it is not always enough (two lanes example) and not always optimal (second example).