Lab 7b - Saving the world from EVIL part 2


Due Date: Thursday, April 22, 11:59 PM


Justin Carlson


Introduction

In this lab, you will implement a multi-processing C program which will be used to execute the plan from your planner in lab 7a.

Setup

Compiling and running this lab requires AFS. This means you should ssh to one of the unix.qatar.cmu.edu machines to work, even if you have another linux machine (laptop, personal workstation, etc) on which you normally work.

This lab also requires that you have an X server running. Here's how you do this on several different machines:

xeyes screenshot
The xeyes program. 50% cute, 50% creepy.

You can test your X server by running xeyes on unix.qatar.cmu.edu; if you see a window pop up on your computer with a pair of eyes in it, then you have configured things properly.

libevil

A library has been provided to you to interface with EVILcorp servers. The library comes in two parts: evil.h and libevil.a. Both can be found in afs at:

/afs/qatar/usr/justinca/lab7/

Library usage is documented via the comments in the evil.h header file, but here is a trivial program that, given a valid server key, connects to the libevil servers:

eviltest.c:

#include "evil.h"

int main(int argc, const char *argv[]) 
{ 
        // Note this won't work!  You need real key
        // values to hack into the servers!
        le_server_t *server = le_hack(1, 2, 3, 4); 

        // Connect to robot 1
        le_robot_t *rob = le_robot_connect(server, 1); 

        // Tell the robot to move forward 1 space
        le_robot_move(rob); 

        // Don't continue executing until the robot is
        // ready to take another command
        le_robot_wait_until_ready(rob); 
} 

You can compile this program as follows:

gcc -c -g -Wall -O0 -I/afs/qatar/usr/justinca/lab7 eviltest.c
gcc -o eviltest eviltest.o -L/afs/qatar/usr/justinca/lab7 -levil

The -I command line option says "include this directory in the places you look for files included using quotes". the -L command line options means "include this directory in the places you look for libraries", and the -levil command line option means "link this program together with the object files contained in a library named libevil.h

server room screenshot
Your window into the server room.

If you successfully connect to the server and you have your X server running, you should see a window like the one on the right pop up. This window shows the current status of the server room, and will update as you command the robots.

The status window represents obstacles as light grey blocks, file locations as red bullseyes, and robot locations as green arrows. Note that your particular window will look different depending on the configuration of the server room to which you are connecting.

Your program

For this lab, your program needs to do the following:

Additionally, you'll need to do the following for this lab

Finally, in this lab, efficiency counts! To receive full credit on the lab, you should generate a plan that uses all three robots simultaneously, and then execute this plan in parallel on all three robots.

Misc Notes/Hints

If your planner from lab7a does not work well, you may use the Planner.java found in the lab7 afs directory as a starting point instead. Note that the provided planner is (intentionall) far from optimal, but it does work, and you are free to improve upon it for this lab.

If your robot crashes into an obstacle, you will not be able to give that robot any more commands

If your robot attempts to erase a file in a bad location, the corporation will notice the activity and send someone to terminate your connection

Note that server keys do expire. This may make testing more difficult, as you won't be able to continually test on the same input case -- you'll need to grab a new set of server keys periodically.

The backend software for this lab is all newly developed. Although it has been pretty extensively tested, it is likely not completely bug-free. If you encounter any strange behavior, please notify Prof. Carlson ASAP so he can track down bugs in the system.

Hand in your Solution

Using the same process as previous labs, copy your Perl(.pl), Java(.java), Shell Script, C Program(.c & .h), Makefile, and Design Document to the handin directory: ~yeng/15123-handin/andrew_id/L7b/.

Early submission is Wednesday midnight (+10% bonus), Thursday midnight is on time, Friday midnight is the end of the late period (-10% bonus).