Quick start for rosbridge and ROS
This is a quick start guide for installing and using ROS through rosbridge with the iRobot Create, AR.Drone, and turtlesim. This guide assumes the Diamondback version of ROS is running in Ubuntu Linux Version 10.10 (Maverick). For convenience, this installation is running as a virtual machine in VMWare Fusion Version 3.1.3 (416484). The VMWare image resulting from this guide is provided here, which is in tar-gzip compressed archive. The user created for this image, and assumed for this guide, is "obot" with password "obot".
Instructions for installing ROS in Ubuntu are available from the main ROS web site. These directions are summarized as follows for installing ROS, important ROS packages/stacks, and other relevant software. If you are using the VM image provided, please skip ahead to the "Using ROS and rosbridge..." section.
Open a terminal window from the menu panel (at the top of the screen) under Applications > Accessories > Terminal. Using the apt-get package manager, run the following commands at the prompt (noted as "> ") to install ROS:
> sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu maverick main" > /etc/apt/sources.list.d/ros-latest.list' > wget http://packages.ros.org/ros.key -O - | sudo apt-key add - > sudo apt-get update > sudo apt-get install ros-diamondback-desktop
Once ROS is installed, set your command line environment to know where ROS is in your filesystem:
> echo "source /opt/ros/diamondback/setup.bash" >> ~/.bashrc > . ~/.bashrc
Some of these packages are available through apt-get:
> sudo apt-get install ros-diamondback-brown-drivers > sudo apt-get install ros-diamondback-brown-perception > sudo apt-get install ros-diamondback-brown-remotelab > sudo apt-get install ros-diamondback-joystick-drivers > sudo apt-get install libsdl-dev > sudo apt-get install guvcview
Some of these packages require checking out and building code from various repositories (such as brown-ros-pkg). For such packages, you should create a working "ros" directory under the user's home directory, which will be ("~/ros"), and let your shell know about this directory through the ROS_PACKAGE_PATH environment variable:
> cd ~ > mkdir ros > cd ros > pwd (this should output "/home/obot/ros") > export ROS_PACKAGE_PATH=/home/obot/ros:$ROS_PACKAGE_PATH > mkdir brown-ros-pkg > cd brown-ros-pkg > mkdir experimental > cd experimental
From this directory, run the commands below to checkout and build the following packages:
> cd /home/obot/ros/brown-ros-pkg/experimental > svn checkout https://brown-ros-pkg.googlecode.com/svn/trunk/experimental/ardrone_brown > cd ardrone_brown > ./build_sdk.sh > cmake . > rosmake ardrone_brown
> cd /home/obot/ros/brown-ros-pkg/experimental > svn checkout https://brown-ros-pkg.googlecode.com/svn/trunk/experimental/drone_teleop > rosmake drone_teleop
> cd /home/obot/ros/brown-ros-pkg/experimental > svn checkout https://brown-ros-pkg.googlecode.com/svn/trunk/experimental/ar_recog > cd ar_recog > cmake . > rosmake ar_recog
> cd /home/obot/ros/brown-ros-pkg/experimental > svn checkout https://brown-ros-pkg.googlecode.com/svn/trunk/experimental/nolan > rosmake nolan
> cd /home/obot/ros/brown-ros-pkg/experimental > svn checkout https://brown-ros-pkg.googlecode.com/svn/trunk/experimental/nolan3d > rosmake nolan3d
> cd /home/obot/ros/brown-ros-pkg/experimental > svn checkout https://brown-ros-pkg.googlecode.com/svn/trunk/experimental/wiimote_twist > rosmake wiimote_twist
> gedit ~/.bashrc
Add the following lines to the bottom of the opened text editing window:
export ROS_PACKAGE_PATH=~/ros:$ROS_PACKAGE_PATH export GSCAM_CONFIG="v4l2src device=/dev/video0 ! video/x-raw-rgb,width=320,height=240,framerate=(fraction)30/1 ! ffmpegcolorspace"
Save this file and exit the browser.
If your ROS install was successful, you should now be able to run the turtlesim and drive the turtle around a window. Open a terminal window (Applications > Accessories > Terminal), and run the following command to start the ROS master node:
Open a new terminal (from the menu "File > Open Tab" or pressing Control-Shift-T), and run the following command to start the turtlesim:
> rosrun turtlesim turtlesim_node
If successful, a window labeled "TurtleSim" should appear with the image of a turtle in the center.
You can control this turtle to move around this window by opening a new terminal and running the following command:
> rosrun turtlesim turtle_teleop_key
Press Control-C in this terminal to stop the teleoperation ROS node.
Assuming roscore and turtlesim are still running, run rosbridge in an available terminal window:
> rosrun rosbridge rosbridge.py
In a new terminal window, use the ifconfig program to find the IP address (e.g., "172.16.115.144") of your system running ROS (this should be located under "eth0" with the label "inet addr"):
On a separate machine, download and unarchive the example "turtlesim_rosbridge" directory in turtlesim_rosbridge.zip. In this directory, find the following line the file "turtlesim_rosbridge.html" and change the listed IP to the IP address for your machine running ROS:
connection = new ros.Connection("ws://172.16.115.144:9090");
If successful, the "turtlesim_rosbridge.html" page should allow you to move the turtle around from the web browswer using your keyboard arrow keys or buttons in the browser. The terminal running rosbridge should acknowledge the connection between ROS and your browser with an "Actual handshake!" message.
Plug in a USB camera (in this case a PS3 Eye) into your machine running ROS. If you are running in a virtual machine, this camera should connect to the VM running Linux and not the host.
Assuming this camera is connected to "/dev/video0" in Linux, make sure the video camera is working by running guvcview in a new terminal:
> guvcview -d /dev/video0
A window should appear showing the video stream from the PS3 cam. If this window does not show a clear video stream, go to the GUVCViewer Controls under "Video & Files" and set the frame rate to 30 and resolution to 320x240.
Assuming your camera is working, run gscam (the ROS GStreamer node), which should output "Processing..." to show it is working:
> rosrun gscam gscam
Run the image_view node to make sure ROS is properly using the gscam video stream in a new terminal:
> rosrun image_view image_view image:=/gscam/image_raw
This should show the video stream in a new window. Close this window if working.
> rosrun mjpeg_server mjpeg_server
On your separate machine, edit the "turtlesim_rosbridge.html" page to put the ROS machine IP address into the following lines:
img.src = "http://172.16.115.144:8080/stream?topic=/gscam/image_raw" <img id="video" src="http://172.16.115.144:8080/stream?topic=/gscam/image_raw">
Go to your web browser and reload the "turtlesim_rosbridge.html" page. You should now see the camera video stream in your browser, while still being able to control the turtle with buttons and arrow keys.
'''Close all ROS nodes at this point'''
'''Assuming there are not running ROS nodes,''' start roscore:
Assuming you have an AR.Drone, start this robot and ensure its green lights are on (indicating it is ready for use). From your machine running ROS (or host machine if running in a VM), connect the wireless network device to the AR.Drone's network, with SSID of the form "ardrone_123456".
Start the ardrone_brown ROS node:
> rosrun ardrone_brown ardrone_driver
and run image_view to see video from the drone:
> rosrun image_view image_view image:=/gscam/image_raw
To drive the drone, drone_teleop
> rosrun drone_teleop drone_teleop.py
If successful, you should be able to drive the AR.Drone using drone_teleop. When done, press Control-C to stop drone_teleop.
Run rosbridge and mjpeg_server:
> rosrun rosbridge rosbridge > rosrun mjpeg_server mjpeg_server
On a separate machine, find the folder "turtlesim_rosbridge". Find the following line the file "turtlesim_rosbridge.html" and change the listed IP to the IP address for your machine running ROS:
img.src = "http://172.16.115.144:8080/stream?topic=/ardrone/image_raw" connection = new ros.Connection("ws://172.16.115.144:9090"); <img id="video" src="http://172.16.115.144:8080/stream?topic=/ardrone/image_raw">
Open or reload "turtlesim_rosbridge.html" in the web broswer that supports websockets. If successful, you should be able to have the drone take off, fly it around, and see the video stream from the AR.Drone
Controlling an iRobot Create using irobot_create_2_1 and teleop_twist_keyboard
AR tag recognition using ar_recog, as a wrapper around ARToolKit
Creating your own packages for ROS using roscreate-pkg
Programming using Processing in browser with ROS
PR2 programming: person following, localization and mapping, nav_stack