Rosanswers logo

Hello everyone, I am struggling with preparing my URDF model for ROS2 foxy. I cannot make the RobotModel in Rviz2 to show me my robot based on the URDF.

I've generated my URDF using fusion2urdf plugin for Fusion360. The urdf seems to be correct, as I've successfully loaded it into pyBullet and all links and joints behave as expected there.

I've closely followed the Tutorial: https://index.ros.org/doc/ros2/Tutorials/URDF/Using-URDF-with-Robot-State-Publisher/ changing joint state publisher, lauchfile and setup accordingly. As far as i can tell the state publisher is working fine, so is the TF. The problem is that the robot_description topic (coming from robot_state_publisher Node I suppose) does not seem to load my STL files correctly. In the Rviz I can see the TF being displayed correctly and the RobotModel shows me that the status is OK, and that all links have been parsed successfully. Sadly all the links seem to have no geometry set. Output from running the launchfile doesn't seem to give any errors.

[INFO] [launch]: Default logging verbosity is set to INFO
urdf_file_name : bare_metal.urdf
[INFO] [robot_state_publisher-1]: process started with pid [40791]
[INFO] [state_publisher-2]: process started with pid [40793]
[robot_state_publisher-1] [WARN] [1606134120.643718296] [robot_state_publisher]: No robot_description parameter, but command-line argument available.  Assuming argument is name of URDF file.  This backwards compatibility fallback will be removed in the future.
[robot_state_publisher-1] Parsing robot urdf xml string.
[robot_state_publisher-1] Link base_link had 4 children
[robot_state_publisher-1] Link A80_simplified_v2__1__1 had 1 children
[robot_state_publisher-1] Link l1_simplified_v1_1 had 1 children
[robot_state_publisher-1] Link A80_simplified_v2__5__1 had 1 children
[robot_state_publisher-1] Link l2_simplified_v1__2__1 had 1 children
[robot_state_publisher-1] Link A80_simplified_v2__10__1 had 1 children
[robot_state_publisher-1] Link l3_simplified_v1_1 had 0 children
[robot_state_publisher-1] Link A80_simplified_v2__7__1 had 1 children
[robot_state_publisher-1] Link l1_simplified_v1__1__1 had 1 children
[robot_state_publisher-1] Link A80_simplified_v2__8__1 had 1 children
[robot_state_publisher-1] Link l2_simplified_v1_1 had 1 children
[robot_state_publisher-1] Link A80_simplified_v2__2__1 had 1 children
[robot_state_publisher-1] Link l3_simplified_v1__1__1 had 0 children
[robot_state_publisher-1] Link A80_simplified_v2__11__1 had 1 children
[robot_state_publisher-1] Link l1_simplified_v1__2__1 had 1 children
[robot_state_publisher-1] Link A80_simplified_v2__6__1 had 1 children
[robot_state_publisher-1] Link l2_simplified_v1__3__1 had 1 children
[robot_state_publisher-1] Link A80_simplified_v2__3__1 had 1 children
[robot_state_publisher-1] Link l3_simplified_v1__3__1 had 0 children
[robot_state_publisher-1] Link A80_simplified_v2_1 had 1 children
[robot_state_publisher-1] Link l1_simplified_v1__3__1 had 1 children
[robot_state_publisher-1] Link A80_simplified_v2__9__1 had 1 children
[robot_state_publisher-1] Link l2_simplified_v1__1__1 had 1 children
[robot_state_publisher-1] Link A80_simplified_v2__4__1 had 1 children
[robot_state_publisher-1] Link l3_simplified_v1__2__1 had 0 children
[robot_state_publisher-1] [INFO] [1606134120.647206332] [robot_state_publisher]: got segment A80_simplified_v2_1
[robot_state_publisher-1] [INFO] [1606134120.647240341] [robot_state_publisher]: got segment A80_simplified_v2__10__1
[robot_state_publisher-1] [INFO] [1606134120.647246804] [robot_state_publisher]: got segment A80_simplified_v2__11__1
[robot_state_publisher-1] [INFO] [1606134120.647251744] [robot_state_publisher]: got segment A80_simplified_v2__1__1
[robot_state_publisher-1] [INFO] [1606134120.647256588] [robot_state_publisher]: got segment A80_simplified_v2__2__1
[robot_state_publisher-1] [INFO] [1606134120.647261435] [robot_state_publisher]: got segment A80_simplified_v2__3__1
[robot_state_publisher-1] [INFO] [1606134120.647266215] [robot_state_publisher]: got segment A80_simplified_v2__4__1
[robot_state_publisher-1] [INFO] [1606134120.647271088] [robot_state_publisher]: got segment A80_simplified_v2__5__1
[robot_state_publisher-1] [INFO] [1606134120.647275785] [robot_state_publisher]: got segment A80_simplified_v2__6__1
[robot_state_publisher-1] [INFO] [1606134120.647280349] [robot_state_publisher]: got segment A80_simplified_v2__7__1
[robot_state_publisher-1] [INFO] [1606134120.647284976] [robot_state_publisher]: got segment A80_simplified_v2__8__1
[robot_state_publisher-1] [INFO] [1606134120.647289499] [robot_state_publisher]: got segment A80_simplified_v2__9__1
[robot_state_publisher-1] [INFO] [1606134120.647294103] [robot_state_publisher]: got segment base_link
[robot_state_publisher-1] [INFO] [1606134120.647298990] [robot_state_publisher]: got segment bbase_link
[robot_state_publisher-1] [INFO] [1606134120.647303700] [robot_state_publisher]: got segment l1_simplified_v1_1
[robot_state_publisher-1] [INFO] [1606134120.647308569] [robot_state_publisher]: got segment l1_simplified_v1__1__1
[robot_state_publisher-1] [INFO] [1606134120.647313338] [robot_state_publisher]: got segment l1_simplified_v1__2__1
[robot_state_publisher-1] [INFO] [1606134120.647317968] [robot_state_publisher]: got segment l1_simplified_v1__3__1
[robot_state_publisher-1] [INFO] [1606134120.647322519] [robot_state_publisher]: got segment l2_simplified_v1_1
[robot_state_publisher-1] [INFO] [1606134120.647327190] [robot_state_publisher]: got segment l2_simplified_v1__1__1
[robot_state_publisher-1] [INFO] [1606134120.647331743] [robot_state_publisher]: got segment l2_simplified_v1__2__1
[robot_state_publisher-1] [INFO] [1606134120.647336372] [robot_state_publisher]: got segment l2_simplified_v1__3__1
[robot_state_publisher-1] [INFO] [1606134120.647340887] [robot_state_publisher]: got segment l3_simplified_v1_1
[robot_state_publisher-1] [INFO] [1606134120.647346468] [robot_state_publisher]: got segment l3_simplified_v1__1__1
[robot_state_publisher-1] [INFO] [1606134120.647353961] [robot_state_publisher]: got segment l3_simplified_v1__2__1
[robot_state_publisher-1] [INFO] [1606134120.647361539] [robot_state_publisher]: got segment l3_simplified_v1__3__1
[state_publisher-2] [INFO] [1606134121.168070850] [state_publisher]: state_publisher started

My links are defines as following:

<link name="base_link">
    <origin rpy="0 0 0" xyz="0.15161484805319023 -0.017514024956537512 -5.721592278983374e-17"/>
    <mass value="1.006206171552925"/>
    <inertia ixx="0.00621556441460778" ixy="5.965558491606007e-05" ixz="-1.7939982973773058e-17" iyy="0.014950715369553433" iyz="-3.5973809829112504e-18" izz="0.011462909567881277"/>
    <origin rpy="0 0 0" xyz="0 0 0"/>
      <mesh filename="meshes/base_link.stl" scale="0.001 0.001 0.001"/>
    <material name="silver"/>
    <origin rpy="0 0 0" xyz="0 0 0"/>
      <mesh filename="meshes/base_link.stl" scale="0.001 0.001 0.001"/>

When i change the "geometry" tag to hold something other than mesh, ie. a cylinder, the shape is displayed correctly in rviz, so I am suspecting that the path to the STL is wrong and this is causing the problem. I cannot figure out how to supplement the path so it can be loaded correctly. I've tried with different prefixes ( package://, file://), different path roots (./meshes/base_link.stl, robot_sim//meshes/base_link.stl and also and absolute path to the file) but non of it seems to work

Also my directory tree ( ws/install/share/robot_sim/) looks like this:

├── robot_sim
│   ├── robot.urdf
│   ├── demo.launch.py
│   ├── hook
│   │   ├── ament_prefix_path.dsv
│   │   ├── ament_prefix_path.ps1
│   │   ├── ament_prefix_path.sh
│   │   ├── pythonpath.dsv
│   │   ├── pythonpath.ps1
│   │   └── pythonpath.sh
│   ├── meshes
│   │   ├── A80_simplified_v2__10__1.stl
│   │   ├── A80_simplified_v2__11__1.stl
│   │   ├── A80_simplified_v2__1__1.stl
│   │   ├── A80_simplified_v2_1.stl
│   │   ├── A80_simplified_v2__2__1.stl
│   │   ├── A80_simplified_v2__3__1.stl
│   │   ├── A80_simplified_v2__4__1.stl
│   │   ├── A80_simplified_v2__5__1.stl
│   │   ├── A80_simplified_v2__6__1.stl
│   │   ├── A80_simplified_v2__7__1.stl
│   │   ├── A80_simplified_v2__8__1.stl
│   │   ├── A80_simplified_v2__9__1.stl
│   │   ├── base_link.stl
│   │   ├── l1_simplified_v1__1__1.stl
│   │   ├── l1_simplified_v1_1.stl
│   │   ├── l1_simplified_v1__2__1.stl
│   │   ├── l1_simplified_v1__3__1.stl
│   │   ├── l2_simplified_v1__1__1.stl
│   │   ├── l2_simplified_v1_1.stl
│   │   ├── l2_simplified_v1__2__1.stl
│   │   ├── l2_simplified_v1__3__1.stl
│   │   ├── l3_simplified_v1__1__1.stl
│   │   ├── l3_simplified_v1_1.stl
│   │   ├── l3_simplified_v1__2__1.stl
│   │   └── l3_simplified_v1__3__1.stl

Originally posted by MAB Jakub on ROS Answers with karma: 33 on 2020-11-23

Post score: 1

Original comments

Comment by gvdhoorn on 2020-11-23:\

I've tried with different prefixes ( package://, [..]

What URI did you use with package://?

Comment by MAB Jakub on 2020-11-24:
I've tried


as well as providing full path in there

Comment by MAB Jakub on 2020-11-25:
I've just realised that RViz gave me and error message:

ERROR] [1606314150.195215419] [rviz2]: could not load model 'package://meshes/l3_simplified_v1__3__1.stl' for link 'l3_simplified_v1__3__1': FileNotFoundException: Cannot locate resource package://meshes/l3_simplified_v1__3__1.stl in resource group OgreAutodetect. in ResourceGroupManager::openResource at /tmp/binarydeb/ros-foxy-rviz-ogre-vendor-8.2.0/obj-x86_64-linux-gnu/ogre-v1.12.1-prefix/src/ogre-v1.12.1/OgreMain/src/OgreResourceGroupManager.cpp (line 703)

1 Answer 1


Rosanswers logo

Well it's been some time, but the problem was that i wasn't sourcing the terminal which I've run my Rviz2 in. Rookie mistake.

Originally posted by MAB Jakub with karma: 33 on 2021-11-22

This answer was ACCEPTED on the original site

Post score: 0


Your Answer

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