ROS Kinetic Setup

WARNING: OLD VERSION!
This is an old version. You should use ROS Melodic Setup

In the last article I explained how to set up an Ubuntu laptop for use by ROS. Here I’m posting my notes about how to get ROS Kinetic up and running on that laptop.

There is now a script to install everything.
Just run:

and you are done!

To update your code just run the same script again and it will pull down and compile anything new without erasing custom settings.

NEXT!
Next we’ll want set up Propeller Code for Arlobot

Laptop Setup for ROS Kinetic

WARNING: OLD VERSION!
You should use the Laptop Setup for ROS Melodic now.

Part of the ArloBot setup is to have a laptop riding on board the robot to run ROS. This article is a quick set of instructions for setting up that Laptop.

My Laptop:
I bought a well used HP EliteBook 2760p on Ebay.
It is great for the robot because it has a reversible touch screen!
It also has two batteries so it can go a long time on a charge.
It has a 64 bit quad core i5 2520M CPU, which should be snappy for ROS.
The TurtleBot comes with an ASUS “Netbook” with an Atom N525 dual-core 1.8GHz CPU. While this works, I think it should be considered the absolute minimum for a usable laptop for ArloBot.

Lubuntu 16.04 Desktop 64 bit:
ROS Kinetic is built for Ubuntu LTS 16.04 Desktop. It is the “Long Term Support” (LTS) version, so you can download and use it for several years without having to upgrade to the next version. This gives the ROS development community some stability in their target OS.

I am using the Lubuntu variation of Ubuntu in order to reduce the RAM usage of the operating system on the laptop in the hopes of leaving more system resources available for ROS. Here is a review someone did on the system resource utilization of each “buntu” distribution: Ubuntu 14.10 vs Kubuntu 14.10 vs Xubuntu 14.10 vs Lubuntu 14.10 vs Ubuntu GNOME 14.10: A Comparison

The bottom line is that any of them will work exactly the same for ROS. The “light weight” Lubuntu and/or Xubuntu will allocate less RAM and a few less CPU cycles to the Desktop GUI, allowing ROS a little more room to work. Don’t expect miracles, but every little bit counts.

Just remember that it must be an Ubuntu Desktop variant of version 16.04 LTS (the .01, .02, .03 on the end is fine). Other Linux distributions will not work, nor will newer versions of Ubuntu. We can hope that ROS becomes more compatible in the future, but for now at least this requirement makes for relatively easy installation of ROS.

These instructions should be the same for Ubuntu, Lubuntu or Xubuntu.
Note that some of these instructions are from my last install that did use “ordinary” Ubuntu, so some of the screenshots and text will reflect “Ubuntu” instead of “Lubuntu”.

NOTE 8/216/2017: These instructions were originally written for an older version of ROS and Ubuntu. If you see mistakes referencing that old version, please let me know.

Download lubuntu Desktop 16.04 LTS 64bit ISO (lubuntu-16.04-desktop-amd64.iso) from https://help.ubuntu.com/community/Lubuntu/GetLubuntu/LTS
My laptop has no DVD drive, so I have to use a USB stick or something else.

Use the instructions here to create a bootable USB stick if you need to:
http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-windows

NOTE: I have UEFI Boot Mode disabled in the BIOS! I found no benefit from it.

NOTE: Remember to turn off “Fast Boot” in the BIOS, and enable USB boot if it isn’t already to get it to show up in the boot options.

I recommend that you do NOT plug into Ethernet! This way the Ubuntu setup will ask you to configure WiFi during setup, proving it works and getting it pre-configured during install!

Boot from the USB stick or DVD you created with the Lubuntu (or Ubuntu, Xbuntu, etc.) ISO.

Install Lubuntu (or Ubuntu, Xbuntu, etc.)

Connect to WiFi

CHECK: Download updates while installing

CHECK: Install this third-party software

Continue

Pick your Installation Type
Really, anything here will work. You can dual boot with Windows or another Ubuntu version, or erase the disk.
I recommend not using encryption,
and you do not need LVM either.

Continue

Your Name: Chris L8(replace with the name you want)

Your computer’s name: ArloBot(Or pick something else)

Pick a username: chrisl8(Replace with the user ID you want for Ubuntu)

CHECK: Log in automatically – I prefer this, but you don’t have to.

UNcheck: Encrypt my home folder

Continue

On first boot let the Software Updater install all updates and reboot if asked to.

If you are using Ubuntu:

Once Ubuntu starts click on the “Search Desktop” button, type “terminal” and run Terminal:

UbuntuDesktop1

Right click on the icon on the Launcher and “Lock” it to the Launcher:

UbuntuDesktop2

You can also drag it up higher on the Launcher after you lock it,

and you can right click it and run a “New Terminal” when you need another one.

If you are using Lubuntu:

AddLXTerm2Desktop

Click on the menu button at the bottom left,
Click on Accessories,
Right click on LXTerminal and select “Add to Desktop” if you want it easy to access from the desktop.

Install the SSH server:

Now you can use ssh from Linux or PuTTY where you can cut/paste.
If you are not familiar with how to use SSH to connect to Linux machines, search the Internet for “ssh putty tutorial”. I thought this one looked pretty good: SSH Tutorial for Windows

Enable Remote Control of GUI Desktop:
The entire idea of a robot is to be remote, so it will help a lot to be able to control it from your desktop.
VNC works well. If your normal computer is running Windows use TightVNC.
If you are on Ubuntu you can use Remmina. Click on the “Search Desktop” button, type “remmina”.

VNC Setup on Lubuntu:
https://wiki.ubuntu.com/Lubuntu/RemoteDesktop
Install vino by running:

Configure VNC by running this from LXTerminal:

CHECK: Allow other users to view your desktop
CHECK: Allow other users to control your desktop
UNcheck: You must confirm each access to this machine
CHECK: Require the user to enter this password:
and put in a password.
Close

Click on the menu -> Preferences -> Default applications for LXSession, and set up Remote Desktop to start when GUI starts,
by selecting the “Autostart” tab,
and CHECK: Desktop Sharing

LubuntuVNC

NOTE: I also UNcheck “Update Notifiier” and “Screen Locker”, but that is personal preference.

From LXTerminal run:
gsettings set org.gnome.Vino require-encryption false
Otherwise TightVNC cannot connect due to silly encryption policies that it cannot understand!

Reboot to startup VNC and test it.

VNC Setup on Ubuntu:
Search: “remote”
Run “Desktop Sharing”
CHECK: Allow other users to view your desktop
CHECK: Allow other users to control your desktop
UNcheck: You must confirm each access to this machine
CHECK: Require the user to enter this password:
and put in a password.

From the terminal run:
gsettings set org.gnome.Vino require-encryption false
Otherwise TightVNC cannot connect due to silly encryption policies that it cannot understand!

Customize Ubuntu Desktop:
These are all a matter of personal preference, but I find this to be the best way to set things up.

ACscreen
BATscreen

Lubuntu:
Preferneces -> Light Locker Settings:
Turn “Enable light-locker” OFF
-> Power Manager:
On AC: When laptop lid is closed: Nothing
On Battery:
– When battery power is critical: Shutdown
– When Laptop Lid is closed: Nothing
You can also adjust the screen off times and when it dims.
I like to set it to dim after some time and to shut off eventually.

Ubuntu:
Settings->Brightness & Lock:
CHECK: Dim screen to save power
Turn screen off when inactive for: 5 minutes (or set as you like)
Lock: Off
UNCHECK: Require my password when waking from suspend
Appearance-Look:
Change “Wallpapers” to “Colors & Gradients”
Pick the sold box on the left
Change the color box to black
Power
Suspend when inactive for: Don’t Suspend     Don’t suspend
When power is critically low: Power off
When the lid is closed: Do Nothing     Do nothing

Byobu: (I use tmux myself, but if you are new to Linux, this is a good option)
When you run ROS nodes on the laptop via SSH they will be in your session. If your session disconnects it will stop ROS.

To allow your session to continue in the case of an accidental or even purposeful disconnect you can use a program called tmux (or screen) that lets you leave running “sessions” open. byobu is a front end to tmux that makes it pretty and easier to use.

byobu-enable This will cause byobu to automaticlaly start when you connect via SSH.

Log off and back on,
The first time you press ctrl-a it will ask if you want this to go to work with Emacs or Screen, pick Screen.
F1, Toggle Status, add/remove what you want. I like to add the battery level.

Disable lid close detection:
If you want to run your laptop on the robot with the lid closed, you may need to do this, because when you reboot or try to shut down while the lid is closed and the laptop is on battery power, as soon as XWindows shuts down the computer goes to sleep before it even shuts down!
This leaves the laptop in a limbo where it sleeps until the battery dies with no hope of connecting to it until you open the lid and let it finish shutting down!
I found two solutions. I am using the first option, which works for me, but if Option 1 doesn’t work try Option 2.
Option 1. Set “IgnoreLid=true” in /etc/UPower/UPower.conf
sudo vi /etc/UPower/UPower.conf
CHANGE:
IgnoreLid=false
TO:
IgnoreLid=true

Option 2. Set LidSwitchIgnoreInhibited=no and HandleLidSwitch=ignore in /etc/systemd/logind.conf:
sudo vi /etc/systemd/logind.conf
CHANGE:
#LidSwitchIgnoreInhibited=yes
TO:
LidSwitchIgnoreInhibited=no
AND CHANGE:
#HandleLidSwitch=suspend
TO:
HandleLidSwitch=ignore
Reboot to make these changes take affect.

NEXT!
Next you will want to do the ROS Kinetic Setup

Parallax SimpleIDE on Raspberry Pi with VNC and SSH

This is my setup log for my second Raspberry Pi. It is a little older, but I think some might find the walk through useful.
This could be used to create a robot that is easy to program and control remotely via VNC and SSH.
This is more of a “log” of my work than instructions, so a lot of it is cut and paste from the sources listed.
Please let me know if you run into questions or problems and I will make updates.

My goal with this one is to set it up to work over WiFi
GUI available via VNC

and run the Propeller SimpleIDE to control the Propeller board

Getting started:
  • Put it in the case (if you bought one).
  • Plug in Ethernet
  • Monitor via HDMI (You can use any TV in the house!)
  • Keyboard (This is only temporary so just steal one from your kids!)
  • Mouse (This is only temporary so just steal one from your kids!)
  • Hold off on the power.

 

 Following Propeller’s instructions:

http://learn.parallax.com/propeller-c-set-simpleide/raspberrypi

(The following is cut and pasted from the above site, it is NOT my work!)
Install th?e Operating System
  • Find an available desktop or laptop computer with an SD card reader/writer.
  • Insert the SD card for your Raspberry Pi into the computer’s SD card reader/writer.
  • Point a web browser at the Raspberry Pi downloads site (http://www.raspberrypi.org/downloads).
  • Download, install, and run the SD Card Association’s formatting tool from the link provided at the Raspberry Pi downloads page.
  • Use this software to format the SD card properly for use with the Raspberry Pi.  Make sure to click the Option button, select “Full (Erase)” from the Format Type: field and select “On” from the Format Size Adjustment field, then click the OK and Format buttons.

  • Go back to the Raspberry Pi downloads site to get the OS image.

For the best experience, use the New Out Of Box Software (NOOBS) to install the operating system image. There are many Linux distributions for Raspberry Pi, but NOOBS makes it easy to try them all from a single SD image.

  • Download the NOOBS image and extract its contents onto the SD card.
  • Eject the SD card from your computer and insert it into the Raspberry Pi.
  • Plug in the USB hub’s power supply.
  • Plug in the Micro-USB power supply to power up the Raspberry Pi.
  • After a few moments, NOOBS will boot and present you with a simple OS Installation menu.
  • Set Language to English (US)
  • Select the “Raspbian” operating system and then click Install OS. NOOBS will install Raspbian onto your SD card and will then reboot.

Keep default settings but set GUI desktop to start automatically. At the end of the first reboot, the Raspberry Pi Software Configuration Tool will appear. All the defaults are fine, except we recommend setting the GUI desktop to automatically start up after boot.

  • Default User name/Password is pi/raspberry
  • On the Raspberry Pi Software Configuration Tool, move the highlight down to the “Enable Boot to Desktop/Scratch” item and press Enter to select.
  • On the “Choose boot option” prompt, move the highlight to “Desktop log in as user ‘pi’ at the graphical desktop” and press Enter to select.
  • Back on the Raspberry Pi Software Configuration Tool, move the highlight to “Advanced” and press Enter to select.
  • Select A4, Enable SSH server,
  • Select Enable
  • Back on the Raspberry Pi Software Configuration Tool, press the right arrow key to highlight “Finish,” then press Enter twice to reboot.
  • Upon rebooting, the Raspbian graphical desktop will appear.
 (The preceding section was cut and pasted from the above site, it is NOT my work!)

Set up VNC so I can connect remotely and ditch the keyboard/mouse:
(The following is cut and pasted from the above site, it is NOT my work!)

VNC Service

Another way to access the entire Raspberry Pi desktop remotely is to install VNC server on Rasberry Pi. Then access the desktop remotely via VNC viewer. Follow instructions below to install VNC server on your Raspberry Pi.

$ sudo apt-get install tightvncserver

After the VNC server is installed, run this command to start the server.

$ vncserver :1

This command will start VNC server for display number 1, and will ask for a VNC password. Enter a password (of up to 8 characters). If you are asked to enter a “view-only” password, just answer it no (‘n’). The VNC server will make a configuration file in the current user’s home directory. After that, kill the VNC server process with this command.

$ vncserver -kill :1
Next, create a new init.d script for VNC (e.g., /etc/init.d/vncserver), which will auto-start the VNC server upon boot.
Now is a good time to see if you can SSH into the Pi, so you can paste this script in! 🙂
$ sudo vi /etc/init.d/vncserver

Modify the file permission so it can be executed.

$ sudo chmod 755 /etc/init.d/vncserver

Run the following command to install the init.d script with default run-level.

$ sudo update-rc.d vncserver defaults
Reboot your Raspberry Pi to verify that VNC server auto-starts successfully.
To connect via VNC Use <IP Address>:1, i.e.:
192.168.1.120:1
(The preceding section was cut and pasted from the above site, it is NOT my work!)

Set up the WiFi card:
Shut down the Pi and unplug it. (If you plug anything into the USB port while it is running you will cause it to reset because of the power surge.
sudo shutdown -h now
Now that you are in via VNC & SSH, unplug the keyboard and plug the WiFi Dongle in its place.
“WiFi Config” is right on the desktop. Run it and set up the WiFi, it is pretty easy.
Get the WiFi IP and test VNC and SSH on it.
Now this will not survive a reboot, so carry on to make it autostart:
sudo vi /etc/network/interfaces
#Most of the required stuff was put in there by the GUI app, but not all,
Add:
auto wlan0
So that it looks like:

pi@raspberrypi ~ $ cat /etc/network/interfaces

Now reboot to see if it comes up on boot!
sudo shutdown -r now
Test VNC & SSH, and then unplug the keyboard and Ethernet and reboot again to see if we can work “cordless” (we still need power, but this is the idea anyway).
NOTE: To reduce VNC traffic you may want to right click on the CPU monitor and remove it.
You can do the same for the clock, now the screen should be static when nothing is happening, greatly reducing network traffic and WiFi dongle load on the power (battery?), not to mention the CPU load.
You can also set your TightVNC session to 256 color from the client end to reduce traffic some.
NOTE: If you disconnect abruptly, it does appear to keep your session open in the background.

Set up SimpleIDE and program Propeller from Pi:
(The following is cut and pasted from the above site, it is NOT my work!)

Install SimpleIDE?

  • In the Raspbian desktop, open the Midori web browser and go to the Propeller Raspberry Pi page; the top of this page.
  • Download the SimpleIDE Raspberry Pi binary.
  • Open the LXTerminal application. It should start up in your home directory right where Midori just saved the download. Type “ls” to verify.
  • Use bunzip2 to unzip the archive by typing “bunzip2 -vv SimpleIDE_0-9-45_armv6l-RaspberryPi-Linux.tar.bz2” into the LXTerminal. (The actual file name may very). NOTE: For a shortcut to excessive typing, after entering the first unique letters of the file name “Simp,” press the tab key to auto-complete. Be patient, it will take more than five minutes to unzip.
  • Then extract the files from the resulting tar file by typing “tar -xvf SimpleIDE_0-9-45_armv6l-RaspberryPi-Linux.tar” into the LXTerminal. Once again the tab key shortcut can be used to save on typing. This extraction process will take about two minutes.
  • Move into the resulting SimpleIDE… folder by typing “cd SimpleIDE-0-9-45” into the LXTerminal. (The actual folder name may very).
  • Run the setup script by typing “sudo ./setup.sh install” into the LXTerminal. This installation process will take about two minutes.

Run SimpleIDE

  • When installation is complete, run SimpleIDE by typing “simpleide” into the LXTerminal (from within the folder of the previous step).
  • Verify and clear any first-time-run prompts. (Click “OK” on  any prompts about file location!)

  • Connect your Propeller Activity Board to the external USB hub.
  • Select the proper USB port in SimpleIDE’s port field.
  • Now you can compile and download your code to the Propeller.
(The preceding section was cut and pasted from the above site, it is NOT my work!)


NOTE: If you get “Cannot load empty board type” you probably have a dialogue box that popped up asking about file locations that you did not click “OK” on yet.

Set to Text boot:
As it is now, the Raspberry starts the XWindows GUI on the HDMI interface by default.
This uses a lot of memory, and if you are ONLY using it remotely it is a waste, so do this to make it boot to Text only:
sudo raspi-config
Select “3 Enable Boot to Desktop/Scratch”
Select “Console Text console”
Use right arrow to select “<Finish>”
Reboot: Yes
Now it should boot with a text only prompt, but you can still use VNC to get a GUI!
This seems to make everything a LOT peppier!
 
Remember you can grab files from your desktop with FTP/SFTP. 😉

Install SFTP Client on Pi:
sudo apt-get install filezilla
 
When it is done there should be a Filezilla icon under Internet in the menu.

Shutdown:
sudo halt -h
or
sudo shutdown -h now
 
Then wait, the WiFi dongle blue light will go off, and all lights except for power will eventually quit.
The ACT (green) LED will blink ten times when the Pi is full shut down. Then you can safely unplug it!

Ros, Propeller and Kinect!

I have been very busy over the past few months building up a robot to make use of the Robot Operating System (ROS)

Willow Garage has their own ready to go robot called the TurtleBot which is a very good system, and has amazing abilities right out of the box.

However I’ve already been planning my robot version for a while and ROS is more of an addon, albeit a huge one, then a starting point. While the TurtleBot has a lot of features that I may never be able to come up with myself, it is missing a couple of key ones:

  1. It has a very limited ground clearance.
  2. The payload is quite limited.

What I’ve been looking at is the Arlo Robot from Parallax: http://www.parallax.com/product/arlo-robotic-platform-system

This is by no means a “pull it out of the box and go” platform, but it is well within my skills. No designing circuits, no laser cutting, no hacking together of bits of metal and plywood. It can be built by anyone who can put together a radio controlled car kit, and their site is basically designed around teaching kids how to program their controller board, so the learning curve is well assisted.

Fortunately the Arlo Robot is also similar in shape and layout to the TurtleBot. Once I built code for the Propeller based Activity Board to talk to ROS, I can actually run a lot of the ROS TurtleBot code with very little modification!

Here is a list of my progress so far:

  1. I have written code to communicate between the Propeller based Activity Board and ROS, sending odometry information and accepting twist messages from ROS.
  2. I have adapted the 3D view, robot model and teleop code from the ROS TurtleBot to run on my robot.
  3. I have built a basic URDF model of the Arlo robot.

I am doing all of this on a little ActivityBot, because it uses the exact same controller as the ArloBot. Right now I am just waiting on parts from Parallax to get my ArloBot together so that I can start running ROS with it.

I have not made SLAM or “gmapping” work well yet because the odometry from the ActivityBot is very poor due to the fact that its little rubber clad wheels slip very easily and very unevenly on all floor surfaces. I expect the ArloBot to have much less wheel slip. I will also be experimenting with adding a gyro to the Propeller Activity Board to assist in verifying rotation angles.

Since a photo is worth a thousand words, here is a picture of where I’m at at the moment:

Robot Progress July 17, 2014
Robot Progress July 17, 2014

Here you can see my rudimentary ArloBot URDF with a depth registered 3D image from the ASUS Xtion Live and the simulated red laser scan line. Also notice the small line of white dots in front of the robot. That is a simulated LaserScan built from the PING sensor on the front of the ActivityBot. I plan to place PING (Ultrasonic) and InfraRed sensors around the ArloBot and use simulated LaserScans from them to help the robot navigate around low or close obstacles that the 3D Camera misses.

I have a lot of documentation on my process and my code is all online, so if anyone is interested in more about this please let me know and I will post some more background as well as on going work.