Skip to content

Global map creation

Luca Bartolomei edited this page Jul 1, 2022 · 11 revisions

Description

Here we report the commands on how to create an occupancy grid usable for global planning starting from a *.pcd file created by the SLAM pipeline. Notice that this pipeline is not fully automated yet, as some manual tuning and post-processing is necessary.

Instead, if you want to create an occupancy map for a Gazebo world, have a look at this repository.

Pipeline

A script to generate a global map from a *.pcd file is given in this repository (in smb_path_planner/smb_navigation/script).

Manual pipeline

These instructions show how to use the script with more control on the input and output arguments.

To generate a global map usable by move_base, follow these steps:

  1. Navigate to: $ cd smb_path_planner/smb_navigation/script

  2. Make the script exectuable: $ chomod +x pcd_to_gridmap.sh

  3. Set the right value for the parameters in pcd_to_gridmap.sh:

    • resolution: resolution of the output occupancy grid map (suggested range: 0.15 - 0.25);
    • z_min: minimum cut-off height of the input point cloud;
    • z_max: maximum cut-off height of the input point cloud.
  4. Run the script giving the path to the input file and the path of the output folder (the optional flag run_rviz has to be either true or false):
    $ ./pcd_to_gridmap.sh <abs_path_to_pcd> <abs_path_output_folder> <run_rviz>
    To print the usage of the script: $ ./pcd_to_gridmap.sh -h

  5. Follow the instructions on the terminal.

  6. After the script is done, a *.pgm and a *.yaml files are created in the specified output folder. The files can be used for global planning.

  7. Check that the origin field in the *.yaml file contains NaNs. If so, replace them with zeros.

  8. Check that the path to the map (*.pgm file) is specified correctly in the *yaml (relative paths work as well).

Once the map has been generated, it can be used for global planning. Refer to the "Run in simulation" section to know how to do that.

Use default paths from smb_slam

If the map generated by the package smb_slam is to be used, it is possible to use the python script in smb_path_planner/smb_navigation/script without the need to specify additional arguments.

Only the parameters in smb_path_planner/smb_navigation/script/pcd_to_gridmap.sh have to be tuned.

In this case, the file compslam_map.pcd generated in smb_common/smb_slam will be used, while the output path is smb_path_planner/smb_navigation/data/test.

  1. Start a roscore on your machine.

  2. In a terminal, navigate to: $ cd smb_path_planner/smb_navigation/script

  3. Run: $ python3 pcd_to_grid_map_default_paths.py

  4. Follow the instructions on the terminal.

  5. After the script is done, a *.pgm and a *.yaml files are created in the folder smb_path_planner/smb_navigation/data/test.

  6. Check that the origin field in the *.yaml file contains NaNs. If so, replace them with zeros.

  7. Check that the path to the map (*.pgm file) is specified correctly in the *yaml (relative paths work as well).

Once the map has been generated, it can be used for global planning. Refer to the "Run in simulation" section to know how to do that.

Clone this wiki locally