Advertisement
Guest User

Wiring, Javascript, and ROS

a guest
Feb 12th, 2012
544
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. The previous screencast (giving more background on the rosbridge protocol), can be viewed here:
  2.  
  3. http://www.youtube.com/watch?v=kaiwwaqH9jA
  4.  
  5. --------------------
  6.  
  7. More information on the Ping sensor (including the timing diagram shown in the video) is available on Parallax's product page for the Ping here:
  8.  
  9. http://www.parallax.com/tabid/768/ProductID/92/Default.aspx
  10.  
  11. --------------------
  12.  
  13. To wire the Ping as in the video, the connections are:
  14.  
  15. Ping Arduino
  16. GND<--->GND (either will do)
  17. 5V <--->5V
  18. SIG<--->12
  19.  
  20. --------------------
  21.  
  22. The code for the Wiring sketch written in the video can be found here:
  23.  
  24. http://pastebin.com/BDHVEPbw
  25.  
  26. --------------------
  27.  
  28. The HTML page written in the video can be found here:
  29.  
  30. http://pastebin.com/V1fEemg4
  31.  
  32. --------------------
  33. Assuming your Arduino is connected to /dev/ttyACM0, you can run the project featured in the video by:
  34.  
  35. 1) connecting the Ping sensor to your Arduino as described
  36. 2) uploading the supplied sketch to the Arduino board
  37. 3) starting a roscore
  38. 4) starting rosbridge
  39. 5) running the command:
  40.  
  41. socat /dev/ttyACM0,ignoreeof - | sed -u -e '1,1 s/^.*/raw\r\n\r\n/' -e '1! s/\([0-9]*\)/\x00{"receiver":"\/echoTime","msg":{"data":\1},"type":"std_msgs\/Int64"}\xff/' | nc localhost 9090
  42.  
  43. either in the background (via &) or in a dedicated terminal
  44.  
  45. 6) opening the supplied web page in a web-socket enabled browser
  46.  
  47. --------------------
  48.  
  49. As always, you can always check out the latest rosbridge related tutorials and info at:
  50.  
  51. http://www.ros.org/wiki/rosbridge
  52.  
  53. or you can ask for help on IRC. #rosbridge is on the Freenode network.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement