PC Manual

David Lewis, Mike Morton and Sasha Vorobiev

The hope for this manual is that future students in want of using the PC for controlling the Pioneer Robot can use these instructions to help them in their endeavour.

INDEX

  1. General PC Setup
  2. Internet Connectivity and File Transfer
  3. Precompile Processing
  4. Working with MS Developer Studio
  5. Testing the Robot in the World

    Chapter 1: General PC Setup

    Windows 95

    Windows 95 is an easy to use environment that is based on windows (surprisingly). For ease of use, there is the Start Menu usually located in the lower left corner of the screen. Click on this and a menu pops up that allows you to go deeper into other folders and eventually click on an file or executable. These "folders" and "files" are really just pointers to real folders and files. It's a little confusing, but not much to worry about. Sometimes you'll want to use the Start Menu to open applications, so now you know where it is.

    The windows environment is just like a MAC in that you just double-click to open a file or folder. To close the folders, double-click in the upper left corner of that folder or click on the X in the upper right corner. There are also what are called Shortcuts located on the desktop. These are pointers to actual files or folders that are most frequently used. There are some already on the desktop that are the ones most used for Saphira and student projects. Again, just double-click these to open them. To make a new shortcut to a file or folder, click and hold the second mouse button while over the file/folder. Then drag it onto the desktop and release the button. It will then prompt you for what to do; go down to the Make Shortcut Here and click again.

    Searching

    You may want to search for a file or folders at times. This is done by clicking on the Start Menu, and moving up to the Find item. Then move over to the right to Files or Folders... and click on that. You then just type in the name of the file/folder and maybe where to start looking.

    Creating New Files and Folders

    To create a new folder, make sure you are currently in the folder where you want to create the new folder. Then either:

    The name of the folder is highlighted for you, so just type in the name you want to change it to.

    Dos Windows

    At times you'll need to use a DOS window to either download from the net, or to BGRAM files. This, again, is easy to do. Just click on the Start Menu, and move up to Programs. Then slide over and down to the MS-DOS Prompt. Click on that and a DOS window will open. There are certain instructions that follow that need a DOS window, so now you know how to get one! To change directories in DOS, the command is "cd ". To get a list of files and directories in the current directory (or folder), use "ls" or, for an old-school DOS command, "dir" or "dir /w/p" (the /w = wide, /p = pause). Enjoy DOS!

    Chapter 2: Internet connectivity and file transfer

    Hardware

    The WinBook XP5 laptop is equipped with a New Media Livewire Ethernet 10B-T/2 PCMCIA network adapter card. The card is an external device that has to be inserted into the appropriate PCMCIA slot and connected to the local area (LAN) network via a cable every time you intend to use the laptop on the network. This includes connecting to UNIX servers via telnet, transferring files to and from UNIX servers and other PCs on the network (downloading and uploading), or browsing the Internet.

    The card is compatible with the current SunLab network, i.e. it can facilitate communication on an Ethernet network at 10 Megabits per second using either a 10B-T (RJ-45) or a 10B-2 (BNC, a.k.a. coax) cable.

    Installation

    Make sure you have the following: the Ethernet card itself (it looks like a credit card), RJ-45 adapter (for 10B-T connectivity).

    Important: if you are running Windows 95 on the laptop (and chances are that you will be), do not install any disks that come with the card, i.e. you do not need to install any drivers that come with the Ethernet card. Windows 95 installed on the laptop should have all the necessary software built-in.

    Open a little hatch located on the left side of the laptop. You will have access to two (upper and lower) PCMCIA Type-II card slots, i.e. the slots that can accomodate cards like the one you have. The black buttons located immediately to the right of the slots let you eject cards (see below for instructions on how to safely remove cards).

    Insert the card into one of the slots; to go in, the card has to face upward. Please be gentle as you push the card in, and continue applying pressure until you hear a click which means that the card is properly seated.

    If you using the card for the first time (in case Windows 95 had to be reinstalled, or you are using the card on a different laptop than the Robotics WinBook XP5), Windows will say it has found new hardware and will begin to install the software needed for it. It may well be the case that WinBook preinstalls the Ethernet card drivers on all the laptops they ship, so if you were to use the card with any other laptop, you would have, in fact, to install drivers. This manual does not contain instructions to do that.

    Network setup

    If you don`t have networking set up, Windows will ask for a computer and workgroup name and a computer description. Enter the information (here you can enter anything you want). If Windows says that it needs to reboot, do so. Once the laptop comes back up, you will see a Network Neighborhood icon on your desktop.

    In order to use the laptop on the SunLab Ethernet network, you have to set up TCP/IP, in other words tell your laptop where to look for other computers, and assign it its unique network ID, an IP address.

    If you have to set up TCP/IP for the first time, or change the existing setup, follow the directions below. Go to Start->Control Panels->Network. Open the control panel by double-clicking on it. Among the installed network components select and highlight TCP/IP-New Media Live Wire. Click on the Properties button. You will have to configure several items.

    For IP address, consult a SubLab system administrator to find out which IP address may be used for the laptop, so it does not conflict with any other computers in Sproul. The address has to be a static IP address of the syntax 130.58.68.XX. Currently the laptop uses the available 130.58.68.27 address that corresponds to the name slip.cs.swarthmore.edu. Click on Specify an IP address. Enter for
    IP Address: the address that you were given
    Subnet Mask: 255.255.255.0

    For DNS Configuration, click Enable DNS. Enter for
    Host: slip
    Domain: cs.swarthmore.edu
    DNS Server Search Order 130.58.68.10 and click Add
    130.58.64.20 and click Add
    Domain Suffix Search Order cs.swarthmore.edu and click Add
    swarthmore.edu and click Add
    For Gateway, enter
    New gateway 130.58.68.1 and click Add

    ! Do not forget to click on OK at the bottom of the TCP/IP window, ! otherwise your changes will not be saved. You will have to reboot the computer to take advantage of the changes.

    Physically connecting to the network

    Once you attach the cable adapter to the card, insert the card into one of the card slots, you should have a card icon appear in lower right corner of the screen, next to the digital clock.

    Take the loose end of the adapter cable (if it is an RJ-45 cable, it will look like a phone cable), and plug it in one of the available ports of the repeater. The repeater is a small white-and-pink Lantronix box that is currently sitting on one of the computer desks. Beware that one (or more) of the ports may be faulty. If you have successfully established a connection, both lights on the side of the inserted card will be lit.

    Connecting and transferring files

    Telnet.
    Go to Start->Run. Enter: "telnet". Click on OK.
    Once the Telnet window comes up, go to the Connect menu item at the top of the window, and enter the name of the computer you are trying to connect to.

    FTP.
    You can use a MS-DOS-based plain command-line FTP client. Bring up an MS-DOS window. On the command line enter:
    ftp TARGET_COMPUTER_NAME
    If you are connecting to your own account, you will have to enter your login name, and then the password, as prompted by the program. If you are connecting to an anonymous ftp site, i.e. a site that does not require passwords, you should enter "anonymous" or "ftp" as your login name, and "your_name@" for password. Once you are logged in, you can use "ls", "get", and "put" commands to list, download and upload files respectively.

    Another alternative is to use a user-friendly Windows-based FTP client. One such shareware program is currently installed, and it is called Rhino Software FTP Voyager. To use it, go to Start->Programs->Rhino Software FTP Voyager. Select New from the File menu (File->New). If you are connecting to your own account, type in the name of the computer where the account is located. If you are connecting to allspice.cs.swarthmore.edu, it is sufficient to type in "allspice". For the servers outside of Swarthmore you have to type in the full Internet name of the server, for instance, ftp.rwii.com. Also type in your login name, and your password. Make sure not to save your password, so nobody can temper with your account. Find the files that you want to download. Use the File->Get menu option to download the files onto the laptop. Then save the downloaded files wherever you choose to, possibly the desktop, or a directory.

    Pioneer FTP site.
    Pioneer ftp site is located at ftp.rwii.com. Swarthmore CS has an account at that site, for without a password we don't have access to the software and documentation.
    FTP site: ftp.rwii.com
    directory: pub/robots/Pioneer
    User id (login): swarth
    Password: AtQ1ATim

    Removing the card

    Black buttons immediately to the right of the card slots let you eject the card(s). PCs are known to freeze arbitrarily at times if one ejects a card without disabling it first. So, for your own sake you may want to disable the card. To do that, use the left mouse/pointing device button to click on the icon of the card in the lower right corner of the screen (next to the digital clock). A one-item menu will appear, Stop New Media Live Wire. Click on it. Now you may safely remove the card.

    Chapter 3: Precompile Processing

    After you have retrieved your .beh file or .c files from the SUN workstation, there are a couple of things that need to be changed before attempting to compile on the PC

    Where to Place Files

    There is a shortcut on the desktop labeled Shortcuts to Projects. Open this shortcut; it is where all students' projects are currently located. If you wish to create a new Standalone Application or Saphira Application, you must copy an existing template or you can attempt to create a new one from MS-Developer; we suggest copying an existing template. The instructions for how to do this are in a later section. However, you should place files you download into a folder in this directory for compilation later. So, make a folder with your name, and place all downloads (.c and .beh) files into it.

    Changes in Code for PCs

    There is really only one major change for the PC. In the includes for Saphira Applications, instead of including "conf-sol", change it to "conf-msw". That is the only real change for the PC.

    However, there were some other problems that we ran across and gave us compilation errors:

    Using Bgram

    To go from a .beh file to a .c for compiling a Saphira Application, you must first Bgram it; just like on the SUNs. The easiest way to do this is by opening up a DOS window and doing it from there. So, open up a DOS window and go the folder containing your .beh file. Then to Bgram it, just enter: bgram - just like Unix. This should write a .c file in that directory to be placed into your MS-Developer Project. Read the section on developing a Saphira Application to learn how to take the next steps!

    Chapter 4: Working with MS Developer Studio

    To launch MSDS, go to the Start Menu. Click and hold to get the popup menu. Move to Programs, then Microsoft Visual C++ 4.0, then release your click on Microsoft Developer Studio.

    You will get an error message about Visual C++ Books Online not found. Click cancel. You now have a blank project.

    The first thing you need to do is set up a few things:

    REMEMBER: WHEN MAKING CHANGES TO THE VARIOUS SETTINGS, YOU MUST CLICK THE OK BOX TO SAVE THE CHANGES. IF YOU JUST CLOSE THE WINDOW, YOUR CHANGES WILL BE LOST.
    Note: $SAPHIRA stands for the appropriate path to the handler/src/obj directory in the Saphira Distribution. Currently, for the ver 5.3 on the PC, this is C:\Saphira53\VER53".

    Setting the Search/Include Paths

    The first thing you need to do is make sure all of the include directories are set up. However, once you make this setting, it will stay for all future projects, so you only have to do it once per Saphira update. Then you need to reset the directories for their new locations.
    1. From the "Tools" Menu, select "Options...".
    2. Click on the "Directories" tab.
    3. With "Platform" set to "Win32" and "Show directories for" set to "Include files", check the "Directories" list. You should find "$SAPHIRA\HANDLER\INCLUDE" and "$SAPHIRA\HANDLER\OBJ". If they are not there, add them by clicking in the blank box in the "Directories" list and typing in the path names you need to add.
    4. Once you have made your changes, click "OK".

    Including the sf.lib

    You have to do this for every project you create; it isn't persistant like the include directories.
    1. From the "Build" Menu, select "Settings...".
    2. Click the "Link" tab.
    3. With "Category" set to General", type "$SAPHIRA\HANDLER\OBJ\Sf.lib" into the "Object/library modules:" text space. Enter it first in the list, before kernel32.lib.
    4. Once you have made the change, click "OK".
    Now you are ready to start building your application.

    Standalone Application

    Standalone Applications are used for the low level control of the Pioneer, using commands like sfRobotComInt.

    Creating a Work Space

    1. From the "File" Menu, select "New".
    2. Choose "Project Workspace" and click "OK".

      You should now be looking at the New Project Workspace dialog box.

    3. In the left "Type" section, choose "Console Application."
    4. Type the name for your project in "Name".
    5. Set the "Location" to your work folder.
    6. Click "Create."
    Now you have a new Work Space. Whenever you create a new Work Space, MSDEV will create a new subfolder in the destination folder. This subfolder will have the name of the project. In it are all of the files.

    Building/Compiling Code

    If you already have a file downloaded from the Suns for this project, skip to number 4.. If you are writing your code from scratch on the PC, start at number 1.
    1. From the "File" Menu, select "New".
    2. Choose "Text File" and click "OK".

      Now you have an empty text file in the text window.

    3. Enter your text into the new window. When you save the file, you can save it anywhere, but it will probably make more sense to save it in your project subfolder.

      Now you have a file on the hard drive that you want to put into your project, either written on the PC or downloaded from the Suns.

    4. From the "Insert" Menu, select "Files into Project...".
    5. Browse the hard drive for your file. When you find it, hilight it and click "Add".
    6. The file is now in the project. If you ever wish to remove a file from your project, click the "FileView" tab from the Project Workspace window on the left. Click the plus sign next to the folder that says "(project name) files". This will list all the files in the project. Highlight the file you want to remove, and select "Cut" from the "Edit" Menu, or press Ctrl-X.
    7. To actually compile, choose "Build" from the "Build" menu, or just press F7. All warnings and errors will appear in the long window that is below/beneath the Project Workspace and text windows.
    REMEMBER: THERE IS NO DIRECT CORRELATION BETWEEN HAVING FILES OPEN IN THE TEXT WINDOW AND HAVING THEM INCLUDED IN THE PROJECT. IT IS POSSIBLE TO HAVE SEVERAL NON-INCLUDED FILES AVAILABLE IN THE "WINDOWS" MENU, AND HAVE INCLUDED FILES NOT AVAILABLE IN THE "WINDOWS" MENU. TO OPEN OR CLOSE FILES IN THE TEXT WINDOW, USE THE "OPEN" AND "CLOSE" MENU OPTION FROM THE "FILE" MENU. YOU MAY HAVE TO CLICK IN THE TEXT WINDOW TO MAKE IT ACTIVE SO YOU CAN PERFORM THE OPEN AND CLOSE ACTIONS.

    Porting Code to PC

    See Changes in Code for PCs.

    Location of the Executables

    Your executable will be named (projectname).exe, and will be located in the Debug subfolder of your project folder.

    Saphira Application

    Saphira Applications are instances of the high level Saphira client. These are ususally the result of .beh files.

    Creating a Work Space

    1. From the "File" Menu, select "New".
    2. Choose "Project Workspace" and click "OK".

      You should now be looking at the New Project Workspace dialog box.

    3. In the left "Type" section, choose "Application."
    4. Type the name for your project in "Name".
    5. Set the "Location" to your work folder.
    6. Click "Create."
    Now you have a new Work Space. Whenever you create a new Work Space, MSDEV will create a new subfolder in the destination folder. This subfolder will have the name of the project. In it are all of the files.

    Including saphira.rc

    The file "Saphira.rc" has all of the window, etc resources for the Saphira application. So we must include this file into our project:
    1. From the "Insert" Menu, select "Resource".

      You should now be looking at the Insert Resource dialog box.

    2. Click "Import...".
    3. Browse the hard drive until you get to "$SAPHIRA\HANDLER". You should see the "Saphira.rc" file available. If not, check the "Files of type" files, and make sure it says "All Files (*.*)". Hilight "Saphira.rc" and click "Import".

      You should now be looking at the Custom Resource dialog box.

    4. You must fill in the "Resource Type" text area. Choose a pertinant name like "Saphira". Once you have entered a name, click "OK".
    You will now have some text windows with lots of nonsense looking letters. Don't worry about them, they're supposed to be there. Just don't change them.

    Building/Compiling Code

    You should already have a .c file as the result of Bgramming your .beh file.
    1. From the "Insert" Menu, select "Files into Project...".
    2. Browse the hard drive for your .c file. When you find it, hilight it and click "Add".
    3. The file is now in the project. If you ever wish to remove a file from your project, click the "FileView" tab from the Project Workspace window on the left. Click the plus sign next to the folder that says "(project name) files". This will list all the files in the project. Highlight the file you want to remove, and select "Cut" from the "Edit" Menu, or press Ctrl-X.
    4. To actually compile, choose "Build" from the "Build" menu, or just press F7. All warnings and errors will appear in the long window that is below/beneath the Project Workspace and text windows.
    REMEMBER: THERE IS NO DIRECT CORRELATION BETWEEN HAVING FILES OPEN IN THE TEXT WINDOW AND HAVING THEM INCLUDED IN THE PROJECT. IT IS POSSIBLE TO HAVE SEVERAL NON-INCLUDED FILES AVAILABLE IN THE "WINDOWS" MENU, AND HAVE INCLUDED FILES NOT AVAILABLE IN THE "WINDOWS" MENU. TO OPEN OR CLOSE FILES IN THE TEXT WINDOW, USE THE "OPEN" AND "CLOSE" MENU OPTION FROM THE "FILE" MENU. YOU MAY HAVE TO CLICK IN THE TEXT WINDOW TO MAKE IT ACTIVE SO YOU CAN PERFORM THE OPEN AND CLOSE ACTIONS.

    Turning Warnings Off

    Unfortunately, some of the code Bgram produces isn't pretty, so when you compile you get lots of warnings. These warnings are nothing to worry about, but printing them out slows down the compilation process. To turn them off:
    1. From the "Build" Menu, select "Settings...".
    2. Click the "C/C++" tab.
    3. Set the "Warning Level" field to "None".
    4. Click "OK".
    If you wish to turn them back on, follow the same process, except choose a warning level instead of "None".

    Porting Code to PC

    See Changes in Code for PCs.

    Location of the Executables

    Your executable will be named (projectname).exe, and will be located in the Debug subfolder of your project folder.

    Chapter 5: Testing the Robot in the World

    Gripper, Bumpers and Sound

    The gripper, bumpers and sound on the robot's front extension are quite easily controlled when another file is included in the main program: Lemo.h. This file contains easy-to-use functions that control the simple operations of the gripper, bumpers and sound.

    The gripper has 5 basic states. These are: OFF, MOVING, UP, DOWN, and MOVING. Each of these states can be detected and most of them entered using the appropriate commands in Lemo.h. The commands themselves and their use are detailed in comments in that file, so we won't go into them here. The movement of up/down and in/out is all controlled off of one motor, so there is no way to control both behaviours independently. When you move up/down, the paddles automatically move in/out.

    There are two bumpers located on the front of each paddle. These bumpers are set bits when they are hit; and these can be read by programs. The commands to do this are also highlited in the Lemo.h file. There are lights located on the paddles and also on the front chasis (the ones on the chasis use the same bits as the ones on the paddles - i.e. when one lights so does the other). These can be set on or off using a function.

    There is a small speaker located on one side of the front chasis. You can play tones through it by using 2 3-bit arguments; the first is for length, the second for pitch. It is not the best sound in the world, but adequate.

    There is a small example of many of these functions being used in C:\Saphira53\ver53\handler\src\apps\local product\default. (Or, you can click on the 'Shortcut to Projects' and then go into 'default'.) This should be sufficient to demonstrate these simple functions.

    Brief Instructions on Motor Enabling, etc.

    When testing things out on the real world, on the robot itself, there are a couple of important things to remember. The two buttons located next to the main power switch are the motor enabling/disabling switches. The white one enables the motors, the red disables. If the robot is about to "crash" then just hit the red button and it will stop moving.

    One of the biggest problems that we had all semester was the fact that the robot behaved quite differently from the simulator to the real world. The best advice that we can try to give is to try things out on the robot as much as possible as you create new behaviours or whatever. Test them out on the world and make sure they look similar to what is going on on the simulator. You may even save yourself some headaches later.