Tuesday, June 26, 2018

Blender to Gazebo

After obtaining the .stl and .dae files, copy them, along with the files that were used to make them (the DEM file, and the image file used for the texture) into the same folder as your .world file.  Then, you can add them to your .world file in the following manner:

<model name="my_mesh">
    <pose>0 0 0  0 0 0</pose>
    <static>true</static>
    <link name="body">
 <collision name="collision">
    <geometry>
      <mesh><uri>file:///usr/share/gazebo-9/worlds/uofu_labeless_aligned_truenorth.stl</uri></mesh>
    </geometry>
 </collision>
 <visual name="visual">
   <geometry>
     <mesh><uri>file:///usr/share/gazebo-9/worlds/uofu_labeless_aligned_truenorth.dae</uri></mesh>
   </geometry>
 </visual>
      </link>
</model>

Notice how the .stl file is used for detecting collisions with the quadcopter (or other models), and the .dae file provides the visual representation of the mesh.  Neither can do the job of the other, but they should line up pretty well, so it shouldn't present much of a problem.

After this, you will probably have to change the Quadcopter's spawn position so that it is still on top of the mesh.  But you are essentially done setting up your environment!  Congratulations!

No comments:

Post a Comment