This tool creates randomly generated maps and world models that can be used by Navigation 2 and Gazebo. It uses a small portion of the HouseExpo data set. It is a set of 2D empty hand-drawn indoor layout images. The empty maps are located in the maps directory. The random map generator randomly places obstacles in grayscale maps. The maps must be in .png format. Currently, adding circles, squares, and ramps are supported. Size, shape, type, and distance between obstacles can be configured by the user. Gazebo heightmap is used to create a Gazebo world model of a randomly generated map. The random_world directory can be copied in .gazebo/model directory to be used with Gazebo. The generated map size must be 2^n+1 x 2^n+1. Otherwise, it will not work with Gazebo. World model size in Gazebo is scaled to 20-meter x 20-meter.
- Ubuntu 18.04.03 Bionic Beaver
- Gazebo 9
sudo apt-get update
sudo apt-get upgrade
-
Install OpenCV
sudo apt-get update sudo apt-get upgrade sudo apt-get install libopencv-dev
cd nav2_random_map_generator
make
or
cd src
g++ circle.cpp main.cpp map.cpp obstacle.cpp ramp.cpp rmg.cpp square.cpp -o random-map `pkg-config --cflags --libs opencv`
./map_generator <Map Id> <Number_of_Circles> <Number_of_Squares> <Robot_Size (px*0.03898)> <Map_Size(x)> <Map_Size(y)> <Min_Circle_Radius> <Max_Circle_Radius> <Min Square_Size> <Max_Circle_Radius> <Add Ramp> <Show_Map>
Example:
./map_generator 10 200 200 5 513 513 5 10 5 10 1 1
./map_generator h