Ask Your Question

Why won't my STL file render in visual studio code URDF preview?

asked 2020-04-09 16:07:50 -0500

rydb gravatar image

updated 2020-04-13 09:04:18 -0500

Edit: Fixed the error of "No tf data. Actual error: Fixed Frame [base_link] does not exist" because the Global Status in Rviz shows to be ok. What appeared to fix it was adding a second object for the STL to link to and them jointing them together. It still doesn't render in visual studio code which is now the main problem.

Why won't this URDF render the STL file's geometry in visual studio code? It renders in Rviz with no errors or warnings but in visual studio code it just renders the cylinder by its self.

I am using the launch file from the urdf tutorial.

URDF file:

<?xml version="1.0"?>
<robot name="StlTest">
  <link name="base_link">
        <cylinder length="0.6" radius="0.2"/>

    <link name="body_link">
                <mesh filename="file:///home/rydb/catkin_test/doggo.stl"/>

    <joint name="base_to_right_leg" type="fixed">
      <parent link="base_link"/>
      <child link="body_link"/>

command ran to test model in rvis:

roslaunch  ./launch/display.launch model:=./urdf/02-multipleshapes.urdf
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-04-09 16:26:59 -0500

updated 2020-04-09 20:50:49 -0500

The transforms are only available if you use the package: Robot State Publisher.

This package uses your URDF to generate a TF tree. The URDF by itself can't do such a thing.

If you still have any questions after visiting the robot state publisher page. Please, comment below and I make a more complete answer.

__________ EDIT __________

First of all, you need at least two files: robot.launch and (robot.urdf or robot.urdf.xacro)

In the launch file, you must load the robot_description parameter and run robot_state_publisher:


  <param name="robot_description" command="$(find xacro)/xacro --inorder '$(find birhex_description)/urdf/tutorial.urdf.xacro'"/>
  <node pkg="rviz" type="rviz" name="rviz" />
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />

In this example, I also included RViz but it isn't crucial.

In the image below we have the TF tree and the model in Rviz. Remember, to be able to visualize the model in Rviz you must add the display type: Robot Model image description

And this must solve your problems with No tf data..

However with Visual Code URDF preview, I'm open with the 3D Format .dae and it's working properly. Could you please provide your STL model?

edit flag offensive delete link more


Do I have to use robot state publisher specific syntax in order for the STL to render? Because I installed it and it doesn't render

rydb gravatar image rydb  ( 2020-04-09 16:43:26 -0500 )edit

I'll try to make a small guide here how you should run this. I'm just finishing some business and I come back.

Teo Cardoso gravatar image Teo Cardoso  ( 2020-04-09 17:21:40 -0500 )edit

alright cool, I'm struggling with getting it to work with VS code previews on my side of things so that'll help

rydb gravatar image rydb  ( 2020-04-09 19:39:48 -0500 )edit

I can't add the STL because you're only allowed to upload picture files but is it possible for you to re-write the example to work with an STL instead of .dae? I'll re-export my model as a .Dae and see if that works but the prbolem on sunday

rydb gravatar image rydb  ( 2020-04-10 18:32:32 -0500 )edit

Nope, it doesn't render as a .dae file. It renders fine in Rviz but neither as an STL or DAE file will it render in VS code

rydb gravatar image rydb  ( 2020-04-12 11:59:38 -0500 )edit

Your Answer

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

Add Answer

Question Tools



Asked: 2020-04-09 16:07:50 -0500

Seen: 288 times

Last updated: Apr 13 '20