Tutorial: Robot Operating System (ROS) on AWS-EC2

I spent a Sunday morning figuring out how to run Robot Operating System on AWS EC2. Here are the basic steps and the references to get it working. I’ve gone through these steps probably about 10 times today and it takes about 5 minutes to set up an instance and configure it.

One of my weekend challenges is to understand how to use Docker better. I might make a “container” or “Docker Image” for ROS. If I do, I will put the reference here.

Installation

  1. Install Ubuntu-16.04 AMI (current stable Ubuntu version)
    Ubuntu AMI
  2. Follow the instructions on how to configure your Ubuntu Instance for Desktop Access
  3. Install ROS Kintetic
    1. Do the ROS Installation using the remote desktop.
  4. Work through ROS tutorials
    1. Do the ROS tutorials using the remote desktop.
    2. Here is the first ROS Tutorial in the series that has something that will display.
      ROS on AWS EC2

Issues

  • I had an issue with roscore. However, I was able to do the rest of the tutorials.
  • I tried to install and run the ROS Turtlebot but I couldn’t get it running. Here is what I found out.
    • Turtlebot requires ROS Indigo
    • ROS Indigo requires Ubuntu Tasty. However, I couldn’t get Ubuntu-Trusty, ROS-Indigo, and Remote Desktop to all work together.

Tutorial: Connecting to AWS EC2 Ubuntu Desktop

I spent a Saturday morning trying to connect to an AWS EC2 desktop after trying to follow the instructions given by AWS on Connecting to Ubuntu Desktop with Windows that completely failed.

The instructions described here are derived from the following YouTube Video. There were some parts that were not clear/correct so I have clarified and corrected them in this post.

Configure Ubuntu Desktop Server

sudo -s
  • Update the operating system
sudo apt update && sudo apt upgrade
  • Type the following commands to install vncserver:
sudo apt-get install ubuntu-desktop
sudo apt-get install vnc4server
sudo apt-get install gnome-panel
  • Start the VNCServer.
vncserver
  • Remember the password you set. You will need this passcode later when you connect using tightvnc .
  • Kill vncserver
vncserver -kill :1
  • Modify the VNC startup script
vi .vnc/xstartup
  • Add the following lines to the .vnc/xstartup script
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
gnome-session –session=gnome-classic &
gnome-panel&

xstartup script

  • Press ESC, followed by :wq (write-quit) to save and exit the file
  • Start the VNCServer again
vncserver

Configure your Windows Box

Configure your EC2 Instance

  • Edit your security group.
    Edit your Security Group
  • Add port number 5901 in your ec2 security group
    Add Port 5901 to security group
  • Write your public ip number (or DNS name) in remote host text box and port number <publicIp>::5901
    TightVNC
  • Your desktop in ec2 instance is ready and execute the command vncserver after every restart.

FAQ

  • Can I stop my machine and restart it?: Yes. However you will have to re-run the vncserver command after restarting the server.