# ROS3D.js how to setup the namespace

Hi,

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
undefined
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 this.name 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?

Balint

edit retag close merge delete

Sort by » oldest newest most voted

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 :)

more