= Quick Start for Two Computers =
{{attachment:Two_Computers.png}}

<<TOC(4)>>

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


<<Include(Robots/RMPv3/indigo/core_robot_computer_setup)>>

== 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 [[http://wiki.ros.org/StanleyInnovation|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
}}}
-----
<<Include(Robots/RMPv3/indigo/core_desktop_computer_setup)>>