Skip to content

WorldGeneration

Nate Koenig edited this page Apr 9, 2020 · 1 revision

Deprecated Gazebo9 generator

Note: You will need the gazebo9 branch of this repository which is now deprecated.

This tutorial will walk you through the steps to create worlds to be used for practice/evaluation of robot teams for SubT.

  1. Install Ruby:

     sudo apt-get install ruby2.5 ruby2.5-dev
    
  2. Go to the worlds directory

     cd  subt_gazebo/worlds
    
  3. Run erb to generate a random world with default parameters

     erb tile.world.erb > cave.world
    
  4. Try different options, such as n_x=3 n_y=3 to generate a 3x3 world:

     erb n_x=3 n_y=3 tile.world.erb > cave_3x3.world
    
  5. ... or s=100 to set the random seed

     erb s=100 tile.world.erb > cave_s100.world
    

Deprecated Python generator

Note: You will need the gazebo9 branch of this repository which is now deprecated.

  • Change your current directory to the SubT workspace and activate it

      cd ~/subt_ws
      source install/setup.bash
    
  • Generate a world using the script

      rosrun subt_gazebo world_generator -o /tmp/subt generated_world 
    
  • World customization can be handled through command line arguments to the script. To see the available arguments, use the --help flag:

      usage: world_generator [-h] [--grid-size GRID_SIZE] [--origin-x ORIGIN_X]
                             [--origin-y ORIGIN_Y]
                             [--target-length TARGET_LENGTH] [--seed SEED] [-n]
                             [-o OUTPUT_DIR]
                             output_name
    
      positional arguments:
        output_name
    
      optional arguments:
        -h, --help            show this help message and exit
        --grid-size GRID_SIZE
                              Length and width of the grid that will be populated
        --origin-x ORIGIN_X   X origin in the grid that will be populated.
        --origin-y ORIGIN_Y   Y origin in the grid that will be populated.
        --target-length TARGET_LENGTH
                              Target total length of the cave system to be generated
        --seed SEED           Random number generator seed
        -n, --dry-run         print generated files to stdout, but do not write them
                              to disk
        -o OUTPUT_DIR, --output-dir OUTPUT_DIR
                              directory in which to output the generated files
    
  • Test your generated work in the simulation:

      roslaunch /tmp/subt/generated_world.launch
    
Clone this wiki locally