RoPod/Tutorials/Load heightmap in GAZEBO: Difference between revisions
(Created page with 'In principle Gazebo can load directly heightmaps specified in a png grayscale file. However, after following some tutorials the script did not succeed in loading a heightmap. As…') |
No edit summary |
||
Line 4: | Line 4: | ||
The conversion process is divided in several steps: | The conversion process is divided in several steps: | ||
1. Convert PGM to SVG | 1. Convert PGM to SVG | ||
The conversion is made using the program potrace. If not installed, run: | |||
<pre> | |||
sudo apt install potrace | |||
</pre> | |||
Next, use the resolution of your heightmap to compute the corresponding dpi resolution. Use this formula: | |||
dpi resolution = 25.4 / #mmperpixel | |||
For the heightmap of the lab, the resolution is 25mm/pixel, thus 1.016 dpi. Next run the potrace command as follows: | |||
<pre> | <pre> | ||
potrace -s heightmap_solid_sim.pgm -a 0 -r 1.016 | potrace -s heightmap_solid_sim.pgm -a 0 -r 1.016 | ||
</pre> | </pre> | ||
2. Convert SVG to openSCAD file | |||
3. Render and create STL file | |||
4. Use STL file in GAZEBO |
Revision as of 14:51, 18 September 2017
In principle Gazebo can load directly heightmaps specified in a png grayscale file. However, after following some tutorials the script did not succeed in loading a heightmap.
As an alternative, one can convert the heightmap into a 3D mesh file and load it in GAZEBO, which works straightforward. The conversion could be made in a program like blender, however here directions are given using open source software.
The conversion process is divided in several steps:
1. Convert PGM to SVG
The conversion is made using the program potrace. If not installed, run:
sudo apt install potrace
Next, use the resolution of your heightmap to compute the corresponding dpi resolution. Use this formula:
dpi resolution = 25.4 / #mmperpixel
For the heightmap of the lab, the resolution is 25mm/pixel, thus 1.016 dpi. Next run the potrace command as follows:
potrace -s heightmap_solid_sim.pgm -a 0 -r 1.016
2. Convert SVG to openSCAD file
3. Render and create STL file
4. Use STL file in GAZEBO