ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Why my model URDF doesn't appear in Gazebo?

asked 2018-03-20 12:18:14 -0500

dorothea gravatar image

updated 2018-04-05 09:19:14 -0500

jayess gravatar image

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 ... (more)

edit retag flag offensive close merge delete

Comments

Please add output="screen" to the spawn node in your launch file, and then copy and paste the output from the launch file here.

David Lu gravatar image David Lu  ( 2018-03-20 12:28:47 -0500 )edit

I'm going to hazard a guess and say that this is because of the missing dynamics elements.

gvdhoorn gravatar image gvdhoorn  ( 2018-03-20 14:00:30 -0500 )edit

@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 :

<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher"/>
Delb gravatar image Delb  ( 2018-03-21 05:00:22 -0500 )edit
1

Do you have a reference for that @Delb? If I understand you correctly you're saying that dynamics elements aren't needed any more?

gvdhoorn gravatar image gvdhoorn  ( 2018-03-21 05:48:54 -0500 )edit

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 gravatar image Delb  ( 2018-03-21 07:45:58 -0500 )edit

@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

dorothea gravatar image dorothea  ( 2018-03-21 17:29:10 -0500 )edit

First you have an issue with your collision tags you can't put inertial 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.

Delb gravatar image Delb  ( 2018-03-22 03:11:01 -0500 )edit

Thanks a lot @Delb. My mistake was to put inertial into collision.

dorothea gravatar image dorothea  ( 2018-04-05 08:17:43 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-04-05 08:48:44 -0500

dorothea gravatar image

updated 2018-04-05 09:15:31 -0500

jayess gravatar image

The answer is to edit the urdf file.

There is an issue with your collision tags can't be put inertial tag in it (check here to see which elements are required for each tag). I had to copy all the inertial tags and paste into the link tags and the collision tags I had to fill by copy the code from visual tag.


Edit:

I made a mistake: I put <inertial /> into <collision />. I paste the finally vesion of my urdf:

<?xml version="1.0"?>
<robot name="tortoisebot">


    <link name="base_link">
     <collision>
        <geometry>
                <box size="0.6 0.3 0.3"/>
            </geometry>
            <material name="silver">
                <color rgba="0.75 0.75 0.75 1"/>
            </material>
    </collision>
    <inertial>
            <mass value="1.0"/>
            <inertia ixx="0.015" iyy="0.0375" izz="0.0375" ixy="0" ixz="0" iyz="0"/>
        </inertial>    
        <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>
            <geometry>
                    <box size="0.1 0.1 0.3"/>
            </geometry>
            <material name="silver"/>
        </collision>
        <inertial>
                <mass value="0.1"/>
                <inertia ixx="0.00083" iyy="0.00083" izz="0.000167" ixy="0" ixz="0" iyz="0"/>
        </inertial>
        <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>
       <geometry>
                <cylinder length="0.05" radius="0.035"/>
            </geometry>
            <material name="black"/>
        </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>
        <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>
             <geometry>
                <cylinder length="0.05" radius="0.035"/>
            </geometry>
            <material name="black">
                <color rgba="0 0 0 1"/>
            </material>
        </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>
        <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>
            <geometry>
                <cylinder length="0.05" radius="0.035"/>
            </geometry>
        </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>
        <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 ...
(more)
edit flag offensive delete link more

Question Tools

Stats

Asked: 2018-03-20 12:18:14 -0500

Seen: 5,664 times

Last updated: Apr 05 '18