0
$\begingroup$

Rosanswers logo

Hello! I've built a part in solidworks and exported it into a STL file. So I'm trying to display it on the web browser through the package ros3djs (http://wiki.ros.org/ros3djs/Tutorials/VisualizingAURDF). When I try to show it, the web console gives me an error, so I have converted into .dae format through the Meshlab software. I'm using the following URDF code:

<?xml version="1.0"?>
<robot name="robottt">
    <link name="base_link">
        <visual>
            <origin xyz="0 0 0" rpy="0 0 0" />
            <geometry>
                <mesh filename="file:///home/ros/catkin_ws/src/robottt/robots/base_link.dae" />
            </geometry>

        </visual>
    </link>
</robot>

I don't know what could be going wrong, the same urdf is well-displayed in rviz. I have tested exchanging the path filename to a pr2_description part, and it does well on the web browser and rviz.

<mesh filename="package://pr2_description/meshes/gripper_v0/l_finger.dae" />

Some errors are shown on the web console, but these are the same in both .dae files, so I think it is not the reason for not showing my model.

I upload my .dae file if you want to test it. https://www.dropbox.com/s/m140qdyeze7rxyy/base_link.dae?dl=0

Any idea? I've been stuck in this for some days. I have also tried lighter .dae files without any success. And also tried to convert it into .dae format through other software such as OpenCollada in Maya, and some online converters.

Thank you very much, I appreciate any help.

Ruben


Originally posted by rubenvm on ROS Answers with karma: 17 on 2015-08-21

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

ros3djs assumes that the mesh resources begin with a package:// URL, not a file URL like in your example. What the library will do is replace package:// with whatever argument you give to path (e.g., https://github.com/RobotWebTools/ros3djs/blob/develop/examples/urdf.html#L47). If you do not provide a path, it will use localhost by default. For example, if a resource is package://robottt/robots/base_link.dae, roslibjs will replace this with http://localhost/robottt/robots/base_link.dae by default. Again, you can change the preface with an optional argument.

Browsers cannot natively access the file system for security reasons, so you will need to host your HTML page and the Collada file on a web server (Apache is easy enough to set up).


Originally posted by rtoris288 with karma: 1173 on 2015-08-21

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by rubenvm on 2015-08-21:
Ohh! Thank you very much! I have been stuck for a few days on this. I really appreciate your help. Thank you again! It's working perfectly now!

$\endgroup$

Your Answer

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