This repo contains two ROS packages that
-
Batch generates Gazebo world using Python script
-
Generates ground-truth point clouds from local Gazebo world files and streams them as a ROS topic
Run src/pcd_sim/scripts/generate_worlds.py
This command will automatically generate a batch of gazebo world files.
The configurable parameters are listed in src/pcd_sim/scripts/generator_config.yaml
Below are the instructions on how to generate ground truth pointcloud and octomap.
This function is based on the package sim_gazebo_plugins. To use the plugin, you need to edit your desired .world file to incorporate the plugin. Simply open your .world file in a text editor and add the following line just before the final <world> tag (i. e. in between the <world> tags):
(If you are using the default poles.world, or any worlds generated from generate_worlds.py, this step is not required because the plugin has already been included.)
<plugin name='gazebo_octomap' filename='libBuildOctomapPlugin.so'/>
To generate a .pcd file and a .bt file:
Option 1: A manual way
execute the following commands:
roslaunch pcd_sim load_world.launch gazebo_world:=<your_world_file>
# Replace <your_world_file> with the filename of the world you wish to build a map from. This name should not not contain ".world"
rosservice call /world/build_octomap '{bounding_box_origin: {x: 0, y: 0, z: 15}, bounding_box_lengths: {x: 30, y: 30, z: 30}, leaf_size: 0.1, filename: output_filename.bt}'Then the .pcd file and the .bt file will be generated in your .ros folder under the home folder.
The rosservice call includes adjustable variables: the bounding box origin and lengths, both in meters.
The lengths extend symmetrically in both (+/-) directions from the origin. For example, with an origin at (0, 0, 0) and bounding_box_lengths {x: 30, y: 30, z: 30}, the bounding box spans -15 to +15 meters in the X and Y directions, and 0 to 30 meters in the Z direction.
Option 2: Use the bash script
Navigate to pcd_sim/bash, run the bash script:
./generate_pointcloud.sh <world_name>