Ask Your Question
0

Urdf displays correcly in urdf-viz but not Rviz and Gazebo

asked 2018-08-16 21:41:58 -0600

Ironic gravatar image

updated 2018-08-18 20:00:45 -0600

Hello Everyone

New to ROS and i'm trying to import a CAD model via simmechanics_to_urdf.

If i open the urdf in urdf-viz ( https://github.com/OTL/urdf-viz ) i get a proper model and can move the joints.

However if i open the same urdf and meshes in either Rviz or Gazebo the parts show up in strange positions. (mostly around the origin).

edit: seems the issue was at least in part the lack of a fixed joint at the base to apparently anchor the model. As soon as I added a fixed base joint everything started working in Rviz. Gazebo still has the same issue. urdf-viz does not require the fixed base joint so it would display correctly regardless

Any ideas? Sorry i don't have a better vocabulary to explain the issue.

 <robot name="finger">
  <link name="base_link" />
  <link name="base8">
    <inertial>
      <origin xyz="-1.26773e-06 0.000427739 0.00546823" rpy="0 0 0"/>
      <mass value="0.00171993"/>
      <inertia ixx="4.15282e-08" ixy="3.76912e-12" ixz="3.81441e-12" iyy="9.2702e-08" iyz="-1.64114e-09" izz="9.15731e-08"/>
    </inertial>
    <visual>
      <origin xyz="0 0 0.0114743" rpy="0 0 0"/>
      <geometry>
        <mesh filename="package://finger_description/meshes/base8_ipt_11dce11d.stl" scale="0.001 0.001 0.001"/>
      </geometry>
      <material name="base8_color">
        <color rgba="0.74902 0.74902 0.74902 1.0"/>
      </material>
    </visual>
    <collision>
      <origin xyz="0 0 0.0114743" rpy="0 0 0"/>
      <geometry>
        <mesh filename="package://finger_description/meshes/base8_ipt_11dce11d.stl" scale="0.001 0.001 0.001"/>
      </geometry>
    </collision>
  </link>
  <link name="finger_segment1">
    <inertial>
      <origin xyz="0.00449723934 0.00021284299985 0.0071977" rpy="0 0 0"/>
      <mass value="0.00199166"/>
      <inertia ixx="1.06576e-07" ixy="1.37509e-11" ixz="3.64504e-11" iyy="1.21654e-07" iyz="-3.77147e-09" izz="5.43651e-08"/>
    </inertial>
    <visual>
      <origin xyz="0.0045 -1.77523001664e-05 0.008" rpy="0 0 0"/>
      <geometry>
        <mesh filename="package://finger_description/meshes/finger_segment_ipt_544d6e46.stl" scale="0.001 0.001 0.001"/>
      </geometry>
      <material name="finger_segment1_color">
        <color rgba="0.74902 0.74902 0.74902 1.0"/>
      </material>
    </visual>
    <collision>
      <origin xyz="0.0045 -1.77523001664e-05 0.008" rpy="0 0 0"/>
      <geometry>
        <mesh filename="package://finger_description/meshes/finger_segment_ipt_544d6e46.stl" scale="0.001 0.001 0.001"/>
      </geometry>
    </collision>
  </link>
  <joint name="finger_segment1__base8" type="continuous">
    <origin xyz="-0.0045 0 0.0114743" rpy="0 0 0"/>
    <axis xyz="1.0 0.0 0.0"/>
    <parent link="base8"/>
    <child link="finger_segment1"/>
    <dynamics damping="0.1"/>
  </joint>
  <link name="finger_segment2">
    <inertial>
      <origin xyz="0.00449723934 0.000212842999506 0.0071977" rpy="0 0 0"/>
      <mass value="0.00199166"/>
      <inertia ixx="1.06576e-07" ixy="1.37509e-11" ixz="3.64504e-11" iyy="1.21654e-07" iyz="-3.77147e-09" izz="5.43651e-08"/>
    </inertial>
    <visual>
      <origin xyz="0.0045 -1.77523005075e-05 0.008" rpy="0 0 0"/>
      <geometry>
        <mesh filename="package://finger_description/meshes/finger_segment_ipt_544d6e46.stl" scale="0.001 0.001 0.001"/>
      </geometry>
      <material name="finger_segment2_color">
        <color rgba="0.74902 0.74902 0.74902 1.0"/>
      </material>
    </visual>
    <collision>
      <origin xyz="0.0045 -1.77523005075e-05 0.008" rpy="0 0 0"/>
      <geometry>
        <mesh ...
(more)
edit retag flag offensive close merge delete

Comments

I seem to remember that the urdfs coming out of that tool are not always entirely correct, leading to problems when you try to use them with ROS without any post-processing.

Without seeing your urdf we cannot help you I'm afraid.

Please copy-paste it into your question, use the edit button/link.

gvdhoorn gravatar imagegvdhoorn ( 2018-08-17 02:00:55 -0600 )edit

However if i open the same urdf and meshes in either Rviz or Gazebo the parts show up in strange positions. (mostly around the origin).

this could actually point to a different problem.

How are you "open[ing] the same urdf in [..] Rviz" exactly? Which commands do you use?

gvdhoorn gravatar imagegvdhoorn ( 2018-08-17 02:04:11 -0600 )edit

Hi gvdhoorn.

To launch in Rviz i use:

roslaunch urdf_tutorial display.launch model:=`rospack find PMC6dof_urdf`/urdf/PMC_6dof.urdf gui:=true

To launch in gazebo i run:

roscore
roslaunch gazebo_ros empty_world.launch
rosrun gazebo_ros spawn_model -file `rospack find PMC6dof_urdf`/urdf/PMC_6
Ironic gravatar imageIronic ( 2018-08-17 06:27:47 -0600 )edit

I based my test in tutorials i found online. Just kept the robot name and just filled in my urdf (now in main answer). Thank You

Ironic gravatar imageIronic ( 2018-08-17 06:30:17 -0600 )edit

Just a quick comment:

<link name="base8:1">

I'm not sure names with colons in them are actually legal in ROS. See wiki/Names.

gvdhoorn gravatar imagegvdhoorn ( 2018-08-17 12:51:22 -0600 )edit

Removed all colons in names. Results are the same.

Ironic gravatar imageIronic ( 2018-08-17 19:32:22 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2018-08-18 02:28:47 -0600

gvdhoorn gravatar image

updated 2018-08-18 02:34:54 -0600

Just noticed that you don't have a base_link link in your urdf.

The default RViz config used by display.launch has base_link configured as the Fixed Frame.

Use the dropdown to change it (top-left, under Global Options in RViz), probably to base8:1.

As I don't have the meshes, I can't be certain, but I believe that will fix it.


Edit: three additional comments:

  • add a base_link to your urdf: by convention, base_link is the start of all ROS urdf trees. Quite a few tools, packages and humans will assume this, so it might make sense to add one. If you add it, make it the root of the tree.
  • I would not use colons in names of links: replace them with underscores.
  • your urdf has all joints rotating over the X axis. That is ok, but convention is for ROS frames to be x+ forward. Right now your model is Y axis aligned. Unless you have a strong need to keep it that way (external software fi), you might consider changing that to X axis aligned.
edit flag offensive delete link more

Comments

Implemented your suggestions and updated the urdf file

I have tried opening the model in gazebo via two methods described here and these are the results:

Ironic gravatar imageIronic ( 2018-08-18 20:05:24 -0600 )edit

If i open via the spawn method, meshes are overlapping as before. I get this warning in the terminal: multiple inconsistent <pose> exists due to fixed joint reduction overwriting previous value [0.0 0.0 0.0 0.0 0.0 0.0] with [0 0 1 0 -0 0]. Not sure what to do about it.

Ironic gravatar imageIronic ( 2018-08-18 20:06:40 -0600 )edit

this seems to address similar issue: http://answers.gazebosim.org/question...

Ironic gravatar imageIronic ( 2018-08-18 20:07:24 -0600 )edit

if i add the model to the gazebo model folder, i can add the model in the editor and here it is displayed correctly. however as soon as i close the editor the meshes revert to their strange positions.

Ironic gravatar imageIronic ( 2018-08-18 20:10:26 -0600 )edit

I'm assuming the RViz issues are now fixed?

re: gazebo: that is a bit of a different subject. Getting models to appear (and work!) properly in Gazebo is not trivial, especially not such small ones with these very small inertias. I'd recommend to ask a separate question on the Gazebo Anwers site.

gvdhoorn gravatar imagegvdhoorn ( 2018-08-19 02:13:06 -0600 )edit

Rviz is sorted. Will do. Thank you for all the help.

Ironic gravatar imageIronic ( 2018-08-19 16:23:21 -0600 )edit

Tried increasing inertia substantially and problem disappeared. Seems this is a recurring problem. Thank you for the tip.

Ironic gravatar imageIronic ( 2018-08-19 17:23:19 -0600 )edit

re: small inertias: Gazebo's solvers are numeric. Small nrs can always become a problem then.

gvdhoorn gravatar imagegvdhoorn ( 2018-08-20 01:01:34 -0600 )edit
0

answered 2018-08-19 17:24:55 -0600

Ironic gravatar image

For future reference issues were two fold:

Lack of base_link joint (affected Rviz and Gazebo) and issues of Gazebo with low inertia parts.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-08-16 21:41:58 -0600

Seen: 401 times

Last updated: Aug 19 '18