My favorites | Sign in
Project Home Downloads Wiki Issues Source
Quick start for rosbridge and ROS
Updated Jul 12, 2011 by


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".

Installing ROS and support packages

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.

Core ROS installation

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 maverick main" > /etc/apt/sources.list.d/ros-latest.list'

> wget -O - | sudo apt-key add -

> sudo apt-get update

> sudo apt-get install ros-diamondback-desktop

ROS shell environment setup

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

Install support packages for robot drivers, video, etc.

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:

  • ardrone_brown (this additionally requires building Parrot's AR.Drone SDK)
> cd /home/obot/ros/brown-ros-pkg/experimental

> svn checkout

> cd ardrone_brown

> ./

> cmake .

> rosmake ardrone_brown
  • drone_teleop
> cd /home/obot/ros/brown-ros-pkg/experimental

> svn checkout

> rosmake drone_teleop
  • ar_recog
> cd /home/obot/ros/brown-ros-pkg/experimental

> svn checkout

> cd ar_recog

> cmake .

> rosmake ar_recog
  • nolan
> cd /home/obot/ros/brown-ros-pkg/experimental

> svn checkout

> rosmake nolan
  • nolan3d
> cd /home/obot/ros/brown-ros-pkg/experimental

> svn checkout

> rosmake nolan3d
  • wiimote_twist
> cd /home/obot/ros/brown-ros-pkg/experimental

> svn checkout

> rosmake wiimote_twist

Set environment variables

> gedit ~/.bashrc

Add the following lines to the bottom of the opened text editing window:

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.

Using ROS and rosbridge for simple movement and video

Using ROS: turtlesim control from the command line

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:

> roscore

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.

Using rosbridge: turtlesim control from your web browser

Assuming roscore and turtlesim are still running, run rosbridge in an available terminal window:

> rosrun rosbridge

In a new terminal window, use the ifconfig program to find the IP address (e.g., "") of your system running ROS (this should be located under "eth0" with the label "inet addr"):

> ifconfig

On a separate machine, download and unarchive the example "turtlesim_rosbridge" directory in 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://");

Open "turtlesim_rosbridge.html" in a web broswer that supports websockets, such as Google Chrome. This page can test your web browser for websocket support.

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.

Using ROS: streaming video to your web browser

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.

Run mjpeg_server:

> 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 = ""

<img id="video" src="">

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'''

Using the AR.Drone with rosbridge

'''Assuming there are not running ROS nodes,''' start roscore:

> 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

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 = ""

connection = new ros.Connection("ws://");

<img id="video" src="">

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

Not totally covered (yet)

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 Remote Lab

PR2 programming: person following, localization and mapping, nav_stack

  • Localization and mapping with

Comment by, Jul 12, 2011

Under Using rosbridge: turtlesim control from your web browser:

rosrun rosbridge

Comment by, Jul 16, 2011

Under Using ROS: Streaming videos in your web browser

rosrun image_view image_view image:=/gscam/image_raw
rosrun mjpeg_server mjpeg_server
Comment by project member, Jul 18, 2011

need to add:

(for mjpeg_server) sudo apt-get install ros-diamondback-remote-lab

(for image_view) sudo apt-get install ros-diamondback-image-pipeline

Comment by project member, Jul 18, 2011

temporary workaround because 404 issues with ros packages (due to electric release?) sudo mkdir /opt/ros/diamondback/stacks/mjpeg_server sudo svn checkout mjpeg_server_url? cd mjpeg_server sudo rosmake (did not work for some reason, used instead "sudo bash", "rosmake", "exit")

Comment by, Dec 1, 2011

I couldn't find the perception package, so I have build it from source like this:

> cd ~/ros_workspace/brown-ros-pkg/experimental > svn checkout > rosmake brown_perception > rosdep install gscam

Comment by, Dec 3, 2011

But that didn't work! gscam does not build on my ros electric installation, svn does not download the make file. When I download the make file manually, rosmake complains while building gscam. I get the following error:

/usr/bin/ld: CMakeFiles/gscam.dir/src/gscam.o: undefined reference to symbol 'gst_base_sink_get_type' /usr/bin/ld: note: 'gst_base_sink_get_type' is defined in DSO /usr/lib/ so try adding it to the linker command line /usr/lib/ could not read symbols: Invalid operation collect2: ld returned 1 exit status

Comment by, Dec 3, 2011

I found a solution for gscam (part of the perception package) that failed to build on Ubuntu 11.10 running ros electric. I added gstbase-0.10 to the target_link_libraries in file brown_perception/gscam/CMakeLists.txt. All steps:

1. svn checkout

2. vi brown_perception/gscam/CMakeLists.txt (Add gstbase-0.10 to the target_link_libraries array)

3. rosmake brown_perception

I found the solution here:

Comment by, Dec 3, 2011

I had to build the Bosch mjpeg_server package for getting the webcam to work. Like this:

1. svn checkout

2. rosmake remote_lab (got errors, so I did)

3. cd remote_lab

4. rosmake mjpeg_server

Sign in to add a comment
Powered by Google Project Hosting