Quick Start for Two Computers

Two_Computers.png

Contents

  1. Quick Start for Two Computers
    1. Necessary Hardware
    2. Install ROS Indigo on Robot Computer
      1. Some assumptions about your Ubuntu Install
      2. Setup your ROS sources.list
      3. Set up your ROS keys
      4. ROS Installation
      5. Initialize rosdep
      6. Getting rosinstall
    3. Install required packages
      1. Install useful Linux utilities
      2. Install required ROS third party packages for segway_v3_robot
      3. Add yourself to the dialout group
    4. Environment setup
    5. Setup Workspace
    6. Modify Sudo
    7. Setup chrony
    8. Additional Steps
      1. Open the grub configuration
      2. Add this line
      3. Update the USB memory buffer to handle USB3
      4. Save and exit
      5. Update Grub
      6. Restart the computer
    9. Robot Customization
      1. Edit the setup configuration
      2. Compile from source
      3. Future Changes
    10. Network Setup
      1. Network Overview
        1. Set the IP of eth0 to the robot and sensor network
        2. Make sure you setup the networking for all the sensors
        3. Save the file and exit
        4. Restart the computer
        5. Check your settings
    11. Test your setup
      1. Manual Launch
      2. Manual launch works, time to install the service
      3. Start the service and make sure it starts up fine
      4. Save anything you might have open
      5. Power off the RMP
      6. Power the PC from the RMP
      7. Power on the system
    12. Install ROS Indigo on desktop computer
      1. Some assumptions about your Ubuntu Install
      2. Setup your ROS sources.list
      3. Set up your ROS keys
      4. ROS Installation
      5. Initialize rosdep
      6. Getting rosinstall
    13. Install required packages
      1. Install useful Linux utilities
      2. Install required ROS third party packages for segway_v3_robot
      3. Add yourself to the dialout group
    14. Environment setup
    15. Setup Workspace
    16. Network Setup
      1. Setup Wireless Router
      2. Local ROS Networking Configuration
      3. Configure networking on desktop computer
    17. Setup Robot PC Name Resolution
    18. Make sure you can ping the robot
    19. Setup an SHH connection
      1. Setup your SSH Keys
      2. Copy the public key
    20. Setup chrony

Necessary Hardware

  • RMP system compatible hardware
    • Must have been purchased from Stanley Innovation an original Segway RMP will not work.
  • 2 x Computers with Ubuntu 14.04 LTS
    • Platform computer should be powered by 12VDC so it can be run from the platform
    • Minimum 8GB RAM (16 GB prefered)
    • Preferably a reasonably fast SSD
    • Preferably 2 Gigabit NICS
      • You don't need 2 but it is better to have one dedicated to ROS and one to hardware)
    • At least 4 USB 2.0 or higher ports
      • Only if using IMU, GPS and joystick
    • Atleast 1 USB 3.0 port
      • Only if using PGR Flea3 USB3 camera
  • Wireless router (preferably AC Dual-Band) mounted to the platform
    • We provide the WRT-AC1900 with our integrated systems
  • Logitech F710 Joystick or equivalent
  • Components for Setup
    • Monitor
    • Keyboard (and mouse probably)
    • Internet Connection
    • Power supply for PC

Install ROS Indigo on Robot Computer

Perform these install steps on the computer responsible for robot control.

Some assumptions about your Ubuntu Install

These instructions make the following assumptions about your Ubuntu 14.04LTS install. These are not hard and fast rules, however, the instructions assume these things. When asked during the install you should select the following:

  • username : sibot

  • computer name : SIBOT1

  • password : Welcome00

  • The SSH client and server are installed.
    • If not run the following commands:

sudo apt-get update
sudo apt-get install openssh-client
sudo apt-get install openssh-server

Setup your ROS sources.list

Setup your computer to accept software from packages.ros.org. ROS Indigo ONLY supports Saucy (13.10) and Trusty (14.04) for debian packages.

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

Set up your ROS keys

sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

ROS Installation

Make sure the Debian package is up to date:

sudo apt-get update
sudo apt-get install ros-indigo-desktop-full

Initialize rosdep

sudo rosdep init
rosdep update

Getting rosinstall

Rosinstall is a frequently used command-line tool in ROS that is distributed separately. It enables you to easily download many source trees for ROS packages with one command.

sudo apt-get install python-rosinstall

Install required packages

Connected to the internet run the following commands:

Install useful Linux utilities

These tools are useful for monitoring system processes, setting up networking, and setting up NTPD for the remote computer. They are not necessary but recommended.

sudo apt-get install iperf chrony htop bridge-utils

Install required ROS third party packages for segway_v3_robot

These are the packages that RMP V3 depends on:

sudo apt-get install ros-indigo-navigation ros-indigo-gmapping ros-indigo-robot-localization ros-indigo-yocs-cmd-vel-mux ros-indigo-joy ros-indigo-urg-node ros-indigo-lms1xx ros-indigo-pointgrey-camera-driver ros-indigo-cmake-modules ros-indigo-imu-tools daemontools openssh-server libpcap0.8-dev

Add yourself to the dialout group

This is necessary if you have serial, or serial-USB devices:

sudo adduser $USER dialout

Environment setup

Edit the local bash environment to add a few useful aliases:

gedit ~/.bashrc

Add the following lines to the end of the file each provides a few shortcuts:

source /opt/ros/indigo/setup.bash
alias sws='source ./devel/setup.bash'
alias clean_backups='find ./ -name '*~' | xargs rm'
alias clean_pyc='find ./ -name '*.pyc' | xargs rm'
alias clean_rosbuild='rm -rf build devel install'
alias segstop='sudo service segway-core stop'
alias segstart='sudo service segway-core start'
alias segchk='sudo tail /var/log/upstart/segway-core.log -n 30'

Close your terminal and open a new one to make the changes effective

Setup Workspace

Create a work space in your home directory.

mkdir -p ~/segway_ws/src
cd ~/segway_ws/src
catkin_init_workspace
cd ..
catkin_make

Download and install ROS software packages

cd ~/segway_ws/src
git clone https://github.com/StanleyInnovation/segway_v3.git
git clone https://github.com/StanleyInnovation/segway_v3_robot.git
git clone https://github.com/StanleyInnovation/segway_v3_desktop.git
git clone https://github.com/StanleyInnovation/segway_v3_network.git
cd ..
catkin_make

Modify Sudo

This modification allows the user sibot to run start / stop service without entering a password.

sudo visudo

Paste this at the bottom of the file below the "#includedir"

sibot   ALL=(ALL) NOPASSWD: /sbin/start segway-core, /sbin/stop segway-core

Save the file

[CTRL-X]
[Y]
[ENTER]

Setup chrony

  • If you are going to be running ROS nodes on a remote computer it is a good idea to setup chrony to synchronize time between the machines
  • The onboard robot PC should ideally run the server
  • Specific directions for setting up chrony can be found online

Additional Steps

You should probably do these regardless, but these steps are really only required PGR Flea3 camera and onboard PC powered from RMP.

Open the grub configuration

sudo gedit /etc/default/grub

Add this line

Configures the system to not wait at startup if boot fails

# disable getting stuck in menu after fail
GRUB_RECORDFAIL_TIMEOUT=0

Update the USB memory buffer to handle USB3

* Locate this line

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

* Change it to this:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash usbcore usbfs_memory_mb=1000"

Save and exit

Update Grub

From the terminal

sudo update-grub
sudo modprobe usbcore usbfs_memory_mb=1000

Restart the computer

Robot Customization

Edit the setup configuration

  • To setup your robot configuration edit the 50.segway_config.sh file:

gedit ~/segway_ws/src/segway_v3_robot/segway_bringup/env-hooks/50.segway_config.sh
  • Changing this file after you've complied will have no affect, see the note below.
  • Review the config file carefully, it allows you to set all the variables needed to customize your platform
  • By default it is setup for an RMP 210 V3 with no sensors
  • Make sure to set SEGWAY_POWERS_PC_ONBOARD appropriately

    • Setting it true will make sure the PC shutdown before RMP power is removed
    • Setting it false implies that the PC will be powered from something other than the RMP (like a laptop battery)
  • Make sure ROBOT_NETWORK is set to the physical port ROS will communicate to the outside world on

    • The next section has details about the network configuration
  • To change the platform to another model (available models RMP_210, RMP_220, RMP_440LE, RMP_440SE, RMP_OMNI)
    • Edit the variable SEGWAY_BASE_PLATFORM (This is the platform the RMP is based on)

    • Edit the variable SEGWAY_PLATFORM_NAME (This is the name of the custom robot)

    • SEGWAY_BASE_PLATFORM is generally the same as SEGWAY_PLATFORM_NAME; unless you create a custom platform or buy one from Stanley Innovation

  • For all models except the 210 set SEGWAY_HAS_BSA to true

  • SEGWAY_RUNS_IN_BALANCE_MODE should only be set for the 220 if you want to run in Balance mode

    • WARNING!! Do not run navigation in balance mode unless you fully understand the limitations and caveats of balance mode. It is probably best to contact Stanley Innovation and speak with engineering if you have any questions.

Compile from source

cd ~/segway_ws
catkin_make

Future Changes

If you need to go back and change something in the configuration you have two choices. Either modify the destination file which is created during the catkin_make:

gedit ~/segway_ws/devel/etc/catkin/profile.d/50.segway_config.sh
cd ~/segway_ws
sws

OR

You can modify the file in "env-hooks" listed above and the run the following commands:

cd ~/segway_ws
clean_rosbuild
catkin_make
sws

If your un-sure about the value of a particular variable a quick way to check is with the echo command like this:

echo $SEGWAY_JOY_DEV

Network Setup

You need to set the network up for the platform and the various Ethernet enabled sensors. This is an outline and is intended to be a guide.

NOTE: The ROBOT_NETWORK environment variable must match the port you use for #1 below. It is possible to create the network with 1 NIC and some modifications, however, The following directions will assume you have 2 NICs.

Network Overview

Default Settings Outside world <--> eth0 (10.66.171.4) <--> ROS <--> platform (10.66.171.5) port 8080

  • You can set this IP static by editing /etc/network/interfaces:

sudo gedit /etc/network/interfaces

Set the IP of eth0 to the robot and sensor network

  • The default IP of the network interface that talks to the platform is 10.66.171.4

  • Add these lines for eth0 into the same still open /etc/network/interfaces

   auto eth0
   iface eth0 inet static
   address 10.66.171.4
   netmask 255.255.255.0
  • Note that if you want to be able to connect to the internet you need to set the connection up to bridge to your internal wireless network, we will not cover that here

Make sure you setup the networking for all the sensors

  • Default sensor addresses are defined in 50.segway_config.sh see above

Save the file and exit

Restart the computer

sudo shutdown -r now

Check your settings

  • Verify that all the settings took.

ifconfig

Test your setup

NOTE: Power the PC from an external power supply until you have finished testing

Manual Launch

  • Ensure the Disable button is not depressed
  • Power the RMP on with the silver button
    • LED Ring should pulse blue
    • The Power LED will blink green
    • The status LED should blink yellow indicating the state
  • In a new terminal

cd ~/segway_ws
sws
roslaunch segway_bringup stanley_innovation_system.launch
  • You should hear 2 beeps when the configuration server is initialized and 2 more when the platform is ready to accept commands
  • The launch is time staged so it takes ~15 seconds to complete
  • If you are having issues communicating with the platform:
    • Check the network configuration
    • The wrong platform may be set in the configuration
    • The platform may have the wrong embedded firmware
    • The platform may not be on
    • The kill switch is pressed
    • There are errors on sensors
      • The wrong ones maybe selected or they may not be setup correctly
  • Try using ping to ensure your network is setup correctly

Manual launch works, time to install the service

  • Kill any ROS nodes that may be running and close all terminals
  • Open a new terminal and install the upstart service

cd ~/segway_ws
sws
rosrun segway_bringup install_segway_core

Start the service and make sure it starts up fine

segstart
  • To make sure everything starts fine you can repeatedly enter the following until the launch is finished

segchk
  • You should hear 2 beeps when the configuration server is initialized and 2 more when the platform is ready to accept commands
  • The launch is time staged so it takes ~15 seconds to complete

Save anything you might have open

Power off the RMP

  • Press the silver power button
    • You should hear the platform play the shutdown song
    • The status LED will turn solid red
    • The blue LED ring on the power button will pulse quickly
  • The PC should enter shutdown if you have configured it to run on RMP power
  • Wait for the system to turn off.
    • All LED will turn off after 30 sec

Power the PC from the RMP

  • Connect the PC power input to RMP power output if you are powering the onboard PC from the RMP
    • Typically a DMM is helpful to ensure the proper voltage and polarity.

Power on the system

  • Power the RMP on with the silver button
    • LED Ring should pulse blue
    • The Power LED will blink green
    • The status LED should blink yellow indicating the state
  • If the PC is powered by the RMP, everything should start up when the platform is powered on
    • You should hear 2 beeps when the configuration server is initialized and 2 more when the platform is ready to accept commands
    • The launch is time staged so it takes ~15 seconds to complete
  • If the PC has its own power source, power it on after the embedded system comes up

If you want to stop the service and restart it, open a terminal:

segstop
segstart


Install ROS Indigo on desktop computer

Perform these install steps on the computer responsible for human input and visualization.

Some assumptions about your Ubuntu Install

These instructions make the following assumptions about your Ubuntu 14.04LTS install. These are not hard and fast rules, however, the instructions assume these things. When asked during the install you should select the following:

  • username : si

  • computer name : SIDEV1

  • password : Welcome00

  • The SSH client and server are installed.
    • If not run the following commands:

sudo apt-get update
sudo apt-get install openssh-client
sudo apt-get install openssh-server

Setup your ROS sources.list

Setup your computer to accept software from packages.ros.org. ROS Indigo ONLY supports Saucy (13.10) and Trusty (14.04) for debian packages.

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

Set up your ROS keys

sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

ROS Installation

Make sure the Debian package is up to date:

sudo apt-get update
sudo apt-get install ros-indigo-desktop-full

Initialize rosdep

sudo rosdep init
rosdep update

Getting rosinstall

Rosinstall is a frequently used command-line tool in ROS that is distributed separately. It enables you to easily download many source trees for ROS packages with one command.

sudo apt-get install python-rosinstall

Install required packages

Connected to the internet run the following commands:

Install useful Linux utilities

These tools are useful for monitoring system processes, setting up networking, and setting up NTPD for the remote computer. They are not necessary but recommended.

sudo apt-get install iperf chrony htop bridge-utils

Install required ROS third party packages for segway_v3_robot

These are the packages that RMP V3 depends on:

sudo apt-get install ros-indigo-navigation ros-indigo-gmapping ros-indigo-robot-localization ros-indigo-yocs-cmd-vel-mux ros-indigo-joy ros-indigo-urg-node ros-indigo-lms1xx ros-indigo-pointgrey-camera-driver ros-indigo-cmake-modules ros-indigo-imu-tools daemontools openssh-server libpcap0.8-dev

Add yourself to the dialout group

This is necessary if you have serial, or serial-USB devices:

sudo adduser $USER dialout

Environment setup

Edit the local bash environment to add a few useful aliases

gedit ~/.bashrc

Add the following lines to the end of the file each provides a few shortcuts:

source /opt/ros/indigo/setup.bash
export LIBGL_ALWAYS_SOFTWARE=1
alias sws='source ./devel/setup.bash'
alias clean_backups='find ./ -name '*~' | xargs rm'
alias clean_pyc='find ./ -name '*.pyc' | xargs rm'
alias clean_rosbuild='rm -rf build devel install'

#change SIBOT1 to whatever you onboard PC name is
export ROBOT_PC_NAME=SIBOT1
export ROS_MASTER_URI=http://$ROBOT_PC_NAME:11311

# This is the IP of the remote desktop it set eth0 to whatever NIC your using to connect to the platform
# It grabs whatever IP is associated with that NIC
export ROS_IP=$(ip -4 address show eth0 | grep 'inet' | sed 's/.*inet \([0-9\.]\+\).*/\1/')

#change SIBOT1 to whatever you onboard PC name is
alias s1='ssh -X sibot@SIBOT1'

Now, make sure you close all terminals and open a new one to make the changes effective.

Setup Workspace

Create a workspace in your home directory.

mkdir -p ~/segway_remote_ws/src
cd ~/segway_remote_ws/src
catkin_init_workspace
cd ..
catkin_make

Download and install ROS software packages

cd ~/segway_remote_ws/src
git clone https://github.com/StanleyInnovation/segway_v3.git
git clone https://github.com/StanleyInnovation/segway_v3_desktop.git
git clone https://github.com/StanleyInnovation/segway_v3_simulator.git
git clone https://github.com/StanleyInnovation/segway_v3_network.git
cd ..
catkin_make

Network Setup

You need to set the network up for the connection to the robot PC. This is an outline and is intended to be a guide.

Please make sure you have completed the Robot Setup and that the system is powered on with the networking setup. If you purchased a Navigator package with integrated PC from Stanley Innovation, this will already be done for you.

Setup Wireless Router

To connect with the platform these instructions assume you will be using a wireless router. Instructions for our recommended wireless router are here Wireless Router

Local ROS Networking Configuration

The file that contains the relevant networking is

~/segway_remote_ws/src/segway_v3_network/segway_network_config.bash

This file is setup by default for the ROS master. In this case, the PC on the robot is the master. So we need to change:

export ROBOT_NETWORK=wlan0

to the network device associated with your wireless NIC and

export ROS_MASTER_IP=$ROS_IP

to

export ROS_MASTER_IP=SIBOT1

The contents of your file should now look like:

# Set this to whatever physical port you are using to communicate externally 
# (eg. eth0, eth1, wlan0,...etc)
export ROBOT_NETWORK=wlan0
export ROS_IP=$(ip -4 address show $ROBOT_NETWORK | grep 'inet' | sed 's/.*inet \([0-9\.]\+\).*/\1/')

# Set this to the IP address of the ROS master if it is this computer just 
# use ROS_IP defined above; if it is say the remote computer it would be 10.66.171.4
export ROS_MASTER_IP=SIBOT1 
export ROS_MASTER_URI=http://$ROS_MASTER_IP:11311/

Configure networking on desktop computer

  • Connect to the wireless network. If you purchased a Navigator package from Stanley Innovation, the SSID is

SIBOT_XXYYZZ

where XX is the day, YY is the month, and ZZ is the year that the router was configured.

  • The password is:

Welcome00
  • You can either use a static IP or just use the DHCP that was setup on the wireless router
    • DHCP is typically best
  • Make sure you can ping the wireless router

ping 10.66.171.1
  • And now make sure you can ping the Robot PC

ping 10.66.171.4

Setup Robot PC Name Resolution

  • We need to add the robot pc to our known hosts list so we can resolve it by name:

sudo gedit /etc/hosts
  • Add the following line:

10.66.171.4 SIBOT1
  • Save and close

Make sure you can ping the robot

From the terminal

ping sibot1

Setup an SHH connection

You need to be able to SSH into the robot PC here are some basic instructions

These are a quick review of the defaults because they affect this section directly:

  • Robot PC user name: sibot

  • Robot PC name: SIBOT1

  • Robot PC IP address: 10.66.171.4

  • Remote Desktop user name: si

  • Remote Desktop PC name: SIDEV1

  • password for both users: Welcome00

  • ssh port (standard): 22

Setup your SSH Keys

Open a terminal and create the RSA key pair:

ssh-keygen -t rsa

Once you have entered the Gen Key command, you will get a few more questions:

Enter file in which to save the key (/home/si/.ssh/id_rsa):

You can press enter here, saving the file to the user home (in this case, my example user is called si).

Enter passphrase (empty for no passphrase):

It's up to you whether you want to use a passphrase. The robot network generally isn't connected to public networks. Entering a passphrase does have its benefits: the security of a key, no matter how encrypted, still depends on the fact that it is not visible to anyone else. Should a passphrase-protected private key fall into an unauthorized users possession, they will be unable to log in to its associated accounts until they figure out the passphrase, buying the hacked user some extra time. The only downside, of course, to having a passphrase, is then having to type it in each time you use the Key Pair.

The entire key generation process looks like this:

ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/si/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/si/.ssh/id_rsa.
Your public key has been saved in /home/si/.ssh/id_rsa.pub.
The key fingerprint is:
4a:dd:0a:c6:35:4e:3f:ed:27:38:8c:74:44:4d:93:67 si@sidev1
The key's randomart image is:
+--[ RSA 2048]----+
|          .oo.   |
|         .  o.E  |
|        + .  o   |
|     . = = .     |
|      = S = .    |
|     o + = +     |
|      . o + o .  |
|           . o   |
|                 |
+-----------------+

Copy the public key

Once the key pair is generated, it's time to place the public key on the robot PC.

You can copy the public key into the new machine's authorized_keys file with the ssh-copy-id command. From the terminal:

ssh-copy-id sibot@SIBOT1

You should see something like this:

The authenticity of host '12.34.56.78 (12.34.56.78)' can't be established.
RSA key fingerprint is b1:2d:33:67:ce:35:4d:5f:f3:a8:cd:c0:c4:48:86:12.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.66.171.4' (RSA) to the list of known hosts.
sibot@SIBOT1's password:

Now enter the password you chose for the robot PC and you should see:

Now try logging into the machine, with "ssh 'sibot@SIBOT1'", and check in:

  ~/.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

You should now be able to ssh into the robot PC. Test it to make sure. From the terminal:

s1

At this point you should be able to successfully establish a connection with the robot computer. If not stop and troubleshoot the networking and the ssh connection.

You can now close the ssh connection with:

exit

Setup chrony

  • If you are going to be running ROS nodes on a remote computer it is a good idea to setup chrony to synchronize time between the machines
  • The onboard robot PC should ideally run the server
  • Specific directions for setting up chrony can be found online

Wiki: Robots/RMPv3/indigo/two_computers_setup (last edited 2015-10-29 15:11:30 by stanleyinnovation)