Installing ROS
On your robot
If you bought your CK-9’s card, you already have a microSD card with Ubuntu and ROS preinstalled, along with all the essential packages you will require further in this tutorial.No need of an additional monitor, mouse or keyboard!
You're good to go!
If you haven’t bought a CK-9 and microSD card, the process is a bit difficult and annoying at times. For more information, checkout: http://wiki.ros.org/ROSberryPi/Installing%20ROS%20Kinetic%20on%20the%20Raspberry%20Pi
On your PC
ROS has easy to follow documentation to install ROS on your PC. Click here to go to ROS Wiki and get steps to install ROS Melodic on UbuntuConnecting your robot to PC (ROSNetwork setup)
Connecting CK-9 and your PC
Turn on Wifi on your PC and search for CK-9's network. The network name is CK9 followed by 4 alphanumeric digits depending upon your Raspberry Pi. Example: CK9E3E2.
The password for the network is "robotseverywhere"
Now that you are on the robot’s network, you can connect to the robot itself. On your workstation, start a
terminal window (Linux shortcut: ctrl-alt-t). In that window, log in by typing
ssh ubuntu@CK9.local
The password initially is set to “ubuntu”. If you have trouble using CK9.local, use the IP address, 10.42.0.1 instead. In some environments, this works better. You may see:
The authenticity of host ‘10.42.0.1 (10.42.0.1)’ can’t be established.
ECDSA key fingerprint is SHA256:sDDeGZzL8FPY3kMmvhwjPC9wH+mGsAxJL/dNXpoYnsc.
Are you sure you want to continue connecting (yes/no)?
Answer yes
Failed to add the host to the list of known hosts (/somepath/.ssh/known_hosts).
Ignore that. You will be asked for the password, which initially is “ubuntu”.
ubuntu@10.42.0.1's password:ubuntu
Now you are connected and logged in.
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.38-v7+ armv7l)
Documentation: https://help.ubuntu.com
Management: https://landscape.canonical.com
Support: https://ubuntu.com/advantage
0 packages can be updated.
0 updates are security updates.
Last login: Thu Feb 11 16:30:39 2016 from 10.42.0.143
To change the hostname, you can use pifi. Type the command:
sudo pifi set-hostname MYCK9
Note: “sudo” is a Linux command that allows administrative actions. Linux will often ask you for your password (it’s “ubuntu”, if you haven’t changed it) when you use sudo (sudo stands for Super-User DO). If you now reboot the robot the new hostname will be used
sudo reboot
Now you can log in to the robot with MYCK9:
ssh ubuntu@MYCK9.local
Use pifi to list the nearby networks:
ubuntu@MYCK9:~$ pifi list seen
MyNetwork
Neighbor’s network
Other Network
We want to switch to MyNetwork, and we have now verified that it’s present. So we can command:
ubuntu@MYCK9:~$ sudo pifi add MyNetwork password
Now reboot the robot again.
sudo reboot
The robot will reboot and try to attach to the “MyNetwork” wifi network. Make sure your workstation PC is also connected to the same network. To test,
$ping MYCK9.local
The ping result shows the network address of the robot:
PING MYCK9.local (10.0.0.113) 56(84) bytes of data.
64 bytes from 10.0.0.113: icmp_seq=1 ttl=64 time=97.6 ms
64 bytes from 10.0.0.113: icmp_seq=2 ttl=64 time=5.70 ms
Press control-c to stop the pinging. If something goes wrong here, the robot may come back up in Access Point mode–that is, on the network named ubiquityrobot. Reboot everything and start over. Now ssh into the robot.
$ ssh ubuntu@MYCK9.local
The authenticity of host ‘10.0.0.113 (10.0.0.113)’ can’t be established. ECDSA key fingerprint is
SHA256:sDDeGZzL8FPY3kMmvhwjPC9wH+mGsAxJL/dNXpoYnsc. Are you sure you want to continue connecting (yes/no)?
yes
Failed to add the host to the list of known hosts (/somepath/.ssh/known_hosts). ubuntu@10.0.0.113’s
password:
ubuntu
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.38-v7+ armv7l)
Documentation: https://help.ubuntu.com
Management: https://landscape.canonical.com
Support: https://ubuntu.com/advantage 22 packages can be updated. 12 updates are security updates. Last
login: Thu Feb 11 16:31:06 2016 from 10.42.0.143
There is some housekeeping that you can perform at this point, to keep your robot up to date. Begin by checking the date.
ubuntu@MYCK9:~$ date
Mon Jan 14 17:16:26 UTC 2017
Now that you have the correct date you can update the robot to get changes that have been made since the robot was manufactured.
sudo apt-get update
sudo apt-get upgrade
This may take some time, but once done, you’re good to go! OPTIONAL: In the interests of security, you can change the user password. Just type:
passwd
and follow the prompts. Using Robot and Workstation Together On the workstation, we want to make sure that we have zeroconf networking enabled: sudo apt install libnss-mdns avahi-daemon avahi-utils Once you’ve got a workstation with Ubuntu and ROS, you should update the Ubiquity software. Because you have two ROS systems, you must keep their versions in sync. To update the workstation, open a terminal window:
sudo apt update
sudo apt upgrade
Then, in another terminal window, ssh into the robot and perform the update there:
sudo apt update
sudo apt upgrade
Set environment variables on the workstation Test if zeroconf greatly simplifies connecting to the robot, but it doesn’t work in every environment. On your workstation you should be able to ping the robot with ping ROBOTNAME.local where ROBOTNAME is the hostname of your robot. If zeroconf works (the ping succeeds): Now go to your workstation terminal window and set its environment variables. ROS assumes that the computer it is set up on is the robot. But we are running on the workstation, not the robot. To tell ROS how to communicate with the robot, you must type:
export ROS_MASTER_URI=http://ROBOTNAME.local:11311
export ROS_HOSTNAME=$(hostname).local
Again replace ROBOTNAME with your robot’s hostname. However, environment variables set by the export ...method are not persistent across system boots. To make this environment variable persistent, we append its setting to the file called ~/.bashrc, which runs when the Ubuntu shell (called bash) is started. Use an editor, or from the command line:Warning: Don’t do this step if you have more than one robot. If you do, each terminal will have the same ROS_MASTER_URI and so will try to communicate with the same robot. Instead, set the environment variables manually for each terminal.
echo "export ROS_MASTER_URI=http://ROBOTNAME.local:11311" >> ~/.bashrc
echo "export ROS_HOSTNAME=$(hostname).local" >> ~/.bashrc
Again replace ROBOTNAME with your robot’s hostname. If zeroconf is not working (the ping fails): Note, if you are using IP addresses instead of zeroconf, we highly recommend setting up static IP addresses or DHCP static assignments. Note, if you are using IP addresses instead of zeroconf, we highly recommend setting up static IP addresses, or DHCP static assignments 16691276fd0c6d09b7478600c20b43ab2a7e1ed9 Now go to your workstation terminal window and set its environment variables. ROS assumes that the computer it is set up on is the robot. But we are running on the workstation, not the robot. To tell ROS how to communicate with the robot, you must type:
export ROS_MASTER_URI=http://<robot_ip>:11311
export ROS_IP=<workstation_ip>
However, environment variables set by the export ...method are not persistent across system boots. To make this environment variable persistent, we append its setting to the file called ~/.bashrc, which runs when the Ubuntu shell (called bash) is started. Use an editor, or from the command line: Warning: Don’t do this step if you have more than one robot. If you do, each terminal will have the same ROS_MASTER_URI and so will try to communicate with the same robot. Instead, set the environment variables manually for each terminal.
echo "export ROS_MASTER_URI=http://<robot_ip>:11311" >> ~/.bashrc
echo "export ROS_IP=<workstation_ip>" >> ~/.bashrc
Synchronize CK-9’s Time To The Workstation Time When using the robot as the master ROS node the workstation will need to use the same time as the robot or information on the ROS topics will not be recognized properly. If your laptop and CK-9 are set properly you should be able to check the time on both at the same time and verify that they are the same. The process below is to be used only if that fails, perhaps due to NTP config changes that have been done on your laptop or the CK-9. The CK-9 robot uses chrony to synchronize time so it is best if your workstation also uses chrony although not a hard requirement it may avoid some issues. On a laptop that has chrony installed use these commands:
sudo chronyc -a local stratum 10
sudo chronyc -a allow 0/0
On a console to the CK-9 use these commands:
sudo chronyc -a add server iburst
sudo chronyc -a burst 2/4
Verify connection On CK-9’s terminal, enter:
roscore
On workstation, type:
rostopic list
The raspberry pi ros image is possible due to generous efforts by smart and kind people at Ubiquity Robotics. A big thanks to the team for taking efforts to make the image public.
Next
Robotics require robots.
Get yours.