0
$\begingroup$

screenshot of gazebo simulation

Hello. I'm trying to make a simulation of moon surface on gazebo. I tried to use this git for importing moon surface model. https://github.com/MobileRobots/amr-ros-config/tree/master/gazebo/models/apollo15_landing_site_1000x1000 The problem is this. I succeeded to upload moon surface on gazebo, but the problem is the texture or color isn't correct. I thought it was problem of getting texture image is having a problem so I copied texture file from git link to usr/share/gazebo-11/media/materials/textures folder. Also I tried to change jpg file to png file, but nothing solves the problem. How can I change the color or texture of model? Thanks for reading and wishing I can solve the answer from your helps. For asking specific question, I'm uploading world code and sdf code

empty.world

<include>
  <uri>model://apollo15_landing_site_1000x1000</uri>
</include>
<light name='sun' type='directional'>
  <cast_shadows>1</cast_shadows>
  <pose>0 0 10 0 -0 0</pose>
  <diffuse>0.8 0.8 0.8 1</diffuse>
  <specular>0.2 0.2 0.2 1</specular>
  <attenuation>
    <range>1000</range>
    <constant>0.9</constant>
    <linear>0.01</linear>
    <quadratic>0.001</quadratic>
  </attenuation>
  <direction>-0.5 0.1 -0.9</direction>
  <spot>
    <inner_angle>0</inner_angle>
    <outer_angle>0</outer_angle>
    <falloff>0</falloff>
  </spot>
</light>
<model name='ground_plane'>
  <static>1</static>
  <link name='link'>
    <collision name='collision'>
      <geometry>
        <plane>
          <normal>0 0 1</normal>
          <size>100 100</size>
        </plane>
      </geometry>
      <surface>
        <contact>
          <collide_bitmask>65535</collide_bitmask>
          <ode/>
        </contact>
        <friction>
          <ode>
            <mu>100</mu>
            <mu2>50</mu2>
          </ode>
          <torsional>
            <ode/>
          </torsional>
        </friction>
        <bounce/>
      </surface>
      <max_contacts>10</max_contacts>
    </collision>
    <visual name='visual'>
      <cast_shadows>0</cast_shadows>
      <geometry>
        <plane>
          <normal>0 0 1</normal>
          <size>100 100</size>
        </plane>
      </geometry>
      <material>
        <script>
          <uri>file://media/materials/scripts/gazebo.material</uri>
          <name>Gazebo/Grey</name>
        </script>
      </material>
    </visual>
    <self_collide>0</self_collide>
    <enable_wind>0</enable_wind>
    <kinematic>0</kinematic>
  </link>
</model>
<gravity>0 0 -9.8</gravity>
<magnetic_field>6e-06 2.3e-05 -4.2e-05</magnetic_field>
<atmosphere type='adiabatic'/>
<physics type='ode'>
  <max_step_size>0.001</max_step_size>
  <real_time_factor>1</real_time_factor>
  <real_time_update_rate>1000</real_time_update_rate>
</physics>
<scene>
  <ambient>0.4 0.4 0.4 1</ambient>
  <background>0.7 0.7 0.7 1</background>
  <shadows>1</shadows>
</scene>
<wind/>
<spherical_coordinates>
  <surface_model>EARTH_WGS84</surface_model>
  <latitude_deg>0</latitude_deg>
  <longitude_deg>0</longitude_deg>
  <elevation>0</elevation>
  <heading_deg>0</heading_deg>
</spherical_coordinates>
<state world_name='default'>
  <sim_time>32 252000000</sim_time>
  <real_time>32 474591156</real_time>
  <wall_time>1696991403 12767677</wall_time>
  <iterations>32252</iterations>
  <model name='ground_plane'>
    <pose>0 0 0 0 -0 0</pose>
    <scale>1 1 1</scale>
    <link name='link'>
      <pose>0 0 0 0 -0 0</pose>
      <velocity>0 0 0 0 -0 0</velocity>
      <acceleration>0 0 0 0 -0 0</acceleration>
      <wrench>0 0 0 0 -0 0</wrench>
    </link>
  </model>
  <light name='sun'>
    <pose>0 0 10 0 -0 0</pose>
  </light>
</state>
<gui fullscreen='0'>
  <camera name='user_camera'>
    <pose>5 -5 2 0 0.275643 2.35619</pose>
    <view_controller>orbit</view_controller>
    <projection_type>perspective</projection_type>
  </camera>
</gui>
$\endgroup$
1
  • $\begingroup$ Have a look at ~/.gazebo/server-XXXXX/gzserver.log, are there any hints? $\endgroup$ Commented Oct 16, 2023 at 13:31

1 Answer 1

1
$\begingroup$

I think it's from this path

<diffuse>file://media/materials/textures/AS16-110-18026HR-512x512.jpg</diffuse>

The file:// suggests gazebo to look for this media/materials/textures/AS16-110-18026HR-512x512.jpg in the $GAZEBO_RESOURCE_PATH (but putting the texture file in /usr/share/gazebo-11/media/materials/textures should also work if you have sourced the setup.sh file from gazebo.)

Changing to

<diffuse>model://apollo15_landing_site_1000x1000/materials/textures/AS16-110-18026HR-512x512.jpg</diffuse>

should work (there is a note about global gazebo path only in that file). Given the file is already 8 years old, I'm not sure what have changed on the heightmap format.

Another place to look for clues when it comes to the graphics is in ~/.gazebo/ogre.log. There should be some error about texture file not found there.

$\endgroup$
2
  • $\begingroup$ so sorry for such a late reply I've solved Thank you so much $\endgroup$ Commented Mar 15 at 1:11
  • $\begingroup$ @sanchez_khalifa - If your solution differs from this answer, then please post your own answer, as it may help others in future. If this answer is the same as your solution, then please mark this answer as the accepted answer (as, again, it might help others with the same issue). $\endgroup$ Commented Sep 11 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.