Robotics StackExchange | Archived questions

Loading multiple heightmap files

Hi, I want to create a terrain with varying friction. Because I couldn't find an easier way, I'm trying to divide a heightmap in multiple patches and attribute each patch with a different friction. However, when I try to load the model, only one of the patches appear. Can someone help me to find the issue?

This is my sdf file:

<?xml version="1.0"?>
<?xml-model href="http://sdformat.org/schemas/root.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<sdf version="1.7">
    <model name="terrain">
        <pose>0 0 0 0 0 0</pose>
        <static>true</static>
        <link name="link">
            <pose>0 0 0 0 0 0</pose>
            <collision name="terrain_collision0">
                    <pose>-5.5 5.5 0 0 0 0</pose>
                    <geometry>
                        <heightmap>
                            <uri>model://random_terrain_friction/dem/height_map0.tif</uri>
                            <pos>0 0 0</pos>
                            <size>10.0 10.0 2</size>
                        </heightmap>
                    </geometry>
                <surface>
                        <friction>
                            <ode>
                                <mu>0.5381586550926517</mu>
                                <mu2>0.5381586550926517</mu2>
                            </ode>
                        </friction>
                    </surface>
            </collision>
            <visual name="terrain_visual0">
                    <pose>-5.5 5.5 0 0 0 0</pose>
                    <geometry>
                        <heightmap>
                            <use_terrain_paging>false</use_terrain_paging>
                            <uri>model://random_terrain_friction/dem/height_map0.tif</uri>
                            <pos>0 0 0</pos>
                            <size>10.0 10.0 2</size>
                            <texture>
                                <diffuse>model://random_terrain_friction/dem/friction_map0.png</diffuse>
                                <normal>file://media/materials/textures/flat_normal.png</normal>
                                <size>10.0</size>
                            </texture>
                        </heightmap>
                    </geometry>
                </visual>
            <collision name="terrain_collision1">
                    <pose>5.5 5.5 0 0 0 0</pose>
                    <geometry>
                        <heightmap>
                            <uri>model://random_terrain_friction/dem/height_map1.tif</uri>
                            <pos>0 0 0</pos>
                            <size>10.0 10.0 2</size>
                        </heightmap>
                    </geometry>
                <surface>
                        <friction>
                            <ode>
                                <mu>0.5255421994853569</mu>
                                <mu2>0.5255421994853569</mu2>
                            </ode>
                        </friction>
                    </surface>
            </collision>
            <visual name="terrain_visual1">
                    <pose>5.5 5.5 0 0 0 0</pose>
                    <geometry>
                        <heightmap>
                            <use_terrain_paging>false</use_terrain_paging>
                            <uri>model://random_terrain_friction/dem/height_map1.tif</uri>
                            <pos>0 0 0</pos>
                            <size>10.0 10.0 2</size>
                            <texture>
                                <diffuse>model://random_terrain_friction/dem/friction_map1.png</diffuse>
                                <normal>file://media/materials/textures/flat_normal.png</normal>
                                <size>10.0</size>
                            </texture>
                        </heightmap>
                    </geometry>
                </visual>
            <collision name="terrain_collision2">
                    <pose>-5.5 -5.5 0 0 0 0</pose>
                    <geometry>
                        <heightmap>
                            <uri>model://random_terrain_friction/dem/height_map2.tif</uri>
                            <pos>0 0 0</pos>
                            <size>10.0 10.0 2</size>
                        </heightmap>
                    </geometry>
                <surface>
                        <friction>
                            <ode>
                                <mu>0.5308397295261479</mu>
                                <mu2>0.5308397295261479</mu2>
                            </ode>
                        </friction>
                    </surface>
            </collision>
            <visual name="terrain_visual2">
                    <pose>-5.5 -5.5 0 0 0 0</pose>
                    <geometry>
                        <heightmap>
                            <use_terrain_paging>false</use_terrain_paging>
                            <uri>model://random_terrain_friction/dem/height_map2.tif</uri>
                            <pos>0 0 0</pos>
                            <size>10.0 10.0 2</size>
                            <texture>
                                <diffuse>model://random_terrain_friction/dem/friction_map2.png</diffuse>
                                <normal>file://media/materials/textures/flat_normal.png</normal>
                                <size>10.0</size>
                            </texture>
                        </heightmap>
                    </geometry>
                </visual>
            <collision name="terrain_collision3">
                    <pose>5.5 -5.5 0 0 0 0</pose>
                    <geometry>
                        <heightmap>
                            <uri>model://random_terrain_friction/dem/height_map3.tif</uri>
                            <pos>0 0 0</pos>
                            <size>10.0 10.0 2</size>
                        </heightmap>
                    </geometry>
                <surface>
                        <friction>
                            <ode>
                                <mu>0.477317298502133</mu>
                                <mu2>0.477317298502133</mu2>
                            </ode>
                        </friction>
                    </surface>
            </collision>
            <visual name="terrain_visual3">
                    <pose>5.5 -5.5 0 0 0 0</pose>
                    <geometry>
                        <heightmap>
                            <use_terrain_paging>false</use_terrain_paging>
                            <uri>model://random_terrain_friction/dem/height_map3.tif</uri>
                            <pos>0 0 0</pos>
                            <size>10.0 10.0 2</size>
                            <texture>
                                <diffuse>model://random_terrain_friction/dem/friction_map3.png</diffuse>
                                <normal>file://media/materials/textures/flat_normal.png</normal>
                                <size>10.0</size>
                            </texture>
                        </heightmap>
                    </geometry>
                </visual>
        </link>
    </model>
</sdf>

Asked by matval on 2022-12-16 18:30:31 UTC

Comments

Answers