Skip to content

Commit

Permalink
Merge pull request RobotWebTools#181 from RobotWebTools/pointcloud2_e…
Browse files Browse the repository at this point in the history
…xample

add pointcloud2 example
  • Loading branch information
sevenbitbyte authored Jul 11, 2017
2 parents 8199a0a + f47b4dd commit fad674b
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions examples/pointcloud2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />

<script src="http://cdn.robotwebtools.org/threejs/current/three.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="../build/ros3d.js"></script>

<script>
/**
* Setup all visualization elements when the page is loaded.
*/
function init() {
// Connect to ROS.
var ros = new ROSLIB.Ros({
url : 'ws://localhost:9090'
});

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

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

var cloudClient = new ROS3D.PointCloud2({
ros: ros,
tfClient: tfClient,
rootObject: viewer.scene,
topic: '/camera/depth_registered/points'
});
}
</script>
</head>

<body onload="init()">
<h1>Simple PointCloud2 Example</h1>
<p>Run the following commands in the terminal then refresh the page.</p>
<ol>
<li><tt>roscore</tt></li>
<li><tt>roslaunch rosbridge_server rosbridge_websocket.launch</tt></li>
<li><tt>rosrun tf2_web_republisher tf2_web_republisher</tt></li>
<li><tt>roslaunch openni_launch openni.launch depth_registration:=true</tt></li>
</ol>
<div id="viewer"></div>
</body>
</html>

0 comments on commit fad674b

Please sign in to comment.