SSH
Access Baxter's internal PC remotely!
Baxter now has a customer-accessible SSH account. With SSH access users will now have the ability to:
- Run custom code directly from the robot. Eliminate network latency issues, ideal for 'real-time' operation (controls, image processing, screen display, and more..).
- Start and stop the robot software
- Copy files to/from Baxter's internal PC
- Shutdown/reboot the robot remotely
What is SSH?
For those of you new to SSH, it stands for Secure Shell and is a program that provides a command-line interface to a remote system. It is called from the command line with the syntax:
$ ssh <username>@<hostname>
After entering this command, if this is your first time SSH-ing between these two systems, you will be prompted with the following message:
The authenticity of host '<hostname> (<ip address>)' can't be established. ECDSA key fingerprint is 80:17:0c:38:79:18:54:06:db:d6:a2:7d:c5:7b:ff:7e. Are you sure you want to continue connecting (yes/no)?
This message tells us that this computer has never seen this particular host key before, so it isn't able to verify that you're connecting to the host you think you are. Please continue with response "yes
" validating development PC <-> Baxter PC connectivity.
You will then be prompted for your password, and then provided with a shell on the remote server.
The command for returning to your native server is simply "exit
" (alternatively: "ctrl + d").
If you for some reason get a hanging terminal (if the remote server shuts down on you while you are SSH'ed in), you can force the session to exit by hitting Enter, Tilda, and Period, in that order.
Connecting to Baxter
Credentials
username: ruser
password: rethink
Secure Copy (SCP)
SCP stands for Secure Copy, and is built off of the SSH protocol, and provides the capability to copy files to and from a remote server.
The syntax for this is similar to the ssh syntax:
- To scp a file from your computer to a remote server:
$ scp <path to local file> <username>@<hostname>:<path to intended destination on remote server>
- To scp a file from a remote server to your computer:
$ scp <username>@<hostname>:<path to remote file> <path to intended destination on your computer>
- If you are scp-ing to or from the home directory on the remote server, you can forgo the leading /home/<username> in the filepath
- So to copy a file, data.txt, from my current directory to the home directory of "ruser" on "baxter", the syntax would be:
$ scp data.txt ruser@baxter:
SSH Usage
Baxter's internal PC is now available for use/development. The 'ruser
' account has been given permissions to a number of 'sudo
' commands (start/restart robot software, shutdown/restart robot, access logs).
The 'ruser
' root directory ( /home/ruser
) is the recommended development workspace. This path and it's contents will be preserved during future robot updates so that you will not lose your code.
Run custom code on the robot
Perhaps the most powerful aspect of this feature is the ability to run code local to Baxter. By running your code on the same PC as the core Baxter software stack, you eliminate the latency which was often introduced in a networked setup. This is useful for virtually all areas of robot use, but particularly when deploying robot controls and vision algorithms, as well as displaying to the screen and other user interactions.
The robot is currently running ROS Indigo on the internal PC.
Create ROS Workspace
$ mkdir -p ~/ros_ws/src
# ros_ws (short for ROS Workspace)
Source ROS Setup and Initialize Catkin
$ source /opt/ros/indigo/setup.bash
$ cd ~/ros_ws/src
$ catkin_init_workspace .
$ cd ~/ros_ws
$ catkin_make
Clone Rethink SDK Software
We will checkout all required Baxter Github Repositories into your ROS workspace source directory with the wstool source control tool:
$ cd ~/ros_ws/src
$ wstool init .
$ wstool merge https://raw.githubusercontent.com/RethinkRobotics/baxter/master/baxter_sdk.rosinstall
$ wstool update
Baxter Environment Setup Script
$ cd ~/ros_ws
$ cp src/baxter/baxter.sh .
# Open baxter.sh in the vi or vim text editor and edit the lines containing the following variables as follows:
# baxter_hostename="localhost"
# your_hostname="localhost"
$ chmod +x baxter.sh
For more information on configuring your baxter.sh script, please see the Hello Baxter Tutorial
Build and Install SDK Software
$ cd ~/ros_ws
$ ./baxter.sh
[baxter - http://localhost:11311] $ cd ~/ros_ws
[baxter - http://localhost:11311] $ catkin_make
Start/Stop the robot software
You can start and stop the robot software by SSH'ing in and running:
# Stop Baxter Software
$ sudo rc-service rethink stop
# Start Baxter Software
$ sudo rc-service rethink start
It is important to note here that you will need to wait a short time between these commands, as the robot software takes a bit of time to finish shutting down.
Shutdown/Reboot the robot
You can also shutdown and reboot the robot softare remotely:
# Reboot
$ sudo reboot
# Shutdown
$ sudo shutdown -h now