-
Notifications
You must be signed in to change notification settings - Fork 289
SSH and Network Connections
SSH (Secure Shell) is a useful tool to remotely connect to another machine (e.g. your computer to the odroid on the barc). Once the connection is established you will have access to the filesystem and all command line tools on the odroid, including the launch of ROS nodes. There’s also a method to run a distributed ROS-system (more info below) where one roscore runs on one specified machine, while the nodes are running on different machines, while still communicating via topics and messages as if they were on the same machine.
-
username - name of user. One machine many have many users. You can check it with the command
$ whoami
-
hostname - name of system DNS (Domain name system). This information is important when a machine is connected to a network of other machines. You can check it with the command
$ hostname
Typically, at the terminal command prompt, you'll see <username>@<hostname>
.
-
First, connect to odroid's network. If the odroid has a Xilinx router connected to it, the network name and password are written on the router itself. If you’re using a wireless AP utility (instead of the router), the network credentials are in the file
/etc/init/accesspoint.conf
-
Open a terminal and enter
$ ssh odroid@192.168.100.100
and enter the password when prompted (default pwd: odroid) Note that the IP address of the odroid might change, can check by running the commandifconfig -a
on the odroid
You can automatically connect to the odroid using ssh-keys (as opposed to supply credentials every time you log in). Run the following commands on your machine
$ ssh-keygen # create key on your computer
$ ssh-copy-id odroid@192.168.100.100 # copy it to the odroid
$ ssh-keyscan -H odroid, 192.168.100.100 >> ~/.ssh/known_hosts # add the odroid to your known_hosts file
More info:
Follow the steps in this tutorial. Note, after following those steps, you'll need to also run ssh-add
and ssh-keyscan -H odroid,192.168.100.100 >> ~/.ssh/known_hosts
IMPORTANT: For ROS communication across multiple machine, the ssh connection needs to use an RSA protocol for authentication. To ensure your using this authentication method, use the command
ssh -o HostKeyAlgorithms=ssh-rsa odroid@192.168.100.100
Useful extra information SSH uses port number 22
$ ssh <username>@<remote-address> # ssh connect to remote server
$ pinky # lists current user
$ who # lists current user information
$ whoami # print current user ID (i.e. username)
$ ifconfig -a # show ip configuration
$ hostname # print hostname
The command roscore
runs on one machine, but many ROS nodes can run across several machines in a network. The following steps cover the process
- Select a master computer to run
roscore
- Get the hostname of master computer using
$ hostname
- Add the environment variable ROS_MASTER_URI with the command
$ export ROS_MASTER_URI=http://<hostname>:11311
on all machines. Note, if does not work, use the respective IP-address instead. - In your launch file, define "machine" and address tags and pass them to every node that is started. For more information, read here. A simple launch script would be
<launch>
<machine name="foo" address="foo-address" env-loader="/opt/ros/fuerte/env.sh" user="someone"/>
<node machine="foo" name="footalker" pkg="test_ros" type="talker.py" />
</launch>
For an example, refer to this example launch file
When you use SSH to connect to the odroid terminal, it may feel difficult to edit files and you also need to re-enter the SSH commands each time you open a new tab. Fortunately, you can use a remote desktop software such as VNC Viewer to interact with the odroid's desktop directly from your computer. Complete the following steps (odroid first) to use a virtual desktop software:
- Open a terminal and enter
sudo bash ~/barc/scripts/fix_vino.sh
. When prompted for the password, typeodroid
. - Enter
Y
when asked to re-installvino
. - Wait for odroid to reboot.
- Install VNC Viewer on your computer.
- Run VNC Viewer and click File>New Connection.
- In the VNC Server prompt, type your default odroid IP address e.g.
10.0.0.1
. - Enter a Name for this connection and click Ok.
- Connect to the odroid.
If an error occurs such as encryption or rgb pixel format, run the fix_vino.sh
script on the odroid again.