Skip to main content
6 of 7
deleted 23 characters in body
Kedar
  • 23
  • 6

you can post refer to this Post, if u need any help, let me know. I was able to do it.

Steps to Follow:

1.Create a Models Folder in your Directory(package file) and store the sdf file there. I have created a single Folder named Box inside the Models File

  1. Models
  2. Box
    • model.config
    • model.sdf
    • meshes(folder)
      • mesh1.dae
      • mesh2.stl
      • mesh3.stl

below is the info inside present in the all the files.

a. Model.config file

  <?xml version="1.0"?>
  <model>
    <name>Box</name>
    <version>1.0</version>
    <sdf version='1.6'>model.sdf</sdf>
 <author>
<name>name</name>
<email>[email protected]</email>
</author>
<description>This is a box</description>
b. model.sdf
<?xml version="1.0" ?>
<sdf version="1.5">
<model name="Box">
<pose>0 0 0 0 0 0</pose>
<static>true</static>
<link name="link">
  <collision name="collision">
    <geometry>
      <mesh>
        <uri>model://box/meshes/mesh1.dae</uri>
        <scale>0.25 0.25 0.25</scale>
      </mesh>
    </geometry>
  </collision>
  <visual name="visual">
    <geometry>
      <mesh>
        <uri>model://box/meshes/mesh1.dae</uri>
        <scale>0.25 0.25 0.25</scale>
      </mesh>
    </geometry>
  </visual>
</link>

c. How to use the Launch File in python

spawn_entity = Node(package='gazebo_ros',
                    executable='spawn_entity.py',
                    name="spawn_sdf_entity",
                    arguments=[ '-entity','Box','-file', LaunchConfiguration('sdf_model'),
                                '-x','1.0',
                                '-y','1.0',
                                '-z', '0.0',
                                '-R','0.0',
                                '-P','0.0',
                                '-Y','0.0'
                                ], output='screen')


return LaunchDescription([
    sdf_model,
    spawn_entity,
])

I hope this will be useful for everyone!!

Kedar
  • 23
  • 6