I'm trying to visualize a 3d robot simulation on a web browser and I'm currently using the ros3djs library (not sure if this is the best choice yet).

Some days ago I managed to visualize correctly the PR2 robot as shown in this tutorial, and then I replaced it with my robot meshes and urdf. The meshes were visible but the relations between links and joints weren't correct and the robot seemed just hit by a truck.

Suddenly, yesterday, the meshes of my robot stopped being visualized in the browser and I realized that the the HTTP request of the meshes (sent by the ROS3D.UrdfClient function) are not made anymore.

I tried to remove and update the ros3d.js file but didn't work.

I don't have any idea of where the problem could be.

The only comment I can make is that yesterday I was trying to solve the problem of the meshes (related to the tf2_web_republisher) node and I added a new node aiming to republish the messages from the /tf topic to the /tf2_web_republish/goal. That didn't even work and I don't think that this can be the cause, but who knows.

This is the code that I'm using to visualize the 3D simulation.

  async function init(){

    var ros = new ROSLIB.Ros({
      url : 'ws://localhost:9090'
    ros.on('connection', function() {
      console.log('Connected to websocket server.');
    ros.on('error', function(error) {
      console.log('Error connecting to websocket server: ', error);
    ros.on('close', function() {
      console.log('Connection to websocket server closed.');

    // Create the main viewer.
    var rosViewer = new ROS3D.Viewer({
      divID : 'urdf',
      width : 800,
      height : 600,
      antialias : true,

    // Add a grid.
    rosViewer.addObject(new ROS3D.Grid());

    // Setup a client to listen to TFs.
    var tfClient = new ROSLIB.TFClient({
      ros : ros,
      angularThres : 0.01,
      transThres : 0.01,
      rate : 10.0

    //// Setup the URDF client.
    //var urdfClient = new ROS3D.UrdfClient({
    //  ros : ros,
    //  tfClient : tfClient,
    //  path: 'https://raw.githubusercontent.com/PR2/pr2_common/melodic-devel/',
    //  rootObject : rosViewer.scene,

    var urdfClient = new ROS3D.UrdfClient({
      ros : ros,
      tfClient : tfClient,
      path: 'static/',
      rootObject : rosViewer.scene,




And this is the launch file that I made and used to work:

    <arg name="model"   default="h2017"/>
    <arg name="ns"      default="dsr01"/>
    <arg name="gui"     default="True" />
    <arg name="remap"   default="False"/>
    <arg name="color"   default="white"/>
    <arg name="gripper" default="none"/>
    <arg name="rviz"    default="True"/>

    <param name="robot_description" command="$(find xacro)/xacro '$(find dsr_description)/xacro/$(arg model).urdf.xacro' '--inorder' 'namespace:=$(arg ns)' color:=$(arg color) gripper:=$(arg gripper)"/>

  <node name="ros_bridge_websocket_name" pkg="rosbridge_server" type="rosbridge_websocket" /> 

  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />   <param name="use_gui" type="bool" value="true" />     <!-- this next node gives control over the joints
-->   <node name="joint_state_publisher_gui" pkg="joint_state_publisher_gui" type="joint_state_publisher_gui" />   <node name="tf2_web_republisher" pkg="tf2_web_republisher" type="tf2_web_republisher" />   <node name="map_server" pkg="map_server" type="map_server" args="/home/dario/maps/rail_maps/ilab.pgm 0.05" />
     <!-- Show in Rviz -->
    <group if="$(eval arg('rviz') == True)">
    <node name="rviz" pkg="rviz" type="rviz" args="-d $(find dsr_description)/rviz/default.rviz"/>

I'm using ROS Noetic on Ubuntu 20.04.

I hope I wrote all the relevant informations. Thanks to everyone that may help.


1 Answer 1


The problem about the meshes has been resolved. I had to add the rosapi node to the launch file as follows: <node name="ros_api" pkg="rosapi" type="rosapi_node" />.

Regarding the problem with the tf2_web_republisher, I realized that the problem was related to the name of the base link. In fact, in my robot xacro files the first link was referred as "base_0" while the ros3djs library expect the first link named as: "base_link".

So I simply used the command grep -r -l base_0 (Ubuntu) to search for all the files that contain that name and replaced it with the correct one.

After this everything worked.

  • $\begingroup$ It is great that you found a (partial?) solution. However, you can't ask a follow up questions in an answer (you won't get an answer). Either, edit this answer into your question (thereby changing the question) and delete this answer, or (preferably) ask a new question and delete the last sentence from this answer (and mark this as the accepted answer to your original question. Hopefully that makes sense. Please take the tour to better understand how the Q&A mechanism of Stack Exchange operates. $\endgroup$ Commented Jun 19 at 13:56
  • $\begingroup$ Yes you're right, thanks for the suggestion. Luckily I also solved that problem :) $\endgroup$
    – Dario
    Commented Jun 21 at 15:34
  • $\begingroup$ If you resolved the issue of the robot appearing crushed, then please edit and update your answer. It might be useful to someone else. Thanks. $\endgroup$ Commented Jun 21 at 16:36

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.