justagist / panda_simulator

A Gazebo simulator for the Franka Emika Panda robot with ROS interface, supporting sim-to-real code transfer (Python). Exposes customisable controllers and state feedback from robot in simulation.
Apache License 2.0
188 stars 58 forks source link

How do I add an .stl to the gazebo simulation? #58

Closed williamsnider closed 2 years ago

williamsnider commented 2 years ago

Thanks for such a great tool!

I'm trying to add a static object to my simulation (specifically an .stl file, named "shelves.stl"), but I'm having difficulties getting it to appear when I run roslaunch panda_gazebo panda_world.launch.

I've edited the panda.world file to include the stl file:

<?xml version="1.0" ?>
<sdf version="1.6">
  <world name="default">
    <include>
      <uri>model://ground_plane</uri>
    </include>

    <include>
      <uri>model://sun</uri>
    </include>

    <model name="shelves">
      <pose>0 0 0  0 0 0</pose>
      <static>true</static>
      <link name="body">
        <visual name="visual">
          <geometry>
            <mesh><uri>file://shelves.stl</uri></mesh>
          </geometry>
        </visual>
      </link>
    </model>

    <physics type="ode">
      <real_time_update_rate>1000.0</real_time_update_rate>
    </physics>

    <gravity>
      0.0 0.0 0.0
    </gravity>

    <gui fullscreen='0'>
    </gui>

  </world>
</sdf>

But it's not showing up. I am 99% certain it is an issue with where the .stl file is saved. I'm not quite certain where exactly panda_gazebo looks for meshes / stls, and the directories I've tried haven't worked. For what it's worth, I can get the .stl file to appear when I run gazebo panda.world from the directory containing shelves.stl, but of course this doesn't simulate the robot. Do you have a simple example showing where I need to store the .stl file?

williamsnider commented 2 years ago

I was able to figure this out. For anyone else out there trying to do this (admittedly simple) task, the directory I was looking for was a hidden folder: .gazebo/models. Inside this directory, I duplicated one of the existing models and switched things out for my custom .stl. After adding this custom model to the worldfile, it shows up in Gazebo as desired.