0
$\begingroup$

Rosanswers logo

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, but still with problem ----

Sorry, but the texts below didn't wanted be represended as normal code. Better version on pastebin: link text

The Outputs from launch:

   ' logging to /home/dorota/.ros/log/253db8b8-2d56-11e8-abef-84a6c8a158a1/roslaunch-dorota-HP-ENVY-Sleekbook-4-PC-10539.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://dorota-HP-ENVY-Sleekbook-4-PC:32931/

SUMMARY
========

PARAMETERS
 * /robot_description: <?xml version="1....
 * /rosdistro: kinetic
 * /rosversion: 1.12.12
 * /use_sim_time: True

NODES
  /
    gazebo (gazebo_ros/gzserver)
    gazebo_gui (gazebo_ros/gzclient)
    spawn_urdf (gazebo_ros/spawn_model)

ROS_MASTER_URI=http://localhost:11311

process[gazebo-1]: started with pid [10562]
process[gazebo_gui-2]: started with pid [10567]
process[spawn_urdf-3]: started with pid [10572]
[ INFO] [1521671861.405168668]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1521671861.407923913]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...
SpawnModel script started
[INFO] [1521671862.160813, 0.000000]: Loading model XML from ros parameter
[INFO] [1521671862.167279, 0.000000]: Waiting for service /gazebo/spawn_urdf_model
[INFO] [1521671862.170183, 0.000000]: Calling service /gazebo/spawn_urdf_model
[ INFO] [1521671862.236927158, 0.023000000]: waitForService: Service [/gazebo/set_physics_properties] is now available.
Error:   Could not parse collision element for Link [base_link]
         at line 474 in /build/urdfdom-UJ3kd6/urdfdom-0.4.1/urdf_parser/src/link.cpp
Error:   Could not parse collision element for Link [front_caster]
         at line 474 in /build/urdfdom-UJ3kd6/urdfdom-0.4.1/urdf_parser/src/link.cpp
Error:   Could not parse collision element for Link [front_wheel]
         at line 474 in /build/urdfdom-UJ3kd6/urdfdom-0.4.1/urdf_parser/src/link.cpp
Error:   Could not parse collision element for Link [right_wheel]
         at line 474 in /build/urdfdom-UJ3kd6/urdfdom-0.4.1/urdf_parser/src/link.cpp
Error:   Could not parse collision element for Link [left_wheel]
         at line 474 in /build/urdfdom-UJ3kd6/urdfdom-0.4.1/urdf_parser/src/link.cpp
[INFO] [1521671862.376278, 0.081000]: Spawn status: SpawnModel: Successfully spawned entity
[ INFO] [1521671862.404992040, 0.104000000]: Physics dynamic reconfigure ready.
[spawn_urdf-3] process has finished cleanly
log file: /home/dorota/.ros/log/253db8b8-2d56-11e8-abef-84a6c8a158a1/spawn_urdf-3*.log

And I have Gazebo 7.


Originally posted by dorothea on ROS Answers with karma: 16 on 2018-03-20

Post score: 0


Original comments

Comment by David Lu on 2018-03-20:
Please add output="screen" to the spawn node in your launch file, and then copy and paste the output from the launch file here.

Comment by gvdhoorn on 2018-03-20:
I'm going to hazard a guess and say that this is because of the missing dynamics elements.

Comment by Delb on 2018-03-21:
@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"/>

Comment by gvdhoorn on 2018-03-21:
Do you have a reference for that @Delb? If I understand you correctly you're saying that dynamics elements aren't needed any more?

Comment by Delb on 2018-03-21:
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.

Comment by dorothea on 2018-03-21:
@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

Comment by Delb on 2018-03-22:
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.

Comment by dorothea on 2018-04-05:
Thanks a lot @Delb. My mistake was to put inertial into collision.

Comment by jayess on 2018-04-05:
@dorothea instead of putting your answer as an edit of your question, can you please put it as an answer? This way others will know that the problem is solved and can easily find the solution.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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" xyz="-0.2825 0.125 -.15"/>
    </joint>
</robot>

Originally posted by dorothea with karma: 16 on 2018-04-05

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.