(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Running Rosbridge

Description: This tutorial shows you how to launch a rosbridge server and talk to it.

Keywords: rosbridge, roslibjs, teleoperation, Robot Web Tools

Tutorial Level: BEGINNER

Installing Rosbridge

Rosbridge depends on a basic installation of ROS. Check out the ROS Installation Guide for installing ROS on your machine.

After ROS is installed, you can install Rosbridge from a .deb package:

sudo apt-get install ros-<rosdistro>-rosbridge-suite

This will install the suite of rosbridge packages needed to get started.

Running Rosbridge

After installing ROS and rosbridge, you need to make sure your system is aware of the packages. To set up your environment for ROS and rosbridge:

source /opt/ros/<rosdistro>/setup.bash

All that's left is to run rosbridge. To launch rosbridge and its packages like rosbridge_server and rosapi, a launch file is included in the install. To launch the file, run:

roslaunch rosbridge_server rosbridge_websocket.launch

This will run rosbridge and create a WebSocket on port 9090 by default.

You can configure the port by setting the ~/port param in ROS. An example launch file that will run rosbridge on port 8080 would look like:

  <include file="$(find rosbridge_server)/launch/rosbridge_websocket.launch" > 
     <arg name="port" value="8080"/>

Talking to Rosbridge

Now that rosbridge has been launched and a WebSocket connection is available, we can create a basic HTML webpage to send and receive calls to rosbridge. Roslibjs is a JavaScript library that handles the communication for you. Check out the getting started with roslibjs tutorial to create a webpage with roslibjs and rosbridge.

Wiki: rosbridge_suite/Tutorials/RunningRosbridge (last edited 2015-01-22 03:51:23 by Sergey Zolotykh)