Skip to content

Detailed environment setup

Rich Wareham edited this page Oct 7, 2013 · 12 revisions

This page gives detailed command-by-command instructions for setting up your workspace once you have ROS installed. Follow the Ubuntu installation guide on the ROS website for that bit.

Note that the home directories on the wired lab computer are all mounted on a directory served from vega. On this page I'm using the example of rjw57 logged into the machine portia.

Create a workspace

Make a directory for your workspace and a src directory under it:

rjw57@portia:~$ mkdir ~/cued-masters/
rjw57@portia:~$ mkdir ~/cued-masters/src

Set up your environment to run ROS programs:

rjw57@portia:~$ source /opt/ros/hydro/setup.bash

Change into the src directory and create a catkin workspace.

rjw57@portia:~$ cd ~/cued-masters/src/
rjw57@portia:~/cued-masters/src$ catkin_init_workspace 
Creating symlink "/remote/homes/rjw57/cued-masters/src/CMakeLists.txt" pointing to "/opt/ros/hydro/share/catkin/cmake/toplevel.cmake"

Change into your workspace directory and "make" it:

rjw57@portia:~/cued-masters/src$ cd ~/cued-masters/
rjw57@portia:~/cued-masters$ catkin_make
Base path: /remote/homes/rjw57/cued-masters
Source space: /remote/homes/rjw57/cued-masters/src
[ ... stuff ... ]

Write a script to set up your environment

Use your favourite editor (which should be vim) to create the file ~/cued-masters/setup.bash file with the following contents:

source /opt/ros/hydro/setup.bash
source $HOME/cued-masters/devel/setup.bash
export ROS_HOSTNAME="`hostname`"
export ROS_MASTER_URI="http://${ROS_HOSTNAME}:11311"

Now you can set up your ROS environment each time you log into the machine:

rjw57@portia:~$ source ~/cued-masters/setup.bash

Alternatively you can add the line source ~/cued-masters/setup.bash to the bottom of ~/.bashrc if you don't want to bother doing this every time.

Set up SSH keys

Generate a SSH public key using the ssh-keygen program. You can press Enter at the prompts to accept the defaults. If you're security conscious, you can add a passphrase. Note that the lab machines are shared machines which a number of people have access to and so a passphrase is a Good Idea(TM).

rjw57@portia:~$ ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/remote/homes/rjw57/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /remote/homes/rjw57/.ssh/id_rsa.
Your public key has been saved in /remote/homes/rjw57/.ssh/id_rsa.pub.
The key fingerprint is:
be:e2:c5:a2:8b:6f:9c:e3:e9:ab:7b:fb:bd:6d:2b:84 rjw57@portia
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|                 |
|                 |
|       .S        |
|      Eo.        |
|   . ...+        |
|   .*o.+.o.      |
|  +OXBo.++o.     |
+-----------------+

Set up GitHub

Set up SSH connection to the robot

Test the ROS connection

Clone this wiki locally