Course computer environment

In our assignments you will come across a large number of tools. Many of these you will only use in this course and for those we would like you to spend as little time as possible with setups and configurations of these tools.  In our assignments we will therefore assume that you are using a Linux Ubuntu 16.04 environment in cases where installation of external software is necessary and this installation is platform dependent. The idea is that we limit the work for both you and us.

The material in this page also introduce you to some of the common tools belonging to Linux which might come in handy later in the course or research.

If you are an experienced computer user, you probably know how to adapt the guidelines we provide to work on your own platform. If not, we suggest that you ensure that you have access to an Ubuntu 16.04 environment.

If your computer is not already running Ubuntu 16.04 you could, for example,

  • Boot from an external hard drive with Linux installed already (see instructions below).
  • Make use of a Virtual Machine with Linux installed (see instructions below)
  • Install it alongside your other operating system to create a dual/multi boot system of your computer (only if you really know what you do).
  • Borrow one of the 3 WASP laptops that should be with your university
  • Team up with someone that already has Ubuntu 16.04 running

 

The following sections give some more details for how to install Linux. Skip to the section "Test you Linux machine" when you have installed Linux.

Respect company policies for installing software on certain computers.

Camera

You will be provided a small camera. Links to an external site.

External hard disk

An external 500GB Seagate Expansion disk will be distributed for you to use. It has Ubuntu 16.04 installed like described here Linux Ubuntu 16.04 setup. It will allow you to make use of all your computer's resources. You need to specify if you want it for a PC or a Mac computer. 

  • EFI (boot partition)
  • 200GB / where Linux is installed
  • 16GB swap
  • 200GB exFat with label "EXFAT"
    • for large file exchange on all platforms
    • you might need to install support for exfat, under linux you would do sudo apt-get install exfat-*
  • 40GB fat32 with label "FAT32"
    • for data exchange on all platforms without any changes needed but with limitations on file size. You can think of this as your USB-stick.

To start up follow these steps

  1. Make sure the computer is turned off
  2. Connect the disk to the computer
  3. Power on and press whatever button your computer uses for you to be able to specify what device to boot from
    1. On a PC it is often DEL, F2 or F10. On an Intel NUC it would look like this, for example, where you can press F10 to get to a list of devices or F2 to enter the BIOS.
      wasp_disk_enter_bios.JPG
      One inside the BIOS you can move to the boot menu and the list of devices to boot from. You most likely do not want to make a permanent change of the boot order so you are looking for a way to specify  what to boot from now. You most likely see an entry containing UEFI and Seagate Expansion. This is the one you want.
      wasp_disk_bootlist.JPG
      After that you get to the grub menu where you either just wait or press ENTER to select the top alternative.
      wasp_disk_grub.JPG
      After this you should see a bunch of printout on the screen telling you that stuff is happening and eventually you should get to the log in screen.
    2. On a Mac you press the alt/option key right after powering on. You will (should!) then see your normal Mac disk and an Ubuntu icon representing your external disk. Click the Ubuntu 16.04.3 icon and press the arrow to boot from it.
      wasp_disk_mac.JPG
  4. Log in with the password wasp
  5. If you have a Mac external disk you want to install support for the exfat filesystem which I forgot to do. One of the partitions on the disk is formatted to have that filesystem. Take a look further down for how to open a terminal but you want install the packages exfat-utils and exfat-progs which is done by
    sudo apt-get install exfat-*
    after which you will be asked to provide your password and then you might need to confirm by pressing y that you infect want to install these packages. Remember that you need a network connection for this.

Troubleshooting

  • Some computers seem very picky about which port you plug your disk into. Try different once if it is not detected.
  • On a PC you might end up in the BIOS, go to the Boot section and look for an entry that starts like UEFI Seagate and select that one. If this fails, try to activate CSM/legacy mode and try again, still UEFI.

Native Ubuntu 16.04 installation

This page describes our Ubuntu 16.04 setup if you want to set it up on your own. If you follow it you will have the same setup as we use.

 

Virtual Machine

We have prepared a VirtualBox virtual machine that allows you to run Ubuntu 16.04 inside Windows, Mac or Linux. This is a great way to get access to Linux and it allows you to experiment with things in a very safe environment where you can try lots of stuff and cannot really break anything. Worst thing you just install the virtual machine again and you are back to the same state again. This makes a virtual machine very handy when doing certain type of development work. The major downside is that you need to assign a certain part of your actual hardware resources to the machine which means that your host computer will suffer and the virtual machine will never be able to use all resources of the host because that would make it not work anymore. So, resources are not used to the max. This means that some more demanding tasks may not really run in the virtual machine, this is especially true if you do not have a very powerful machine.

  1. Ensure that you have a 64-bit OS installed and that that you have more than 4GB of RAM and at least a dual-core processor.
  2. Download VirtualBox. We used version 5.1.30 Links to an external site.
  3. Install VirtualBox
    1. If you use a Mac you might want to look at this Link Links to an external site. if you have problems.
  4. Install the VirtualBox extension package for your OS. You find the file to install at the end of the list of files to download on the download page above.
  5. Download the WASP VM image from box.com Links to an external site.. The image file is called WASP Ubuntu 1604 ... and is about 8GB big, in compressed form. When it is expanded it it will consume almost 40G. If you have problems hosting such a large virtual machine on your computers hard drive, you could put it on an external drive instead.
  6. Open VirtualBox and choose "Import Appliance" from the File menu (see details here)
  7. Start the WASP virtual machine by selecting the newly imported virtual machine and clicking the green arrow marked Start.
    1. If the virtual machine starts in Full screen mode you will get a message about this ("Cancel" to not use full screen and "Switch" to use full screen mode) when you start the machine.
  8. If all goes well you should see a login prompt for the user wasp (password same as user name). 
  9. Log in and make sure that the machine starts up. 
  10. Make sure that the wasp user is part of the vboxsf group (to be able to write to shared folders). Open a terminal (the Terminator application) and execute
    sudo adduser wasp vboxsf
    Log out and in (there a hidden menu in the upper right corner, the cogwheel)
  11. Move the mouse to the top of the desktop to the Virtual VM menu. Select item Devices and "Insert Guest Additions CD image..."
    guest additions.png
    Press Run. This will open up a window and the guest additions are installed. When this is down, right-click on the CD-icon down left above the trashbin and select Eject.
  12. Reboot and ensure that you can copy and paste both to and from the VM and the host computer. Ensure that bidirectional is selected under Devices (where you found the entry to insert Guest Additions CD). 

The virtual machine is setup to emulate one processor. Performance is much likely going to be much better if you give it at least one more. Go into Settings before starting your virtual machine and select the "System" tab and Processors as the image below shows. If you have plenty of RAM on your machine you might want to increase the amount of RAM that you assign your virtual machine as well. This is done under the  "Motherboard" tab. (You might want to turn off 3D acceleration if you want to run rviz from ROS.)VM add processors.png

You probably want to set up a Shared Folder between your host and guest OS. When you have booted into the VirtualMachine, move the mouse to the top of the desktop to activate the VirtualBox VM menu. Select Devices menu item and Shared Folders and Shared Folders Settings... Click the add folder icon to the right and specify a folder on your host (the machine running the virtual machine) that you want to share with your virtual machine. Check the box Auto-mount. Click OK and then reboot your virtual machine. You should find the shared folder mounted in Ubuntu under /media/sf_Shared (in the case shown in the image below where the shared Folder Name in our WASP Ubuntu system was named Shared).

VM shared folder.png

 

Troubleshooting

If the virtual machine is not behaving well there are a few things that you can try

  • If you have an external monitor connected, try to remove that

 

Testing your Linux machine

If you are completely new to Linux you might want to take a look at the following page first.

You probably also wants to take a look at this page for some Linux good to know things

If you are using a Mac you might also want to take a peak at Linux Mac

Boot your Linux machine and log in with password "wasp". You should now see something like this

WASP Ubuntu desktop.png

 

Terminal

Open the terminator terminal program. If you have a full WASP Ubuntu 16.04 installation you should be abe to click on the red/black icon under the Settings icon on the left hand side taskbar. Test the following commands

ls
ls -l
ls -a
less SOME_FILE
more SOME_FILE
cd SOME_RELATIVE_PATH
cd SOME_ABSOLUTE_PATH
cd
top
ps auxww
locate *.png

and make sure you understand what they do. For "top" you press the key q to exit. For "locate" to work you might need to first execute

sudo updatedb

sudo is a command used to perform another command as superuser, i.e., with higher privileges. You will be promoted for your password again. This will update the database of where files are stored. 

Open a web browser and make sure that you can copy text in both directions between the browser and the terminal. Remember the browser requires you to press ctrl+c/v for copy/paste and the terminal wants shift+ctrl+c/v for the same effect. 

 

Change your password

One of the first things you want to do is to change your password so that logging in to your computer is not so easy. Remember that it is not only what is on your computer that is at risk. Getting into your computer means someone has gained access into your network as well.

Open a terminal and type (followed by ENTER)

passwd

This will prompt you for a password and ask you to repeat it. The password has to fulfill some minimum safety requirements. "wasp" does not cut it for example.

 

Text editor

We have installed a few different text editors for you. Use the terminal window to try the following and see if one of them suits you

  • gedit
  • subl
  • xemacs
  • gvim 

The latter three of them can be set up to do various degrees of spell checking, code completion, etc.

If you want, you can have a look in the Ubuntu Software folder, the orange icon to the left, for alternative applications to install. 

Octave ("Matlab")

There is Matlab for Linux and if you have access to it to install it that is great but you can do many of the things also in the open source version called Octave. You should be able to figure out how to start it by now. If you not, go back up and make sure you actually understood what you did.

Play around with octave for a bit. If you have used matlab before you should see that it behaves quite similar. The graphics is not so fancy and all the toolboxes that you probably have access to under Matlab are not there.

If you have not used octave before try the following

x=1:10
y = rand(1,10)
plot(x,y)
plot(x,y,'.')
plot(x,y,x,y,'.')

 

Camera

Most of your computers probably already have a camera built-in. To stick to the philosophy that we should spend our time on the core issues we will assume that you are using a Logitech C270 in what follows. Most web cameras will likely do just as fine and so will your built-in camera.

If you use a Virtual machine

  • You need to make sure that the Virtual machine has access to the camera. You do this via the "Devices" menu and the item "Webcams" and then select the camera from the host that you want to have access to in the virtual machine.

Start the program cheese

If you have more than one camera connected you select which one to use under Preferences (upper left corner in the menu bar (not visible until you move the mouse there)

Make sure you can save images using the three Photo, Video and Burst function. The images will end up in the Pictures folder in a subfolder called Webcam. The video will end up in the folder Videos also in a subfolder called Webcam.

 

Screenshot

Now make a screenshot: Click on the Ubuntu icon in the top left corner. This brings up a search window where you can type parts of program names and the system will look for them. Type screenshot and click the icon. Note that when you order the program to take the screenshot you will be prompted to give the file a name. The file will end up on the Pictures directory which you find in the home directory.

You can navigate there graphically by clicking the icon that looks like a file drawer under the Ubuntu icon in the top left corner. This will start the file handler / explorer / finder program.

Save a screenshot of your entire desktop and be ready to upload it in the Quiz belonging to this material.

 

Image editing

Navigate to the screenshot you just took. Right-click on the file and select Open with "Gimp image editor". Select the "selection rectangle in gimp's Toolbox window and mark a section of the image. Go to the Image menu in the top left corner (will only appear when you move the mouse there) and then select "crop to selection". Then go into the File menu and select "Export as" and export the file as a png file with a name you find good for what you cropped out. Exit Gimp.

 

Video editing

Start the program handbrake.

Click the Source button and find the video file you created in the previous step. Click the Start button and you will have converted your file which was in webm format to m4v. You have a large number of presets available in the Presets List in the upper right corner if you want to use some other fileformat. Exit handbrake.

 

Screen capture video

Sometimes it is good to be able to capture what goes on on the screen. Run the program vokoscreen. Make a screen capture of you opening the text editor of you choice and then closing it again. Produce an m4v file from it and be ready to upload it in the Quiz belonging to this material. Exit vokoscreen.

 

Record sound

Open Systems Settings from the left hand taskbar and  select Sound.

Check that output works by playing a sound.

Switch to the input tab and select the camera as the input device

Run the program gnome-sound-recorder from the command line or SoundRecorder from the quick launcher that you reach via the Ubuntu icon in the top left corner. It is the same program.

Record a sound file and try playing it back.

You find the file under Recordings in your home directory. You may need to rename the file and add an ending to it (rename to clip1.ogg for example if you recorded in ogg format).

If you have problems playing back the sound, you might want to install the VLC application.

Try to convert the file to wav format by using soundconverter.

 

Using ROS

For this test we will make use of ROS (http://www.ros.org/ (Links to an external site.)Links to an external site.). It should be installed on your system already, if not follow the instructions here Linux Ubuntu 16.04 setup.

For this test you need four terminal windows (at least). I suggest that you fire up terminator and split as you go (right-click in window to split).

In the first terminal start the roscore which is the switchboard for all communitcation in ROS.

roscore

This should result in something like this

roscore.png

In a second terminal run the following commands

rosparam set cv_camera/device_id 0
rosrun cv_camera cv_camera_node

The first command determines which camera to use. You can leave this out and ROS will pick the first camera. If you have a built-in camera and the USB webcam you probably want to change the device id to 1 so that you get the image from the USB webcam.

 

In a third window run

rostopic list

This should should give you something like

rostopic camera.png

We can see from the list that the image information is published in a bunch of different ways. Let us check how often we get a new image. In the third window run

rostopic hz /cv_camera/image_raw

It will subscribe to image information and check how often it comes in and take a measurement of the frequency once every second or so. You break it by pressing ctrl-c. You should have seen something like

rostopic hz image.png

So we know that we get image information but what does the image look like? Running the following command should pop up a window with the image from your camera in

rosrun image_view image_view image:=/cv_camera/image_raw

Press ctrl-c in the terminal to stop this. Was this the image you expected? If not go back to where you started cv_camera and pick another device_id.

Rviz

Let us use the very versitile tool called rviz for this. You might want to skip this step if you are running in a virtual machine as rviz is quite heavy on resources. 

Start rviz by issuing the command

rviz

This will pop up in a new window looking like

rviz.png

rviz has built in functions to display all sorts of data, such a images. Now we need to tell rviz to display our image. Press Add and navigate to the the topic that you looked at before with the rostopic command as shown in the image below

rviz add topic.png

Press OK and you should see the image inside the rviz window like below.

rviz with image.png

Want to see the image in a separate window? Simply pull the image window out from the main rviz window.