Home | Tutorials | Wiki | Issues
Ask Your Question
0

Including URI of a jpeg HeightMap file from a directory other than the one given

asked 2013-07-12 18:44:51 -0500

OxyGen gravatar image

updated 2013-07-12 18:46:04 -0500

Hi

I am new to Gazebo, and am stuck on this problem. I couldn't find a way out of this. The solution may be simple, but nothing is working from the top of my mind.

I have created my own jpeg HeightMap file and it is stored in "/home/$userName/Desktop/new_terrain.jpg". I have to use the file from this directory instead of the default one i.e. "GAZEBO_RESOURCE_PATH/medai/materials/textures/", where all texture files are saved. I already have the HeightMap thing working if I copy new_terrain.jpg file into the default folder.

I exported the the new path using bash command, but it didn't work out. Is there a way we can define the URI such that the xml file extracts the image from the specified directory. Could you suggest a solution?

Thanks in advance.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2013-07-15 13:00:03 -0500

iche033 gravatar image

Where do you store the other texture files such as dirt_diffuse_specular.png, and how are you exporting GAZEBO_RESOURCE_PATH?

Assuming new_terrain.jpg is on Desktop, and dirt_diffuse_specular.png is the one located in default resource folder, then just export:

export GAZEBO_RESOURCE_PATH=/home/yourusername/Desktop:$GAZEBO_RESOURCE_PATH

edit flag offensive delete link more

Comments

Thanks. That is what I did. As i described in my answer, it works when we mention the URI for new_terrain.jpg, but doesn't work for other texture files like dirt_diffuse_terrain.jpg or dirt_normal.jpg. Anyways, thanks for your help. At least this confirms that I was on the right track.

OxyGen gravatar imageOxyGen ( 2013-07-15 15:00:50 -0500 )edit
0

answered 2013-07-15 12:35:55 -0500

OxyGen gravatar image

updated 2013-07-15 12:36:47 -0500

I figured it out but not completely. So by exporting the GAZEBO_RESOURCE_PATH to /home/$userName/Desktop/new_terrain.jpg", the heightMap uses the terrain map.

Though the same doesn't work for texture files (i.e. dirtduffusespecular and dirtnormal). The complete code is given below for reference.

<sdf version='1.4'>
<world name='default'>
  <light name='sun' type='directional'>
    <cast_shadows>1</cast_shadows>
    <pose>0.000000 0.000000 10.000000 0.000000 0.000000 0.000000</pose>
    <diffuse>0.800000 0.800000 0.800000 1.000000</diffuse>
  <specular>0.200000 0.200000 0.200000 1.000000</specular>
  <attenuation>
    <range>1000.000000</range>
    <constant>0.900000</constant>
    <linear>0.010000</linear>
    <quadratic>0.001000</quadratic>
  </attenuation>
  <direction>0.500000 0.100000 -0.900000</direction>
</light>
<model name='hill_terrain'>
  <static>1</static>
  <link name='link2'>
    <collision name='collision'>
      <geometry>
        <heightmap>
          <uri>file://textures/terrain.png</uri>
          <size>513.000000 513.000000 15.000000</size>
          <pos>0.000000 0.000000 0.000000</pos>
          <texture>
            <size>10.000000</size>
            <diffuse>__default__</diffuse>
            <normal>__default__</normal>
          </texture>
          <blend>
            <min_height>0.000000</min_height>
            <fade_dist>0.000000</fade_dist>
          </blend>
        </heightmap>
      </geometry>
      <surface>
        <bounce>
          <restitution_coefficient>0.500000</restitution_coefficient>
          <threshold>0.500000</threshold>
        </bounce>
        <friction>
          <ode/>
        </friction>
        <contact>
          <ode/>
        </contact>
      </surface>
      <max_contacts>10</max_contacts>
    </collision>
    <visual name='visual'>
      <geometry>
        <heightmap>
          <uri>file://textures/terrain.png</uri>
          <size>513.000000 513.000000 15.000000</size>
          <pos>0.000000 0.000000 0.000000</pos>
          <texture>
            <diffuse>file://textures/dirt_diffusespecular.png</diffuse>
            <normal>file://textures/dirt_normal.png</normal>
            <size>50.000000</size>
          </texture>
          <texture>
            <diffuse>file://textures/grass_diffusespecular.png</diffuse>
            <normal>file://textures/grass_normal.png</normal>
            <size>20.000000</size>
          </texture>
          <texture>
            <diffuse>file://textures/fungus_diffusespecular.png</diffuse>
            <normal>file://textures/fungus_normal.png</normal>
            <size>80.000000</size>
          </texture>
          <blend>
            <min_height>2.000000</min_height>
            <fade_dist>5.000000</fade_dist>
          </blend>
          <blend>
            <min_height>4.000000</min_height>
            <fade_dist>5.000000</fade_dist>
          </blend>
        </heightmap>
      </geometry>
    </visual>
    <velocity_decay>
      <linear>0.000000</linear>
      <angular>0.000000</angular>
    </velocity_decay>
    <self_collide>0</self_collide>
    <kinematic>0</kinematic>
    <gravity>1</gravity>
  </link>
</model>
<physics type='ode'>
  <max_step_size>0.001000</max_step_size>
  <real_time_factor>1.000000</real_time_factor>
  <real_time_update_rate>1000.000000</real_time_update_rate>
  <gravity>0.000000 0.000000 -9.800000</gravity>
  <max_contacts>20</max_contacts>
</physics>
<scene>
  <ambient>0.200000 0.200000 0.200000 1.000000</ambient>
  <background>0.700000 0.700000 0.700000 1.000000</background>
  <shadows>1</shadows>
</scene>
<state world_name='default'>
  <sim_time>0 0</sim_time>
  <real_time>0 28669</real_time>
  <wall_time>1373585171 319260310</wall_time>
</state>
<gui fullscreen='0'>
  <camera name='user_camera'>
    <pose>542.022000 -105.269000 170.898000 0.000000 0.451643 2.824190</pose>
    <view_controller>orbit</view_controller>
  </camera>
</gui>
</world>
</sdf>
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-07-12 18:44:51 -0500

Seen: 114 times

Last updated: Jul 15 '13