Skip to content

Getting started with RWS

Justin Huang edited this page Feb 1, 2017 · 15 revisions

Get the code

RWS runs on Python 2.7. It's recommended that you use ROS Indigo.

cd ~/catkin_ws/src
git clone [email protected]:hcrlab/rws.git

Ask Justin for a copy of secrets.py, or make your own secrets.py (described below).

Install requirements

Install libffi, which is needed for the Python requirements.

sudo apt-get install libffi-dev

Install the required Python packages.

cd rws
sudo pip install -r requirements.txt --upgrade

Finally, install rosbridge_server if you don't already have it.

sudo apt-get install ros-indigo-rosbridge-suite

Building the frontend requires Node, Gulp, Yeoman, and the Polymer generator:

cd frontend
npm install -g yo bower gulp grunt-cli generator-polymer # Install Bower, Grunt, Yeoman, and the Polymer generator
bower install && npm install # Install packages.
gulp # Build the frontend.

Set up an app

RWS looks in a particular catkin_ws folder for apps. The location of this folder can be specified in secrets.py (described below), but you will need to create it first. For example:

mkdir -p ~/rws/catkin_ws/src
cd ~/rws/catkin_ws/src
catkin_init_workspace
cd ..
catkin_make

A sample app you can put in the catkin workspace is Say something.

cd ~/rws/catkin_ws/src
git clone [email protected]:hcrlab/say_something.git
cd ..
catkin_make

Refer to the repo for the app you're installing for further installation instructions.

Set up user authentication

RWS uses Google Sign-in for user authentication. Follow the guide in Creating a Google Developers Console project and client ID to get a client ID and to configure your sign-in URLs. If you are a member of the HCR lab, contact Justin about using the lab's existing client ID for your RWS installation.

Configuration

You will need to create a secrets.py file in the same folder as main.py. secrets.py is kept out of this repository, and it may change. Currently, it must be a file that defines the following constants:

  • DEV_FRONTEND_ORIGIN: The protocol, server, and port of the frontend server during development. This is typically 'localhost:5000' when serving with gulp serve. The backend server is configured to serve on port 5001 in development mode, which means the AJAX requests from the frontend to the backend are cross-origin. The webserver needs to know where the frontend is being served from so that it can accept these cross-origin requests. In production, the frontend and backend are served by the same server, so this value is not used in production.
  • GOOGLE_CLIENT_ID: The Google Client ID for your app (see the above paragraph on setting up user authentication)
  • CATKIN_WS: The path to a catkin workspace you'd like to search for apps. For example, /home/rosie/rws/catkin_ws
  • BRINGUP_FILE: Path on the filesystem to a launch file that will bring up the robot. For the PR2, this might be /etc/ros/robot.launch, but, while developing, you will want to specify your own bringup file to start a simulated robot.

You can obtain a copy of secrets.py from Justin. Otherwise, see example_secrets.py for an example of what secrets.py should look like.

Running

First, source the catkin workspace that contains all your apps:

source /dir/to/rws/catkin_ws/devel/setup.bash

Do this before you running RWS, or just add it to your .bashrc for convenience.

Run python development_server.py.

Visit your site at localhost:5000.