0
$\begingroup$

Rosanswers logo

Hello to all,

when I start Rviz with following .udfr - file:

<?xml version="1.0"?>
<robot name="test_robot">
  <link name="base_link"> 
    <visual>
      <geometry>
      <mesh filename="package://learning_urdf/meshes/tx60l_arm.stl"/>
      </geometry>
      <material name="white">
        <color rgba="1 1 1 1"/>
      </material>
    </visual>
  </link>
  <link name="link2" >
    <visual>
      <geometry>
      <mesh filename="package://learning_urdf/meshes/tx60l_shoulder.stl"/>
      </geometry>
      <material name="whatever">
        <color rgba="1 0 1 0"/>
      </material>
    </visual>
  </link>

  <joint name="joint1" type="continuous">
    <parent link="base_link"/>
    <child link="link2"/>
    <origin xyz="0 0 0" rpy="0 0 0" />
    <axis xyz="1 0 0" />
  </joint>
</robot>

Nothing is shown in the camera-view but the grid. The STL-Files were exported in Binary. There are none failure-messages while starting rviz or inside of it.

First i suggested the .stl - files are invisible, so I added the material-tag.

Any Suggestions why my camera-view is blank?

Many Thanks in advance Dominik


edit:

@Lorenz I tried to open my urdf file seperately in rviz und gazebo. For rviz I followed the rviz-tutorial. It was possible to load the urdf-file which you are suposed to build in this tutorial. I only exchanged the simple geometry with the meshes. At the end of the tutorial also a mesh is used (though a dae-file).

update to gazebo: I was able to load the urdf file in gazebo, but it is invisible like in rviz. Also the links of the urdf file are not shown in the tree.


Originally posted by viovio on ROS Answers with karma: 117 on 2012-09-06

Post score: 1

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

To visualize a URDF file in rviz, it's not enough to just load it in gazebo. You have to load it on the parameter server and you need to publish tf frames for each link in the urdf.

The following launch file loads the urdf and starts the robot_state_publisher to publish the TF frames of the urdf based on the data coming in over the joint_states topic.

<launch>
  <param name="robot_description" textfile="$(find learning_urdf)/tx60l.urdf" />
  <node name="robot_state_published" pkg="robot_state_publisher" type="state_publisher" />
</launch>

Now you need a node to publish joint states. If you want to use gazebo, you will have to use a plugin that reads the state of the joints in the physics simulation. On the real robot the node that communicates with your hardware needs to publish joint states.

For just testing your model in rviz, you can use the joint_state_publisher which provides a nice GUI to move the joints of your model. Don't forget that you have to add 'Robot Model' in rviz and your reference frame needs to be the root of your robot, i.e. base_link.

Edit: Just another guess what could go wrong: How is the scale of your stl files? 1 corresponds to 1mm, the meshes will be really big and you might not see anything. Make sure 1 corresponds to exactly 1 meter.


Originally posted by Lorenz with karma: 22731 on 2012-09-07

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$
0
$\begingroup$

Rosanswers logo

I agree with everyone above, but will offer another possibility. When I had tried STL files, I had terrible results. Maybe there were some small visible portions, but most of the mesh didn't show up.

What I ended up doing was installing Blender, which I highly recommend. In Blender, all I did was import STL, export Collada, and then use the .dae mesh in my URDF. This solved all of my problems.

I did have to re-center the origin of my mesh in Blender so the joint would show up in the right place (thanks AutoCAD for changing the origin :P ) but luckily did not have to do any scaling.


Originally posted by dougbot01 with karma: 342 on 2012-09-07

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by dougbot01 on 2012-09-07:
Oh and you should also check your material. Your link #2 has an alpha of 0, meaning it would be 100% transparent.

$\endgroup$

Your Answer

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