Why my model URDF doesn't appear in Gazebo?
I am a beginner in ROS.
I have a problem - I can't spawn my robot model into Gazebo. As in the title. When I use "roslaunch tortoise.launch' the Gazebo opens but it's just empty world, without robot. There is no errors or sth like that.
(I am reading a book about ROS, and all the code is just Ctrl-C Ctrl-V from it. So it's not my own code.) This is my launch file. Named tortoise.launch in package tortoise:
<launch>
<!-- Load the TortoiseBot URDF model into the parameter server -->
<param name="robot_description" textfile="tortoisebot.urdf" />
<!-- Start Gazebo with an empty world -->
<include file="$(find gazebo_ros)/launch/empty_world.launch"/>
<!-- UPDATED: output="screen" in spawn_model-->
<node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" output="screen" args="-param robot_description -urdf -model tortoisebot" />
</launch>
and my urdf file:
<?xml version="1.0"?>
<robot name="tortoisebot">
<link name="base_link">
<collision>
<inertial>
<mass value="1.0"/>
<inertia ixx="0.015" iyy="0.0375" izz="0.0375" ixy="0" ixz="0" iyz="0"/>
</inertial>
</collision>
<visual>
<geometry>
<box size="0.6 0.3 0.3"/>
</geometry>
<material name="silver">
<color rgba="0.75 0.75 0.75 1"/>
</material>
</visual>
</link>
<link name="front_caster">
<collision>
<inertial>
<mass value="0.1"/>
<inertia ixx="0.00083" iyy="0.00083" izz="0.000167" ixy="0" ixz="0" iyz="0"/>
</inertial>
</collision>
<visual>
<geometry>
<box size="0.1 0.1 0.3"/>
</geometry>
<material name="silver"/>
</visual>
</link>
<joint name="front_caster_joint" type="continuous">
<axis xyz="0 0 1"/>
<parent link="base_link"/>
<child link="front_caster"/>
<origin rpy="0 0 0" xyz="0.3 0 0"/>
</joint>
<link name="front_wheel">
<collision>
<inertial>
<mass value="0.1"/>
<inertia ixx="5.1458e-5" iyy="5.1458e-5" izz="6.125e-5" ixy="0" ixz="0" iyz="0"/>
</inertial>
</collision>
<visual>
<geometry>
<cylinder length="0.05" radius="0.035"/>
</geometry>
<material name="black"/>
</visual>
</link>
<joint name="front_wheel_joint" type="continuous">
<axis xyz="0 0 1"/>
<parent link="front_caster"/>
<child link="front_wheel"/>
<origin rpy="-1.5708 0 0" xyz="0.05 0 -.15"/>
</joint>
<link name="right_wheel">
<collision>
<inertial>
<mass value="0.1"/>
<inertia ixx="5.1458e-5" iyy="5.1458e-5" izz="6.125e-5" ixy="0" ixz="0" iyz="0"/>
</inertial>
</collision>
<visual>
<geometry>
<cylinder length="0.05" radius="0.035"/>
</geometry>
<material name="black">
<color rgba="0 0 0 1"/>
</material>
</visual>
</link>
<joint name="right_wheel_joint" type="continuous">
<axis xyz="0 0 1"/>
<parent link="base_link"/>
<child link="right_wheel"/>
<origin rpy="-1.5708 0 0" xyz="-0.2825 -0.125 -.15"/>
</joint>
<link name="left_wheel">
<collision>
<inertial>
<mass value="0.1"/>
<inertia ixx="5.1458e-5" iyy="5.1458e-5" izz="6.125e-5" ixy="0" ixz="0" iyz="0"/>
</inertial>
</collision>
<visual>
<geometry>
<cylinder length="0.05" radius="0.035"/>
</geometry>
<material name="black"/>
</visual>
</link>
<joint name="left_wheel_joint" type="continuous">
<axis xyz="0 0 1"/>
<parent link="base_link"/>
<child link="left_wheel"/>
<origin rpy="-1.5708 0 0" xyz="-0.2825 0.125 -.15"/>
</joint>
</robot>
Please help me, I trying deal with it from 2 weeks. Thanks.
----- updated ...
Please add
output="screen"
to the spawn node in your launch file, and then copy and paste the output from the launch file here.I'm going to hazard a guess and say that this is because of the missing
dynamics
elements.@gvdhoorn The
dynamics
tag isn't required in Gazebo 7 (but I don't know for the older versions).Try adding this node in the launchfile :
Do you have a reference for that @Delb? If I understand you correctly you're saying that
dynamics
elements aren't needed any more?In the joint element description it's described as optional so it could give errors in Gazebo but not prevent the model from spawning. Also I use urdf files whithout those elements and I don't have simulation issues.
@Delb Adding the node didn't change anything. Still it's only the empty World in gazebo.
@David Lu I added this code to spawn_model, but it's still the same. I will paste the outputs to my main question. I understand the output text as the text which appears after
roslaunch tortoisebot.launch
First you have an issue with your
collision
tags you can't putinertial
tag in it, check here to see which elements are required for each tag.Secondly, I would recommend you before spawning your robot in gazebo to check in rviz if it's well constructed.
Thanks a lot @Delb. My mistake was to put inertial into collision.