RoPod/Tutorials/ConnectingToRobotWireless

From Control Systems Technology Group
Revision as of 15:07, 26 October 2017 by 20170140 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Entering Pico from terminal via the network

Did you follow the Simulation tutorials? Then all you did for the simulations should work on the robot as well! We only need to be able to communicate to the robot. Connect to the ropod-network (ask for the password). Running sshpico gives you access to pico in the ropod-user account(again, ask for the password) via the ssh-protocol. If the network is connected to internet as well, you checkout the git-repository on the robot itself of checkout the branch you are working on.

Once you are running some packages on the robot and you want to use the information published and topics (for visualization using rviz for example), then open a terminal and run pico-core on your own pc. Now, from this terminal (where you run the pico-core command) you can use these data on your own pc, for example to visualize them in rviz. This might be relevant as well to set the initial-pose for localization for example.


Automatic key generation

If you want to prevent using a password each time you want to log in to Pico, you need to generate a key. Therefore, you can use an automatic key generator, for example using the method copied from | this site running the next set of command from your local desktop system:

ssh-keygen

Make sure to use the default for the keyname. We suggest that you do set a passphrase on that key, otherwise it's a security problem. "-t rsa" wouldn't be a bad idea, but probably isn't needed.

ssh-copy-id ropod@192.168.44.81

That will ask you for the password you'd use to log in, and sets up the authorized_keys stuff for you. (no need to do it by hand) Then, this:

ssh-agent

or maybe this:

exec ssh-agent sh

or:

exec ssh-agent bash

That will start up an SSH agent that can hold your key. On many modern Unix variants, if you're logged in graphically, this will already have taken place. The first variant (with the backticks) puts an ssh-agent into the background and sets up the environment variables to talk to it. The second two have the agent run a shell for you, so that when you exit the shell, the agent exits. Many modern Unix variants will already have an agent running for you, especially if you logged in graphically. You might try "ps aux | grep ssh-agent" or "ps -ef | grep ssh-agent"; if something is already running, use that. Then, finally:

ssh-add

It will ask for a passphrase; give it the one you gave ssh-keygen. There's also ways to make it ask graphically. And you can put the ssh-agent and ssh-add stuff into your login scripts (setup is different depending on shell you use) to automate this, but some Unix variants (current Ubuntu Linux, for instance) do most of that automatically, so that all you really need to do is create a key and use ssh-copy-id to set it up on the remote host:

ssh-copy-id -i ~/.ssh/id_rsa.pub remote-user@remote-host

which in our case should be

ssh-copy-id -i ~/.ssh/id_rsa.pub ropod@192.168.44.81

Now, "ssh ropod@192.168.44.81" (or sshpico in our case!) should work without asking for any authentication. Behind the scenes, it's using a key that the ssh-agent is holding, and asking the agent to do the magic signing tricks for it.