Loading a URDF with meshes via AJAX?

338 views
Skip to first unread message

William Hilton

unread,
Aug 30, 2013, 1:48:48 PM8/30/13
to robot-w...@googlegroups.com
My name is Will Hilton, and I am working on <http://wmhilton.github.io/hubo-js>. I've been emailing with Igor Zubrycki who is working on <http://mymodelrobot.appspot.com>. Both of us are simulating robots in THREE.js. Neither of us are using Robot Web Tools yet, but I'll probably integrate it at some point when I need to communicate with ROS. Right now both of our programs run completely client-side with no server-side scripting.

We are both wanting to improve the URDF support of our apps, so I would like to know how one uses the Robot Web Tools URDF loader! I've looked at the code on <https://github.com/RobotWebTools/ros3djs/tree/devel/src/urdf> but couldn't understand how it is used. Does it load the meshes from a ROS server? Is it tightly integrated with the rest of RWT or can the loader be used separately? Questions like that.

In the best case scenario, what I would like is to allow users to simply paste a link to their URDF model on Github, and use that and AJAX to acquire the meshes from Github. I'm not entirely sure if that's possible, but that's my idea.

Thanks in advance for any responses.

Chad Jenkins

unread,
Sep 1, 2013, 2:47:03 PM9/1/13
to robot-w...@googlegroups.com

Hi Will,

Thanks for your question. I believe Russell is the right person to answer this question, but I will give it a try.

Did you look at URDF code inside roslibjs?
roslibjs should do the parsing of a URDF which can then be visualized using ros3djs.

Also, the following tutorial shows an example of a URDF being visualized using ros3djs:
Chad
___


--
You received this message because you are subscribed to the Google Groups "Robot Web Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robot-web-too...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Russell Toris

unread,
Sep 1, 2013, 9:40:34 PM9/1/13
to robot-w...@googlegroups.com
Hi Will-

The URDF loader can only load meshes from an HTTP server -- this is a limitation of the browser, not a RWT decision. Furthermore, the server must either be hosted on the same host as the webpage or the webserver must be configured with its CORS (Cross-Origin Resource Sharing) settings to allow for any origin to request the data (i.e.,  <AllowedOrigin>*</AllowedOrigin>). This is not the case with most web servers so I would doubt GitHub has it configured this way, but I am unsure. Again, these are browser limitations.

If you are interested in running the URDF loader, check out http://wiki.ros.org/ros3djs/Tutorials/VisualizingAURDF

Russell
--
Russell Toris
Graduate Student | WPI Department of Computer Science
rct...@wpi.edu | http://users.wpi.edu/~rctoris/

Russell Toris

unread,
Sep 1, 2013, 9:41:05 PM9/1/13
to robot-w...@googlegroups.com

William Hilton

unread,
Sep 2, 2013, 12:23:02 AM9/2/13
to robot-w...@googlegroups.com
Thank you Chad, and also Russell (hello again!). My thoughts:

Thanks for the link to the code in roslibjs (https://github.com/RobotWebTools/roslibjs/tree/devel/src/urdf). I hadn't seen that before, only the stuff in ros3djs.

I had seen the http://wiki.ros.org/ros3djs/Tutorials/VisualizingAURDF page before, but it has so much extra... stuff that it took me quite a while to whittle it down to the small piece I'm interested in. :-)

So what it sounds like I would want to do, is something like this:

// Obtain URDF file contents as a string of XML from Github.
// I've got working code for that, so it's no problem.
string = getURDF('http://github.com/foo/bar/adsf/model.urdf');

// hand off the XML string to the URDF model
var urdfModel = new ROSLIB.UrdfModel({
  string : string
});

// Part 2 of making the URDF model, which loads the meshes
var robot = new ROS3D.Urdf({
    urdfModel : urdfModel,
    path : "magical Github path"
}));
// Now I've got an object called 'robot' that is a superset of THREE.Object3D?

And in order to make the "magical Github path" work, I might have to add some functionality to ROS3D.MeshResource(). A trifle really, that I would have to deal with regardless of whether I was using my URDF loader or yours or Igor's.

But now I've got questions.
a) Where are the joints? It looks like ROSLIB.UrdfModel() loads all the links, but doesn't read in the joints (axis, upper limit, lower limit, etc.) Are you ignoring this because you can rely on the TF tree?

b) Regarding meshes, you don't have an STL loader? I'm looking Urdf.js. That's too bad. I had an experimental one at one point using THREE.STLLoader. I will definitely implement one, because my Darwin OP urdf is in STL, and I have friends who could use a Darwin OP in the browser.. On the bright side, you support textures and materials, which I currently don't.

c) Will the above pseudo-code not work? I'd be skipping the parts of the tutorial where you create a ROSLIB.Ros(), a ROS3D.Viewer(), and a ROSLIB.TFClient(). Are the parts I'm using going to bork if I skip those steps? I'm not asking if you can predict the exact outcome, just if you see reasons why this would fail for sure.

Regarding CORS: Actually, Github is configured for CORS for applications with OAuth access. However, I'm just using JSONP for now, and might add basic authentication eventually to overcome rate limiting. I'm trying to minimize the server-side code so I can host it statically on Github Pages.

Your thoughts?
Will


--
William Hilton
MET-lab PhD Student, ECE Department, Drexel University


--
You received this message because you are subscribed to a topic in the Google Groups "Robot Web Tools" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/robot-web-tools/1K-wcaDcbNA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to robot-web-too...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages