UNPKG

@robot-web-tools/ros3djs

Version:

The standard ROS Javascript Visualization Library

64 lines (58 loc) 1.79 kB
<!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 : 'markers', width : 800, height : 600, antialias : true, alpha : 0.5 }); // Setup a client to listen to TFs. var tfClient = new ROSLIB.TFClient({ ros : ros, angularThres : 0.01, transThres : 0.01, rate : 10.0, fixedFrame : '/rotating_frame' }); // Setup the marker client. var imClient = new ROS3D.InteractiveMarkerClient({ ros : ros, tfClient : tfClient, topic : '/basic_controls', camera : viewer.camera, rootObject : viewer.selectableObjects }); } </script> </head> <body onload="init()"> <h1>Simple Interactive Marker Example</h1> <p>Run the following commands in the terminal then refresh this page.</p> <ol> <li><tt>roscore</tt></li> <li><tt>rosrun interactive_marker_tutorials basic_controls</tt></li> <li><tt>rosrun interactive_marker_proxy proxy topic_ns:=/basic_controls target_frame:=/rotating_frame</tt></li> <li><tt>rosrun tf2_web_republisher tf2_web_republisher</tt></li> <li><tt>roslaunch rosbridge_server rosbridge_websocket.launch</tt></li> </ol> <div id="markers"></div> </body> </html>