ROS2 Port of map2gazebo: A package for creating Gazebo/Ignition environments from 2D Maps
map2gazebo Project URL: https://github.com/shilohc/map2gazebo
- ROS2 Humble (tested with the Debian packages)
- Python3 Dependencies
- opencv-python
- numpy
- trimesh
- matplotlib
- pycollada
- Make sure all pre-requisites are installed on your system first.
- Create a new folder. Let's say it's map2world.
- Create a src folder inside it.
- Open a fresh terminal.
cd
into map2world/src. Clone this repository. - Execute
cd ..
in the same terminal to move a folder up to map2world. - Execute
colcon build
in the terminal.
- Make sure the installation is properly completed
- Have a map server publishing the map to a topic. (One way to do is to run your Robotics Stack locally.)
- Open a fresh terminal,
cd
into the directory where map2world was built, and source it (source install/setup.bash
) - Run map2world:
ros2 run map2world map2world --ros-args -p map_topic:={map_topic} -p mesh_type:={mesh_type} -p export_dir:={export_dir} -p occupied_threshold:={occupied_threshold} -p box_height:={box_height}
- Parameters Reference:
- map_topic (Optional): Map Topic to which the map is being published. Default Value: map
- mesh_type (Optional): Whether to export as a .dae file or .stl file. Accepted Values: .dae, .stl Default Value: .dae
- export_dir (Optional): Folder path to save the file to. Default Value: Active user's home directory.
- occupied_threshold (Optional): Minimum threshold for OpenCV to get the occupied regions of the map. Default Value: 1
- box_height (Optional): Height of the occupied voxel from ground in the 3D mesh. Default Value: 2.0
- Parameters Reference:
- Once the conversion is successfully done, the map2world node will shut down with a message on the terminal.