Gazebo | Ignition | Community
Ask Your Question

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

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

OxyGen gravatar image

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


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

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

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


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 -0600 )edit

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

OxyGen gravatar image

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

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'>
    <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>
  <direction>0.500000 0.100000 -0.900000</direction>
<model name='hill_terrain'>
  <link name='link2'>
    <collision name='collision'>
          <size>513.000000 513.000000 15.000000</size>
          <pos>0.000000 0.000000 0.000000</pos>
    <visual name='visual'>
          <size>513.000000 513.000000 15.000000</size>
          <pos>0.000000 0.000000 0.000000</pos>
<physics type='ode'>
  <gravity>0.000000 0.000000 -9.800000</gravity>
  <ambient>0.200000 0.200000 0.200000 1.000000</ambient>
  <background>0.700000 0.700000 0.700000 1.000000</background>
<state world_name='default'>
  <sim_time>0 0</sim_time>
  <real_time>0 28669</real_time>
  <wall_time>1373585171 319260310</wall_time>
<gui fullscreen='0'>
  <camera name='user_camera'>
    <pose>542.022000 -105.269000 170.898000 0.000000 0.451643 2.824190</pose>
edit flag offensive delete link more
Login/Signup to Answer

Question Tools


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

Seen: 140 times

Last updated: Jul 15 '13