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 Melodic up and running on that laptop.

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

bash <(wget -qO- --no-cache https://raw.githubusercontent.com/chrisl8/ArloBot/melodic/setup-melodic.sh)

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 Melodic

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 am currently using a beat-up Dell XPS 15 9530 that my brother-in-law took to the desert and back. It has a nice fast CPU and lots of memory although the battery life isn’t great.
I previously used a well loved HP EliteBook 2760p from Ebay.

Ubuntu 18.04 Desktop 64 bit:
ROS Melodic is built for Ubuntu LTS 18.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.

You can also use one of the Ubuntu derivatives such as Lubuntu or Xubuntu if you are highly familiar with them, as long as they use the same package repository as Ubuntu.

Just remember that it must be an Ubuntu Desktop variant of version 18.04 LTS (the .01, .02, .03 on the end is fine). Other Linux distributions will not work, nor will newer versions of Ubuntu.

Download Ubuntu Desktop 18.04 LTS 64bit ISO (ubuntu-18.04.3-desktop-amd64.iso) from https://ubuntu.com/download/desktop
My laptop has no DVD drive, so I have to use a USB “flash drive” to install.

If you are on Windows, use the instructions here to create a bootable USB flash drive if you need to:
http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-windows
If you are on Linux, I like to use https://www.balena.io/etcher/ to put the ISO onto my USB flash drive.

In the BIOS I suggest that you:
* Turn off Secure Boot
* Turn off “Fast Boot”
* 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 the laptop into Ethernet during install. This way the Ubuntu setup will ask you to configure WiFi during setup, proving it works and getting it preconfigured during install.

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

Install Ubuntu

Connect to WiFi

Minimal installation – We don’t need Libreoffice, and anything we do need, we can add later.

CHECK: Download updates while installing

I like to include third-party drivers. You don’t have to, but know that my install is using them, so if you run into strange WiFi or Video issues, this could be the cause if you didn’t include 3rd party drivers.

Continue

Pick your Installation Type:
Really, anything here will work. You can dual boot with Windows or another Ubuntu version, or erase the disk.
Personally I always pick the “erase disk” option because nothing else runs on the system I use for my robot.

I recommend not using encryption,
and you do not need LVM either.

Continue

Pick your time zone.

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.

Continue

Once you boot into the Ubuntu Desktop:

On first boot a window will come up asking for some options.
I do not set up “Live Update”, nor do I have my install send data to Canonical. Basically set up as little as possible.

Shortly after the first boot the Software Updater will ask to install updates. Go ahead and install all updates and reboot if asked to. It isn’t required, but saves time later and sometimes trying to update everything at the same time as installing ROS causes issues.

After your first set of updates and reboots:

Once Ubuntu starts click on the “Show Applications” button in the bottom left and type “terminal” and run Terminal:

Right click on the icon on the left and select “Add to Favorites” to keep it there for easy use in the future.

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

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

Install the SSH server:

sudo apt install openssh-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”.

Install VINO for remote desktop on the robot:

sudo apt install vino

VNC Setup on Ubuntu:
From “Show Applications” type “settings” to search for it.
Find and click on “Settings”
Find and click on “Sharing” on the left.
If the switch in the upper right is OFF turn it ON.
Select “Screen Sharing”.
(IF “Screen Sharing” doesn’t exist on the screen, open a terminal window and run “sudo apt install vino” and then try again)
Turn it on and set a password.
The official instructions are here: https://help.ubuntu.com/stable/ubuntu-help/sharing-desktop.html.en

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

Settings->
Power:
CHECK: Dim screen to save power
Turn screen off when inactive for: 5 minutes (or set as you like)
Automatic suspend: Off (or set as you like)
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
Privacy:
Screen Lock: Off
UNCHECK: Require my password when waking from suspend
Background:
Change “Background” and “Lock Screen” to “Colors”
Pick the solid black color
Search:
Off

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.

sudo apt install byobu

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 Melodic Setup

Arlo Complete Robot System

Parallax has finally released a complete system package for the Arlo:
https://www.parallax.com/product/28966

If you’ve been thinking of building one, it has gotten a lot easier now with the complete package. In fact my “parts list” dropped from a dizzying grocery list to essentially 3 items:
https://github.com/chrisl8/ArloBot/wiki/Parts-List

Also, TurtleBot is experimenting with a new 3D sensor to replace the Kinect/Xtion:
http://discourse.ros.org/t/new-depth-sensor-orbbec-astra-call-for-testing/252/1

This should also help with sourcing parts as those have gotten harder and harder to find.

Merry Christmas

I’ve been over committed lately between work, education and family. So poor robot has been neglected.
I’m taking some time out for a needed break and hopefully starting the new year with more free time for hobbies.
For now I’m focusing on the important stuff.

image

(I guess the signal from so long ago and far away is having trouble getting through.)

I have a list of things to try next year though, so I’ll be back soon I hope.

Motor Power Up Order

So you got your robot built, installed everything, and the calibration worked, but now that you actually want to run the robot it does nothing.

The first thing is to turn it on and go use the ~/catkin_ws/src/Metatron/scripts/direct2PropSerialTest.sh script along with the recommended commands from ~/catkin_ws/src/Metatron/scripts/direct2PropSerialTestLines.txt to observe and test how everything works without ROS.
However, most people seem to either be doing this already, or be well past it, because you guys are really smart! 🙂

There is a hidden problem though. It is discussed in the calibration instructions, so I was assuming everyone knew about it, but I now realize it isn’t well explained.

Three separate people have contacted me with this issue, so I want to post it here on the blog.
The motor controllers have a strange quirk. Their “normal” mode does not work with the Propeller board! However, within the first few seconds after turning them on they listen for a certain kind of signal. If they get it, they flip to a mode that does work with the Propeller.

What does this mean? If you turn on the motors, then start everything up, the robot won’t do anything.

The solution: You have to wait until the Propeller board is fully running, after the first arlo_drive command has been sent to turn on the motors.
If you have PING sensors installed, you can know when it is time to turn the motors on by when the PING sensors start flashing.
The main thing is just to make sure the Propeller board is “initialized” before you turn on the motors. That means after the ROS arlobot program is already started, or after you sent the “i   0” to it via the direct2PropSerialTest.sh command.

Another solution? Get a USB Controlled Relay and wire it between the motor outputs on the Arlo Power Distribution board and the motor controllers. This way the code will actually turn on the motors at the right time. This is how mine is set up, and why I forget about this problem.

Kernel 3.13.0-65 may break Serial connections!

Yesterday, after updating to the linux-image-3.13.0-65-generic 3.13.0-65 Kernel on Lubuntu 14.04.3 LTS using the normal Ubuntu update/upgrade two different programs that rely on PySerial quit working. miniterm.py and my ROS (Robot Operating System) based Python node quit working.

 

To resolve your issue temporarily reboot, and at the “GNU GRUB” menu select “Advanced options for Ubuntu” and then move down to select the Ubuntu, with Linux 3.13.0-63-generic kernel option. (NOT the recovery mode one) and it should boot into the old kernel and work fine again.Reverting to the 3.13.0-63 kernel allows miniterm.py and other Python Serial based programs to work normally.

To fix the issue permanently: Remove the new kernel with:

and reboot,
which will remove the new kernel and remove it from GRUB.

There is a bug report open for this:
https://bugs.launchpad.net/ubuntu/+source/linux-lts-trusty/+bug/1500860
I also opened my own, but it is probably a duplicate of the above
https://bugs.launchpad.net/ubuntu/+source/linux-lts-trusty/+bug/1501345

Hopefully the next kernel patch won’t break it again.