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

URDF model not appearing in Rviz nor Gazebo

asked 2020-07-11 12:59:22 -0600

samia.choueiri gravatar image

i have been trying to open in gazebo and rviz a URDF file of a double pendulum that i have designed in solidworks and exported the URDF code using the URDF exporter. i am facing problems in visualizing my project in gazebo and rviz. The environments appear to be empty although the panels on the left indicate that all the link exist along with their properties. i can conclude from the position and orientation of the coordinate frames of each link that the scale of the robot is very small and in rviz a message appears indicating that the links have NO geometry.

Kindly check the URDF code below:

    <?xml version="1.0" encoding="utf-8"?>
<!-- This URDF was automatically created by SolidWorks to URDF Exporter! Originally created by Stephen Brawner (brawner@gmail.com) 
     Commit Version: 1.5.1-0-g916b5db  Build Version: 1.5.7152.31018
     For more information, please see http://wiki.ros.org/sw_urdf_exporter -->
<robot
  name="base_2links">
  <link
    name="base_link">
    <inertial>
      <origin
        xyz="-0.016 0.0034506 0.074794"
        rpy="0 0 0" />
      <mass
        value="0.027215" />
      <inertia
        ixx="2.0815E-06"
        ixy="3.1439E-22"
        ixz="-2.2393E-22"
        iyy="1.2394E-05"
        iyz="-1.2756E-22"
        izz="1.2544E-05" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://base_2links/meshes/base_link.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="0.79216 0.81961 0.93333 1" />
      </material>
    </visual>
    <collision>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://base_2links/meshes/base_link.STL" />
      </geometry>
    </collision>
  </link>
  <link
    name="link1">
    <inertial>
      <origin
        xyz="-0.00035493 0.020275 -0.012885"
        rpy="0 0 0" />
      <mass
        value="0.014265" />
      <inertia
        ixx="4.1101E-06"
        ixy="5.9474E-08"
        ixz="1.4157E-23"
        iyy="7.1379E-07"
        iyz="-1.3929E-23"
        izz="4.2611E-06" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://base_2links/meshes/link1.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="0.75294 0.75294 0.75294 1" />
      </material>
    </visual>
    <collision>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://base_2links/meshes/link1.STL" />
      </geometry>
    </collision>
  </link>
  <joint
    name="joint1"
    type="continuous">
    <origin
      xyz="-0.016 -0.062794 0.013249"
      rpy="1.5708 0.017504 -3.1416" />
    <parent
      link="base_link" />
    <child
      link="link1" />
    <axis
      xyz="0 0 1" />
  </joint>
  <link
    name="link2">
    <inertial>
      <origin
        xyz="0.014984 0.013663 -0.0038295"
        rpy="0 0 0" />
      <mass
        value="0.014265" />
      <inertia
        ixx="2.2556E-06"
        ixy="-1.692E-06"
        ixz="4.6898E-22"
        iyy="2.5683E-06"
        iyz="5.9919E-22"
        izz="4.2611E-06" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://base_2links/meshes/link2.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="0.75294 0.75294 0.75294 1" /> ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-07-13 11:57:40 -0600

rydb gravatar image

updated 2020-07-13 11:58:28 -0600

All of the lines that reference a specific package instead of the file it self like:

"<mesh
          filename="package://base_2links/meshes/base_link.STL" />"

are likely the cause. Trying to mention the specific package is finicky and I never personally was able to get rviz2 to render doing that. When I had this problem, changing those lines to reference the EXACT file location with "file://" instead of "package://" seemed to fix it.

E.G:

"<mesh
          filename="file:///home/<username>/<project_folder>/base_2links/meshes/base_link.STL" />"
edit flag offensive delete link more

Comments

Thank you for your suggestion, i took my time to go through it and apply it. So i changed all the mesh tags to something that looks like the following :

<mesh

      filename="file://home/samia/catkin_ws/src/base_2links/src/meshes/base_link.STL" />

i run again everything and rebuild my codes but nothing changed with the rendering. any other suggestion?

samia.choueiri gravatar image samia.choueiri  ( 2020-07-14 14:33:06 -0600 )edit

its file:/// not file://

Also make sure the model path is valid. Put the files path's path in the cmd and make sure it says something along the lines of "this is a file"

rydb gravatar image rydb  ( 2020-07-14 17:08:08 -0600 )edit

Thank you, now i can visualize my parts. next, i want to know more about motoring and reading the speed and position in the links and joints.

Thanks again. this was helpful.

samia.choueiri gravatar image samia.choueiri  ( 2020-07-15 02:07:07 -0600 )edit

could you upvote and accept my awnser? i need the karma to add pictures to my posts ;^;

rydb gravatar image rydb  ( 2020-07-15 11:18:30 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-07-11 12:59:22 -0600

Seen: 814 times

Last updated: Jul 13 '20