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

ROS3D.js how to setup the namespace

asked 2019-02-19 10:38:18 -0500

balint.tahi gravatar image


I am running my node with a launch file, in a namespace. Lets call it: my_namespace. I am getting the following error when I am trying to use the example urdf.html in ros3djs package:

Uncaught TypeError: Cannot read
property 'documentElement' of
    at new UrdfModel (roslib.js:4140)
    at ros3d.js:54785
    at roslib.js:2108
    at Ros.<anonymous> (roslib.js:2828)
    at Ros.listener (roslib.js:698)
    at Ros.EventEmitter.emit (roslib.js:762)
    at handleMessage (roslib.js:2971)
    at handlePng (roslib.js:2987)
    at WebSocket.onMessage (roslib.js:3054)

So far, I figured out, that the problem is the following: the lib tries to get the robot_description (and I think everything else) as rosparam get robot_description (ofc through rosbridge, so calling rosapi/get_param service, with the robot_description param). The response is ofc. empty, because it is not existing. The param I have is /my_namespace/robot_description. If I debug in chrome, stop the code, where it gets the params and change to "/my_namespace/robot_description" from the normal "robot_description", it gets its value correctly. Ofc. this is not solving my issue, because I guess everywhere else I should include the namespace as well.

I was not able to find the right parameter, where I should set the namespace. Where should I set a "global" namespace parameter?

Thanks in advance!


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-02-19 10:48:18 -0500

balint.tahi gravatar image

updated 2019-02-20 02:29:13 -0500

gvdhoorn gravatar image

Ok, I found, that the right parameter is the UrdfClient({ .... param: '/my_namespace/robot_description', ...}). Now I don't have the error, in the console I can see it downloads the files, but the viewer itself is empty.

If I run my node without namespace, it is fine (ofc without the param option), I can see the models, so the problem is not in the model files (dae, stl). When I move to the node, it fails showing the model.

The solution: add the serverName param with /<namespace>/tf2_web_republisher value to the tfclient and set the param for the urdfclient to /<namespace>/robot_description. A lot of not well documented secret param in a 60k lines long code :)

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2019-02-19 10:38:18 -0500

Seen: 459 times

Last updated: Feb 20 '19