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

Cannot load Mesh Marker in ros3djs

asked 2014-06-26 15:05:17 -0500

David Lu gravatar image

updated 2014-06-27 12:55:23 -0500

Continuation from here

Attempting to load a mesh marker in the browser results in the following errors:

XMLHttpRequest cannot load file:///pr2_description/meshes/base_v0/base.dae. Cross origin requests are only supported for HTTP. index.html:1
Uncaught NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'file:///pr2_description/meshes/base_v0/base.dae'. ColladaLoader2.min.js:1

Edit: The above error message occurs when trying to access file:///home/dlu/.../index.html. Accessing http://localhost/.../index.html results in the following error.

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost/pr2_description/meshes/base_v0/base.dae

As noted on the linked page, the mesh_resource given is "package://pr2_description/meshes/base_v0/base.dae".

edit retag flag offensive close merge delete

Comments

Can you describe how you access the webpage? You might need to open the page with webserver. Accessing html file directly from filesystem may cause problem.

jihoonl gravatar image jihoonl  ( 2014-06-27 04:28:16 -0500 )edit

Updated to reflect webpage access.

David Lu gravatar image David Lu  ( 2014-06-27 12:55:46 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-06-28 13:09:00 -0500

rtoris288 gravatar image

You need to tell the Collada loader where the meshes live (they must come from an HTTP file server as roslibjs has no access to the ROS file system). If a resource is package://pr2_description/meshes/base_v0/base.dae, roslibjs will replace this with http://localhost/pr2_description/mesh... by default. You can change the preface with an optional argument.

Since you are using the PR2 meshes, you can use the Robot Web Tools file servers ( http://wiki.ros.org/ros3djs#Mesh_Reso... ). Any custom meshes will have to be setup on your local HTTP server. Setting up the interactive marker client to read from this server is similar to the line in this URDF example ( http://wiki.ros.org/ros3djs/Tutorials... ). That is,

var imClient = new ROS3D.InteractiveMarkerClient({
  ros : ros,
  tfClient : tfClient,
  topic : '/basic_controls',
  camera : viewer.camera,
  rootObject : viewer.selectableObjects,
  path : 'http://resources.robotwebtools.org/'
});

Doc line as well: https://github.com/RobotWebTools/ros3...

edit flag offensive delete link more

Comments

Thanks Russell!

David Lu gravatar image David Lu  ( 2014-06-30 10:07:59 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-06-26 15:05:17 -0500

Seen: 1,156 times

Last updated: Jun 28 '14