ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Streaming point clouds to webservice with roslibjs

asked 2016-10-25 07:56:55 -0500

jacksonkr_ gravatar image

updated 2016-10-25 09:31:12 -0500

I know that I want the rostopic /camera/depth/points. If I rostopic echo /camera/depth/points then I can see that data in bash. I can also get the roslibjs example working just fine. I'm working across multiple machines so unfortunately ros3djs was not an option for me (*you can only render pointclouds on the localhost due to webgl limitations - more details at bottom of this question).

Good news is that I only want the data so I'm hoping to benifit from some of the ros3djs encoding. Anyway, I tried using roslibjs with object type std_msgs/PointCloud2 to no avail:

[ERROR] [WallTime: 1477400298.863397] [Client 0] [id: subscribe:/camera/depth/points:1] subscribe: Unable to import msg class PointCloud2 from package std_msgs. Caused by 'module' object has no attribute 'PointCloud2'

How can I get my pointcloud data from my ros instance on one machine to a non-ros machine using this webservice?


<!DOCTYPE html>
<meta charset="utf-8" />

<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>

<script type="text/javascript" type="text/javascript">
  // Connecting to ROS
  // -----------------

  var ros = new ROSLIB.Ros({
    url : 'ws://'

  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.');

  // Subscribing to a Topic
  // ----------------------

  var listener = new ROSLIB.Topic({
    ros : ros,
    name : '/camera/depth/points',
    messageType : 'std_msgs/PointCloud2'

  listener.subscribe(function(message) {
    console.log('Received message on ' + + ': ' +;

  <h1>Simple roslib Example</h1>
  <p>Check your Web Console for output.</p>

*(from the ros3djs example) Due to a bug in the current WebGL implementations, it is not possible to serve this file and the video stream from a different host or port number, so we need ros_web_video to serve the html file as well. If you use Apache, you can set it up to proxy port 9999 to a subdirectory.

-- UPDATE --

My issue is definitely because I'm not running tf2_web_republisher but I'm having a hard time getting it installed. I tried cloning the source to ~/catkin_ws/src, catkin_make, source ~/.bashrc with no success.

How do I get the tf2_web_republisher tool installed? I've already sudo apt-get install ros-kinetic-tf2*

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-10-25 15:07:36 -0500

jacksonkr_ gravatar image

I had to uninstall ubuntu 16.04 and move back to 14.04 so I could install ros-indigo because as far as I can tell, this setup ONLY works on indigo.

The package I was looking for is:


edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools



Asked: 2016-10-25 07:56:55 -0500

Seen: 944 times

Last updated: Oct 25 '16