Introduction to Laboratory Facilities for Module EE303: Mobile Robotics
Total Page:16
File Type:pdf, Size:1020Kb
Introduction to laboratory facilities for module EE303: Mobile Robotics Prof. Noel O'Connor Acknowledgement Thanks are due to Robert Clare for looking after the lab equipment for this module so well. Thanks are also due to Liam Meany for his continuing Linux support and his contribution to these notes. 1 Introduction This document is intended to give an overview of the laboratory facilities associated with module EE303 Mobile Robotics. Some of these facilities may be well known to you (e.g. via other modules), whilst others will be completely new. It is imperative that you quickly become comfortable with the lab facilities in order to get working on the task in hand - actually building your robot - as soon as possible. This document is intended as a \quick start" guide in order to assist you getting up and running. However, this introduction is brief and should only be considered as a jumping off point ... 2 The Mobile Robotics Laboratory For this module, you will spend the majority of your time in the Mobile Robotics Lab. In fact, the only conceivable time you should not be working in the lab is when you are doing some background reading/research e.g. in the library. The laboratory contains all elements required for the day-to-day work on your robot: • the official Mobot track; • the small test track; • boxes of lego pieces, gears, etc; 1 • soldering iron; • sensors and their data sheets; • the computer facilities required to: { design the program which will control your robot; { download these program to the HandyBoard; { write the final report associated with the module. The remainder of this document is divided in two sections. The first gives an overview of the computer facilities available. By necessity, this requires an introduction to the Linux operating system. The second section is devoted to Interactive C, the actual programming language used in order to control the HandyBoard and hence your robot. 3 Getting Started with Linux 3.1 Introduction The machines in the Mobile Robotics lab all run the Linux operating sys- tem. This is a high performance operating system available for a variety of hardware platforms including Intel based PCs ...and it's free!. Standard dis- tributions include the full GNU compiler and many other development tools. Linux has long been a very popular choice as a platform for serious software development, and is becoming more so all the time. During the course of this module, you will learn about (and find your way around) a popular Linux distribution. 3.2 The basics Many of the basic concepts and functionalities of Linux will be familiar to you already ... although you may not know it! You will have been introduced to various elements in a \piece-meal" fashion. However, some of the terminology and commands used may be new to you. Some basic Linux concepts and terminology are outlined below: • Shell prompt: A command line interface (CLI) interface between the user and the operating system. The shell interprets commands entered by the user and passes them on to the operating system. The shell prompt displays the command line. 2 • Command line: The place in the shell prompt where commands are typed. • Command: An instruction given to the computer either by typing or using the mouse. Some commonly used commands in a shell are: { pwd: \print working directory" - displays the user's current loca- tion in the file system hierarchy { cd: \change directory" - makes another director the current loca- tion. When working with file systems, ``.'' is shorthand for the current directory, whilst \.." is shorthand for the parent directory in the file system hierarchy. { ls: \list files and directories" - displays a listing of files and direc- tories in the current working directory. A \long" listing indicating extra information (time/date of creation, size, owner, privileges, etc.) can be obtained using ls -l. { cp <filename1> <filename2>: \copy filename1 to filename2”. { mv <filename1> <filename2>: \rename/move filename1 to file- name2" { rm <filename>: \remove (i.e. delete) filename” - be very careful with this command - there is no undelete command! { less <filename>: produces a scrollable display of the contents of a file in the current shell. Scroll forward using the CTRL-V key combination, backwards using the ALT-V key combination, q to quit . { man/info <command>: \display manual (help) information for com- mand" - gives detailed information about a command or file (man- pages tend to be brief). To read the man page for the cp command, for example, type man cp at a shell prompt { program-name (&): \run program-name (in the background - op- tional)" - invokes the program called program-name. The program can be run as a background process by adding & thereby freeing up the shell for more input. • Graphical User Interface (GUI): A screen with icons, menus, and panels and toolbars on which the user can click in order to initiate functions. 3 3.3 Logging In For the purposes of this module, each group will be assigned their own PC. To log into your assigned PC, enter your regular login details (as for windows PC's in the other laboratories). 3.4 The XFCE desktop environment The long bar across the bottom of the desktop is known as the panel. The panel displays application launchers and status indicators, such as the current time, minimized applications you are running, and more. The icons elsewhere on the desktop can be file folders or application launchers. To open a folder or launch an application, double-click on its icon. A window in which an application is running (e.g. a shell, Firefox, emacs, ...) can be minimized, or "hidden", by clicking on the left-most button in the upper-left corner. Buttons for minimized screens appear in the panel at the bottom of the screen. Windows can be maximised using the second button from the right in the top corner. If you lose track of the windows you have open you can middle-click (or hold down both mouse buttons simultaneously if your mouse only has two buttons) on the desktop and place your cursor over Windows. A list of open windows appears and you can select the one you want to bring to the fore. XFCE provides you with Multiple Desktops. This means that instead of crowding all your work onto one screen, you can use virtual desktops, which extend your workspace to multiple desktop areas. For example, you may have Firefox (or multiple versions thereof) open in one desktop, email (see below) in another, all your text editors in another, and the shell reserved for downloading pcode to your robot in another. 3.5 Xterms A Command Line Interface known as a Terminal Emulation Program or Xterm can be launched from the XFCE panel. To do this, simply click on the icon on the panel - a VDU with the XFCE panel. This launches a window within which a shell is run. Many different Xterms can be run at the same time facilitating using one for downloading pcode, one for telnet or ftp, one for launching your text editor, ... The most important thing to learn/remember before proceeding any fur- ther is that Linux is case sensitive!. This means that typing \cd Source" and \cd source" are two different commands. The first means change work- ing directory to one called \Source" whilst the other means change working 4 directory to a (different) directory called \source". Typing \ls -l" will list all files/directories in your home directory. You should recognise the files/directories listed as a result of this command - they correspond to the contents of your School of Electronic Engineering user account. Your account is \transparent" across all the School's computing resources (i.e. machines running Windows NT in the CAE or main labs, Unix-based servers and the Linux machines in the Mobile robotics lab). You can use an Xterm in order to download pcode to the HandyBoard and run Interactive C (IC) as outlined in Section4.2. The shell that we use supports filename and command completion. This means that you do not have to type an entire file name/command but can simply type the first few characters and then hit the TAB key and the shell will attempt to complete the file name/command for you: $cd mob<TAB> would be completed to $cd mobile robotics assuming a directory named mobile robotics exists in the current directory. If there is more than one file name/command with the same initial characters, the file name/command will not be completed, rather hitting TAB again will show a list of potential \matches". This allows to you to type a couple more characters in order to uniquely identify the file name/command you want by hitting TAB again. Initially, this may seem like a strange concept and more trouble than it is worth, however, when you get used to this feature it becomes second nature and allows very rapid command line navigation. 3.6 Running Mozilla Firefox To run Firefox simply select this application from the menu or alternatively type: $Mozilla firefox & at the prompt in the shell (where the ampersand means \run Mozilla Firefox as a background process"). You will need to enter the proxy settings in firefox. To do so: • Start Firefox (as described above) • Choose the \Tools" menu and click on \Options". 5 • Click the \Advanced" tab at the top of the \Options" dialog box to display the advanced settings for your Firefox browser. • Select the \Network" tab near the top of the \Option" dialog box. • Click the \Settings" button under the \Connection" category in the \Options" dialog box to bring up the \Connection Settings" dialog box.