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

Streaming point clouds to webservice with roslibjs

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

jacksonkr_ gravatar image

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

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?

CODE

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

<script type="text/javascript" src="http://cdn.robotwebtools.org/EventEmitter2/current/eventemitter2.min.js"></script>
<script type="text/javascript" src="http://cdn.robotwebtools.org/roslibjs/current/roslib.min.js"></script>

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

  var ros = new ROSLIB.Ros({
    url : 'ws://192.168.1.100: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.');
  });

  // 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 ' + listener.name + ': ' + message.data);
    listener.unsubscribe();
  });
</script>
</head>

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

*(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
0

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

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:

ros-indigo-tf2-web-republisher

edit flag offensive delete link more

Question Tools

2 followers

Stats

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

Seen: 1,111 times

Last updated: Oct 25 '16