Gazebo | Ignition | Community
Ask Your Question
0

Gazebo does not load sdf model in .world file

asked 2021-01-01 01:09:35 -0500

kestrel1311 gravatar image

updated 2021-01-01 01:10:34 -0500

Hello everyone. Happy new year!

I was working on building a small gazebo simulation, which aims a LiDAR mounted robot moving figure-eight track.

I have built the robot(no LiDAR yet) by following the gazebo tutorial, and I can load it in fine when I do it manually in gazebo. However, when I try to load the model via world file or launch file, model does not show up.

I am using latest version of gazebo.

Followings are my .world, .launch file.

<?xml version="1.0" ?>
<sdf version="1.6">
  <world name="default">
    <include>
      <uri>model://sun</uri>
    </include>
    <include>
      <uri>model://ground_plane</uri>
    </include>
    <include>
      <uri>model://my_robot</uri>
      <name>vehicle</name>
      <pose>0.3 0.5 0.9 0 0 0</pose>
    </include>
  </world>
</sdf>

<launch>
  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(find naviti)/worlds/indoor.world"/>
    <param name="robot_description_sdf" textfile="$(find navifi)/models/my_robot.sdf"/>
    <node name="spawn_model" pkg="gazebo_ros" type="spawn_model" output="screen"
    args="-sdf -param robot_description_sdf -model model -x 0.0 -y 0.0 -z 0.0"/>
  </include>
</launch>
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-01-04 17:48:28 -0500

Wishram gravatar image

Hello. I don't know if this can help but as I can see you generate your robot as a model in the world file:

<include> <uri>model://my_robot</uri> <name>vehicle</name> <pose>0.3 0.5 0.9 0 0 0</pose> </include>

And then you generate it again in the launch file: <node name="spawn_model" pkg="gazebo_ros" type="spawn_model" output="screen" args="-sdf -param robot_description_sdf -model model -x 0.0 -y 0.0 -z 0.0"/> </include>

If you want to generate your robot as an ORDINARY element of your world then you do it as a model in the world. However, if you want to do something with this robot and use it (moving the robot, driving the robot), like checking what topics are published on it in the terminal, you need to add your robot to launch. But it's more complicated because you won't open the SDF file in launch this way. You would need to make an URDF file and an XACRO file.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2021-01-01 01:09:35 -0500

Seen: 487 times

Last updated: Jan 04 '21