Gazebo does not load sdf model in .world file
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>
Asked by kestrel1311 on 2021-01-01 02:09:35 UTC
Answers
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:
And then you generate it again in the launch file:
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.
Asked by Wishram on 2021-01-04 18:48:28 UTC
Comments