Home | Tutorials | Wiki | Issues
Ask Your Question
0

Robot not visible after spawning in Gazebo

asked 2019-01-08 07:55:00 -0500

12melvin gravatar image

Hello, I am facing the following problem: My .urdf robot spawned successfully but is NOT visible in Gazebo.

To spawn the robot, I typed in the terminal the following command:

rosrun gazebo_ros spawn_model -file `rospack find panda_description`/urdf/panda_arm_hand.urdf -urdf -x 0 -y 0 -z 1 -model panda

This is the response from the terminal:

SpawnModel script started
[INFO] [1546954850.970203, 0.000000]: Loading model XML from file
[INFO] [1546954850.971724, 0.000000]: Waiting for service /gazebo/spawn_urdf_model
[INFO] [1546954850.975910, 0.000000]: Calling service /gazebo/spawn_urdf_model
[INFO] [1546954851.108377, 24.346000]: Spawn status: SpawnModel: Successfully spawned entity

When I open Gazebo the robot "panda" ist written in the structure tree on the left side but in the simulation not visible.

This is my file hierarchy:

../catkin_ws/src
/panda_description
    CMakeLists.txt
    package.xml
    /meshes
        /collision
            finger.stl
            hand.stl
            link0.stl
            link1.stl
            link2.stl
            link3.stl
            link4.stl
            link5.stl
            link6.stl
            link7.stl
        /visual
            finger.dae
            hand.dae
            link0.dae
            link1.dae
            link2.dae
            link3.dae
            link4.dae
            link5.dae
            link6.dae
            link7.dae
    /urdf
        panda_arm_hand.urdf

The .urdf is converted from an .urdf.xacro file.
The panda_arm_hand.urdf file:

<?xml version="1.0" ?>
<!-- =================================================================================== -->
<!-- |    This document was autogenerated by xacro from panda_arm_hand.urdf.xacro      | -->
<!-- |    EDITING THIS FILE BY HAND IS NOT RECOMMENDED                                 | -->
<!-- =================================================================================== -->
<robot name="panda" xmlns:xacro="http://www.ros.org/wiki/xacro">
  <link name="panda_link0">
    <visual>
      <geometry>
        <mesh filename="package://franka_description/meshes/visual/link0.dae"/>
      </geometry>
    </visual>
    <collision>
      <geometry>
        <mesh filename="package://franka_description/meshes/collision/link0.stl"/>
      </geometry>
    </collision>
  </link>
  <link name="panda_link1">
    <visual>
      <geometry>
        <mesh filename="package://franka_description/meshes/visual/link1.dae"/>
      </geometry>
    </visual>
    <collision>
      <geometry>
        <mesh filename="package://franka_description/meshes/collision/link1.stl"/>
      </geometry>
    </collision>
  </link>
  <joint name="panda_joint1" type="revolute">
    <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973"/>
    <origin rpy="0 0 0" xyz="0 0 0.333"/>
    <parent link="panda_link0"/>
    <child link="panda_link1"/>
    <axis xyz="0 0 1"/>
    <limit effort="87" lower="-2.8973" upper="2.8973" velocity="2.1750"/>
  </joint>
  <link name="panda_link2">
    <visual>
      <geometry>
        <mesh filename="package://franka_description/meshes/visual/link2.dae"/>
      </geometry>
    </visual>
    <collision>
      <geometry>
        <mesh filename="package://franka_description/meshes/collision/link2.stl"/>
      </geometry>
    </collision>
  </link>
  <joint name="panda_joint2" type="revolute">
    <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-1.7628" soft_upper_limit="1.7628"/>
    <origin rpy="-1.57079632679 0 0" xyz="0 0 0"/>
    <parent link="panda_link1"/>
    <child link="panda_link2"/>
    <axis xyz="0 0 1"/>
    <limit effort="87" lower="-1.7628" upper="1.7628" velocity="2.1750"/>
  </joint>
  <link name="panda_link3">
    <visual>
      <geometry>
        <mesh filename="package://franka_description/meshes/visual/link3.dae"/>
      </geometry>
    </visual>
    <collision>
      <geometry>
        <mesh filename="package://franka_description/meshes/collision/link3.stl"/>
      </geometry>
    </collision>
  </link>
  <joint name="panda_joint3" type="revolute">
    <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973"/>
    <origin rpy="1.57079632679 0 0" xyz="0 -0.316 0"/>
    <parent link="panda_link2"/>
    <child link="panda_link3"/>
    <axis xyz="0 0 1"/>
    <limit effort="87" lower="-2.8973" upper="2.8973" velocity="2.1750"/>
  </joint>
  <link name="panda_link4">
    <visual>
      <geometry ...
(more)
edit retag flag offensive close merge delete

Comments

When you click the model in the model tree and choose 'Follow' from the context menu, what happens?

kumpakri gravatar imagekumpakri ( 2019-01-09 03:46:08 -0500 )edit

The camera is moving to the centre of the map but the robot is still not visible. I tried to open the robot with Rviz and this was successfull.

12melvin gravatar image12melvin ( 2019-01-09 04:00:28 -0500 )edit

Gazebo needs the inertial tags for every link. Just as you have <collision> and <visual>, you need to define <inertial>. You can refer for example to [this file](https://bitbucket.org/osrf/drcsim/src/194be8500fef81593f79607a21ee2badd9700a0e/atlas_description/urdf/atlas.urdf).

kumpakri gravatar imagekumpakri ( 2019-01-09 04:32:21 -0500 )edit

Thank you very much! Now the robot is visible!

12melvin gravatar image12melvin ( 2019-01-09 05:44:32 -0500 )edit

I'm glad to help. So I have created the answer for other to quickly find the solution and for you to mark it as correct.

kumpakri gravatar imagekumpakri ( 2019-01-09 08:26:10 -0500 )edit

I'm glad to help. So I have created the answer for others to quickly find the solution and for you to mark it as correct.

kumpakri gravatar imagekumpakri ( 2019-01-09 08:26:33 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-01-09 08:23:30 -0500

kumpakri gravatar image

Gazebo needs the inertial tags for every link. Just as you have <collision> and <visual>, you need to define <inertial>. You can refer for example to this file.

The structure of inertial tag is as follows

<link name="panda_link0">
    <visual>
      <geometry>
        <mesh filename="package://franka_description/meshes/visual/link0.dae"/>
      </geometry>
    </visual>
    <collision>
      <geometry>
        <mesh filename="package://franka_description/meshes/collision/link0.stl"/>
      </geometry>
    </collision>
    <inertial>
            <mass value="5" />
            <origin xyz="0 0 0" rpy="0 0 0" />
            <inertia ixx="0.004" ixy="0.001" ixz="0" iyy="0.006" iyz="0" izz="0.007" />
    </inertial>
</link>

Where the mass is in kg and the inertia matrix has to be computed with respect to the shape and mass of the link. The formulas for inertia matrix of some basic geometry objects can be found on wiki page.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-01-08 07:55:00 -0500

Seen: 197 times

Last updated: Jan 09