- 问题描述
I am trying to load an underwater robot mesh in RViz. Because I could not do this with a .osg file, I converted it to .dae with Blender. Even though I have done that, RViz is still not able to load it (it doesn't even locate it although, of course, the file is there).
The file is called newestexport.dae. I show the .URDF file that calls the mesh:
<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="nessie" >
<xacro:property name="pi" value="3.141592654" />
<link name="base_link">
<origin rpy="3.141592654 0 3.141592654" xyz="0 0 0"/>
</link>
<joint name="base_link_to_nessie_base_link" type="fixed">
<parent link="base_link"/>
<child link="nessie_base_link"/>
</joint>
<link name="nessie_base_link">
<inertial>
<mass value="95" />
<inertia ixx="100" ixy="0" ixz="0" iyy="100" iyz="0" izz="100" />
</inertial>
<visual>
<origin rpy="-${pi/2} 0 ${pi}" xyz="-0.2 0 0.75"/>
<geometry>
<mesh filename="robot/nessie/newestexport.dae"/>
</geometry>
</visual>
</link>
</robot>
The error is the following:
[ERROR] [1518623879.761036843]: Could not load resource [robot/nessie/newestexport.dae]: Unable to open file "robot/nessie/newestexport.dae". [ERROR] [1518623879.761668482]: Could not load model 'robot/nessie/newestexport.dae' for link 'nessie_base_link': OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource robot/nessie/newestexport.dae in resource group Autodetect or any other group. in ResourceGroupManager::openResource at /build/ogre-1.9-mqY1wq/ogre-1.9-1.9.0+dfsg1/OgreMain/src/OgreResourceGroupManager.cpp (line 756)
Also, Meshlab and Blender are able to open the mesh without any problem.
The name of the file is correct. So that is discarded.
UPDATE: If you change the path "robot/nessie/newestexport.dae"
for ithe absolute path "/home/daniel/.uwsim/data/robot/nessie/newestexport.dae"
it doesn't work, the error still appears. Nor if you put it in the /home/daniel folder.
- 解决办法
改成<mesh filename="file:///robot/nessie/newestexport.dae"/>
- 最终结论
This syntax worked better for me "file:///$(find package_name)/path/to/file". This will likely work for different machines
参考网页