Skip to content
Black Coffee Robotics edited this page Oct 28, 2020 · 5 revisions

Project Description

The following codebase achieves the objective of projection of two-dimensional grayscale terrain images, as well as the projection of occupancy 2D grid maps. Gazebo handles this by percieving height as a function of how bright the pixel is. Therefore, grayscale images can easily converted into 3D projections.

(tested on ros-noetic with Gazebo-11)

Installation

The repository as a whole is a ROS package, and hence needs to built in a ROS workspace.

  • Clone the repository in the src folder of your $WORKSPACE directory:

     git clone https://github.com/blackcoffeerobotics/heightmap_generation.git
    
  • Build the package in your workspace:

    cd $WORKSPACE/ && catkin_make
    
  • To prevent repeated sourcing of your devel/ folder of your workspace, run the command to add a sourcing command to your bash script:

    echo "source $WORKSPACE_DIR/devel/setup.bash" >> ~/.bashrc && exec bash
    
  • Launch an empty world using the package:

    roslaunch heightmap_generation sim.launch
    
  • The script launches an empty world with a Sun, clouds and a ground plane situated at the origin:

Adding a heightmap

The $WORKSPACE/config/heightmaps/heightmap.png is utilized for heightmap generation, this needs to be a greyscale image. To generate a heightmap compatible image, following command is used:

rosrun heightmap_generation world_create.py <world_name> <invert>(optional)

First argument is the name of the resulting world file, the second argument is optional and inverts the greyscale image with binary thresholding - to be used for inverting white/grey regions to black/white. An example command is:

rosrun heightmap_generation world_create.py test.world to use heightmap.png file without color inversion, or
rosrun heightmap_generation world_create.py test.world invert to invert the colour schema.

To change DEM parameters, refer to $WORKSPACE/config/heightmaps/config.yaml

Finally, launch the world using:

roslaunch heightmap_generation sim.launch world:=test.world

Refer to the link here for more information on DEMs.

Clone this wiki locally