Guest User

typeStringFromTopic_test.html

a guest
Apr 19th, 2012
84
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!doctype html>
  2. <html>
  3. <head>
  4.   <title>typeStringFromTopic Test</title>
  5.   <script type="text/javascript" src="http://brown-ros-pkg.googlecode.com/svn/trunk/experimental/rosbridge/ros.js"></script>
  6.   <script type="text/javascript">
  7. var con = new ros.Connection('ws://localhost:9090');
  8. con.setOnOpen(function() {
  9.   con.callService('/rosjs/topics',[],function(topics) {
  10.     var i = 0;
  11.     function getRemainingTypes() {
  12.       if (i < topics.length) con.callService('/rosjs/typeStringFromTopic',[topics[i]],function(rsp) {
  13.        document.getElementById('output').innerHTML += topics[i] + ' has type: ' + rsp + '<br/>';
  14.         i++;
  15.         getRemainingTypes();
  16.       });
  17.     }
  18.     getRemainingTypes();
  19.   });
  20. });
  21.   </script>
  22. </head>
  23. <body>
  24.   <h2>Topics &amp; Types:</h2>
  25.   <div style="padding-left: 2em;">
  26.     <span id="output"></span>
  27.   </div>
  28. </body>
  29. </html>
RAW Paste Data