forked from RobotWebTools/ros3djs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge 'RobotWebTools/develop' into 'keego/ES5_WITH_TRANSPILER'
- This pulls in changes from PRs RobotWebTools#207, RobotWebTools#210, RobotWebTools#218, RobotWebTools#221, and RobotWebTools#223 - Note: src/sensors/Points.js was modified to *explicitly* extend THREE.Object3D to support transpiling
- Loading branch information
Showing
18 changed files
with
1,197 additions
and
859 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
|
||
<script src="https://static.robotwebtools.org/threejs/current/three.js"></script> | ||
<script src="https://static.robotwebtools.org/EventEmitter2/current/eventemitter2.min.js"></script> | ||
<script src="https://static.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 : 'velo_link' | ||
}); | ||
|
||
// var texture = new THREE.TextureLoader().load( "https://threejs.org/examples/textures/sprites/ball.png" ); | ||
|
||
var cloudClient = new ROS3D.PointCloud2({ | ||
ros: ros, | ||
tfClient: tfClient, | ||
rootObject: viewer.scene, | ||
topic: '/kitti/velo/pointcloud', | ||
max_pts: 200000, | ||
pointRatio: 3, | ||
messageRatio: 2, | ||
// material: { size: 7, sizeAttenuation: false, alphaTest: 0.5, transparent: true, map: texture }, | ||
material: { size: 3, sizeAttenuation: false }, | ||
// colorsrc: 'i', colormap: function(i) { return new THREE.Color(3*i,0,1-3*i); } | ||
colorsrc: 'z', colormap: function(z) { z=z+2; return new THREE.Color(z,0,1-z); } | ||
}); | ||
} | ||
</script> | ||
</head> | ||
|
||
<body onload="init()"> | ||
<h1><a href="http://www.cvlibs.net/datasets/kitti">Kitti</a> PointCloud2 Example</h1> | ||
<p>Run the following commands in the terminal then refresh the page.</p> | ||
<ol> | ||
<li><tt>roslaunch ros3djs.launch</tt></li> | ||
<li><tt>rosparam set use_sim_time true</tt></li> | ||
<li><tt>rosbag play -l --clock <a href="https://github.com/tomas789/kitti2bag">kitti_2011_09_26_drive_0002_synced.bag</a></tt></li> | ||
</ol> | ||
<div id="viewer"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
|
||
<script src="https://static.robotwebtools.org/threejs/current/three.js"></script> | ||
<script src="https://static.robotwebtools.org/EventEmitter2/current/eventemitter2.min.js"></script> | ||
<script src="https://static.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 | ||
}); | ||
|
||
// Zoom out the camera to see the trajectory | ||
viewer.cameraControls.zoomOut(20); | ||
|
||
// Place the cartesian origin near the gps fixes of the kitti rosbag | ||
var lon0 = 8.4320 * Math.PI/180; | ||
var lat0 = 49.0145 * Math.PI/180; | ||
var alt0 = 116; | ||
|
||
// Earth radius for the LLA -> ENU approximate conversion (no earth flattening) | ||
var radius = 6378137; | ||
|
||
// This object will be translated to the gps position | ||
var geom = new THREE.SphereGeometry( 0.5, 32, 32 ); | ||
var material = new THREE.MeshBasicMaterial( {color: 0xffff00} ); | ||
var object3d = new THREE.Mesh(geom, material); | ||
|
||
// This function converts the longitude/latitude/altitude of the gps fix | ||
// to the cartesian frame of its rootObject | ||
function convert(lon,lat,alt){ | ||
lon = lon * Math.PI/180; | ||
lat = lat * Math.PI/180; | ||
return new THREE.Vector3( | ||
(lon-lon0) * radius * Math.cos(lat), | ||
(lat-lat0) * radius, | ||
(alt-alt0) | ||
); | ||
} | ||
|
||
var navsatfix = new ROS3D.NavSatFix({ | ||
ros: ros, | ||
topic: '/kitti/oxts/gps/fix', | ||
rootObject: viewer.scene, | ||
object3d: object3d, | ||
convert: convert, | ||
material: { color: 0x00ffff, linewidth: 2 }, | ||
keep: 50, | ||
}); | ||
} | ||
</script> | ||
</head> | ||
|
||
<body onload="init()"> | ||
<h1><a href="http://www.cvlibs.net/datasets/kitti">Kitti</a> NavSatFix Example</h1> | ||
<p>Run the following commands in the terminal then refresh the page.</p> | ||
<ol> | ||
<li><tt>roslaunch ros3djs.launch</tt></li> | ||
<li><tt>rosparam set use_sim_time true</tt></li> | ||
<li><tt>rosbag play -l --clock <a href="https://github.com/tomas789/kitti2bag">kitti_2011_09_26_drive_0002_synced.bag</a></tt></li> | ||
</ol> | ||
<div id="viewer"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<launch> | ||
<include file="$(find rosbridge_server)/launch/rosbridge_websocket.launch" /> | ||
<node pkg="tf2_web_republisher" type="tf2_web_republisher" name="tf2_web_republisher" /> | ||
</launch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.