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

ROS2, URDF and filename

asked 2021-05-10 15:04:44 -0500

Vaneltin gravatar image

updated 2021-05-11 03:41:08 -0500

gvdhoorn gravatar image

Hello,

I use ROS2 foxy on my windows 10. I try to show my URDF on rviz2 but I have always an error. Here my URDF :

<?xml version="1.0" ?>
<robot name="valbot-description" xmlns:xacro="http://ros.org/wiki/xacro">

    <link name="world"/>

    <link name="valbot3D">
        <visual>
          <origin rpy="0.0 0 0" xyz="0 0 0"/>
          <geometry>
            <mesh filename="C:\dev\valbot\src\valbot_support\meshes\valbot-00-0000.STL"/>
          </geometry>
        </visual>
    </link>

    <joint name="world_to_valbot" type="fixed">
      <parent link="world"/>
      <child link="valbot3D"/>
      <origin xyz="0 0 0" rpy="0 0 0"/>
    </joint>
</robot>

But after running a :

ros2 run robot_state_publisher robot_state_publisher urdf\valbot.urdf

and :

rviz2

I have this error message :

[ERROR] [1620676703.495836100] [rviz2]: Error retrieving file [C:\dev\valbot\src\valbot_support\meshes\valbot-00-0000.STL]: Port number ended with '\'
[ERROR] [1620676703.496174300] [rviz2]: Ogre::FileNotFoundException::FileNotFoundException: Cannot locate resource C:\dev\valbot\src\valbot_support\meshes\valbot-00-0000.STL in resource group OgreAutodetect. in ResourceGroupManager::openResource at C:\ci\ws\build\rviz_ogre_vendor\ogre-v1.12.1-prefix\src\ogre-v1.12.1\OgreMain\src\OgreResourceGroupManager.cpp (line 705)
edit retag flag offensive close merge delete

Comments

The filename attribute should probably be a URI, not a plain path.

If you really want to use absolute paths (instead of package-relative), you could try changing the filename to:

file:///C:/dev/valbot/src/valbot_support/meshes/valbot-00-0000.STL
gvdhoorn gravatar image gvdhoorn  ( 2021-05-11 03:44:04 -0500 )edit

Hi,

Thanks for your answer. I tried with

filename:"package://valbot_spport/meshes/valbot-00-000.STL"

and :

file:///C:/dev/valbot/src/valbot_support/meshes/valbot-00-0000.STL

but is still not working. For the package:/ , I have this message :

[ERROR] [1620766178.440937700] [rviz2]: Error retrieving file [file://C:\dev\valbot\install\valbot_support/share/valbot_support/meshes/valbot-00-0000.STL]: Couldn't open file /C:\dev\valbot\install\valbot_support/share/valbot_support/meshes/valbot-00-0000.STL
Vaneltin gravatar image Vaneltin  ( 2021-05-11 15:50:33 -0500 )edit

So just to make sure: does the file actually exist? Is the name exactly as you specify it?

What's the output of:

dir C:\dev\valbot\install\valbot_support\share\valbot_support\meshes\valbot-00-0000.STL

If it does exist: is it a valid STL file?

gvdhoorn gravatar image gvdhoorn  ( 2021-05-12 02:45:09 -0500 )edit

Hi

So, finally, I have my STL file on rviz. It works with this in

<mesh filename="file:///dev/valbot/src/valbot_support/meshes/valbot-00-0000.STL"/>

But I would like to use an URI. The file didn't exist in install\valbot_support\share\valbot_support\meshes .. I don't know why. I would like to know why it doesn't exist. So I created the directory \meshes into install\valbot_support\share\valbot_support. Then I paste my STL file in it. But when I use "package://" into my urdf, it doesn't work.

<mesh filename="package://valbot_support/meshes/valbot-00-0000.STL"/>
Vaneltin gravatar image Vaneltin  ( 2021-05-13 09:55:21 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-05-05 15:45:11 -0500

ljaniec gravatar image

Much was already been said in the comments by @gvdhoorn but I think I can help you with using filename="package://....

You should have in your CMakeLists.txt lines like these:

install(DIRECTORY launch
  configs
  maps
  worlds
  robots
  models
  DESTINATION share/${PROJECT_NAME})

Where you have your robot URDF and meshes in robots or models folder.

You can base your solution on the nice neo_simulation2repository (there: https://github.com/neobotix/neo_simul...).

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2021-05-10 15:04:44 -0500

Seen: 884 times

Last updated: May 05 '22