Ask Your Question
1

ros3djs Arrow on SceneNode not moving with TF frame

asked 2013-06-27 03:55:53 -0600

hawesie gravatar image

I am trying to visualise the movements of TF frame using the Robot Web Tools I have a robot localising using amcl and I want to move an arrow along with one of its TF frames (base_link). According to my understanding of the tutorials, the code below should do this. However, instead the arrow is drawn at the origin of the fixed frame and doesn't move. I am using ROS Groovy plus the current CDN versions of the Robot Web Tools. Am I doing something wrong, or is there a bug stopping the expected behaviour?

  // Create the scene manager and view port for the 3D world.
  var viewer3D = new ROS3D.Viewer({
    divID      : 'threed-map',
    width      : 560,
    height     : 420,
    antialias  : true,
    background : '#EEEEEE'
  });

  // Create a TF client that subscribes to the fixed frame.
  var tfClient = new ROSLIB.TFClient({
    ros          : ros,
    angularThres : 0.01,
    transThres   : 0.01,
    rate         : 10.0,
    fixedFrame   : '/map'
  });

  var arrowNode = new ROS3D.SceneNode({
    tfClient : tfClient,
    frameID  : '/base_link',
    object   : new ROS3D.Arrow(),        
  });

  viewer3D.scene.add(arrowNode);
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-06-27 05:02:23 -0600

rtoris288 gravatar image

updated 2013-06-27 05:04:01 -0600

I was able to get your example to work (using turtlesim) without any problems. Here is what I ran:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="http://cdn.robotwebtools.org/threejs/current/three.min.js"></script>
<script src="http://cdn.robotwebtools.org/ColladaAnimationCompress/0.0.1/ColladaLoader2.min.js"></script>
<script src="http://cdn.robotwebtools.org/EventEmitter2/current/eventemitter2.min.js"></script>
<script src="http://cdn.robotwebtools.org/roslibjs/current/roslib.js"></script>
<script src="http://cdn.robotwebtools.org/ros3djs/current/ros3d.js"></script>

<script>
  function init() {
    var ros = new ROSLIB.Ros({
      url : 'ws://localhost:9090'
    });

     var viewer3D = new ROS3D.Viewer({
      divID      : 'threed-map',
      width      : 560,
      height     : 420,
      antialias  : true,
      background : '#111111'
    });

    // Create a TF client that subscribes to the fixed frame.
    var tfClient = new ROSLIB.TFClient({
      ros          : ros,
      angularThres : 0.01,
      transThres   : 0.01,
      rate         : 10.0,
      fixedFrame   : '/world'
    });

    var arrowNode = new ROS3D.SceneNode({
      tfClient : tfClient,
      frameID  : '/turtle1',
      object   : new ROS3D.Arrow(),        
    });

    viewer3D.scene.add(arrowNode);
  }
</script>
</head>

<body onload="init()">
  <div id="threed-map"></div>
</body>
</html>

After this, I ran the following commands:

roslaunch turtle_tf turtle_tf_demo.launch
rosrun tf2_web_republisher tf2_web_republisher
roslaunch rosbridge_server rosbridge_websocket.launch

Use your arrow keys on your keyboard to move the turtle (you must have turtle_tf_demo.launch terminal focused).

Make sure tf2_web_republisher is up and running before your connect. Also, check to see if results are being sent back to the client:

rostopic echo /tf2_web_republisher/feedback
edit flag offensive delete link more

Comments

Thanks for all your help today! Somehow tf2_web_republisher had fallen out of my launch file in some git merges. I was seeing the subscriptions popping up in rosbridge, but didn't twig that no-one was publishing on them. Putting it back in fixed this.

hawesie gravatar imagehawesie ( 2013-06-27 05:27:27 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-06-27 03:55:53 -0600

Seen: 562 times

Last updated: Jun 27 '13