HOMEWORKS IN YEAR 2004.

  1. Late homeworks are accepted only in special cases. You have always one week for a homework to return, unless specified otherwise.

  2. Homework 1. Assigned on the first lecture.
    To be completed in one week.
    1. Create your own WWW page. Explain your background and present your interest in robotics. Send me by email the address of your page so I will link it for all class students to see. These pages will help in our group communication and especially in projects.
  3. Homework 2. Assigned on the second lecture.
    To be completed in one week.
    1. Write Lisp program to simulate a small animal like a turtle from Lego-Logo, or a vehicle of Breitenberg. The animal must show the following behaviors as response to typed-in external commands:
      • be able to go out of arbitrary labyrinth (it can take a lot of time).
      • avoid light
      • follow light
      • follow small animals (or obstacles such as balls).
      • avoid large animals (or obstacles such as big blocks).
      • try to be in crowd.
      • avoid crowd.
      • go around obstacles.
      • go to goal position specified by two coordinates (exact) or one cordinate (as far as you can go to North).
      • use as little energy as possible (go to any direction as far as you can from the start using your given initial total energy).
          You can add more behaviors if you wish. With a good control and data structures, this program can be easily extended to demonstrate group social (antisocial) behaviors, eating, mating, dying, wars, etc. There are many papers in Artificial Life journal and WWW pages about similar but much more complicated programs. Lisp code of Boids is on my www page. Obstacles will be first fixed in positions, but next they will move. Each object (animal) is described as a value of a variable, being an association list. For instance

          TURTLE_JOE = ( (Object_Type . animal) (Type . Turtle) (name . Turtle_Joe) (movement . controlled) (size . medium) (x_coordinate . 23) (y_coordinate . 345) (orientation . 234) (color . red) )

          Small_Mouse_Mary = ( (Object_Type . animal) (Type . Mouse) (name . Small_Mouse_Mary) (movement . controlled) (size . small) (x_coordinate . 223) (y_coordinate . 215) (orientation . 23) (color . white) )

          Big_Bad_Wolf = ( (Object_Type . animal) (Type . Wolf) (movement . controlled) (name Big_Bad_Wolf) (x_coordinate . 223) (y_coordinate . 50) (orientation . 29) (size . big) (color . black) )

          Wall1 = ( (Object_Type . stationary) (Type . Wall) (movement . none) (x_begin_coordinate . 223) (y_begin_coordinate . 50) (x_end_coordinate . 230) (y_end_coordinate . 150) (size . big) (color . black) )

          Triangle_Big = ( (Object_Type . stationary) (Type . Triangle) (movement . none) (x_middle_coordinate . 223) (y_middle_coordinate . 50) (size . big) (angle . 230) (color . red) )
          Order of dotted pairs in association lists is arbitrary, and some elements (dotted pairs) may be missing. You can invent other types of pairs (properties).

    Hints


    1. Separate the following pieces to separate groups of Lisp functions:
      1. control of the animal, described as a state machine with names of functions as states, and parameters as input signals. Actions (outputs of the machine) change the parameters of objects (such as animal1, animal2, ...)
      2. the objects describing the animal(s) and obstacles, as well as the geometry of the building (like FAB) or a labyrinth. At first assume that you have only one animal and obstacles that do not move, but make general data structures that you can extend next.
      3. the general-purpose graphics program that takes objects and draws them on the screen. Use the power of the graphics tool available in your Lisp. If you use a very simple Lisp such as Golden Hill Common Lisp, you can use only a procedure that draws a straight line interval.

        In the future, the PEOPLE-BOT and the Centaur Hexapod will be together guides in FAB building. They will be playing the role of turtle from this homework, and they conversation skills will be created in the next homeworks. There will be several types of verbal and non-verbal interactions between these two, and between them and the public. The operations like obstacle avoidance, planning, and navigation will remain.
      4. (defun life ()
         (setq all_objects '(wolf dog wall1 obstacle2))
        ;; here you create a list of all moving objects (animals), growing objects (plants) and non-animated objects (obstacles)
        ;; let us observe that the algorithm remains in principle the same for any number of any type of objects.
        ;; animals move, trees grow, other objects do not change their position. (adding trees and other animals is
        ;; optional in your homework)
             (simulate all_objects)
        )
        
        (defun simulate (list_of_objects_to_simulate)
             (new_list_of_objects_to_simulate (one_stage_of_life list_of_objects_to_simulate));; function one_stage_of_life
                ;; creates new states of objects and returns the new list of objects
                ;; the killed objects are removed, the new-born (as result of mating) objects are added)
                ;; the objects that reached their goals are removed.
             (cond ((equal_states list_of_objects_to_simulate new_list_of_objects_to_simulate)
                    (terminate)) ;; nothing changed in the micro-world, it became static, so let us make the end of world.
             (simulate new_list_of_objects_to_simulate) ;; recursive call with all old and new alive objects.
           )
        
        (defun one_stage_of_life (list-of-objects)
             (mapcar list-of-objects '(move_object object)) ; one unit of time of simulation
          ;; all objects from the list are "moved" (i.e. trees grow, animals move, kill, eat or mate, 
          ;; obstacles stay where they are) 
          ;; when two animals mate, they create a random number of children immediately
          ;; goals of children are averaged goals of parents (in this world). 
          ;; recall that goal is a (x,y) coordinate where the animals goes.
             (display all_objects) ;; just graphics, it goes through all objects and displays them.
             ;; you need some simple geometry like checking if two line intervals intersect to see if you are close to obstacle.
        
        
      5. whatever is your current position and orientation, if you know the goal, you find the best trajectory from where you are to the goal, so the past history does not count. This is the famous Bellman's Principle. Remember to assume that the sensors see in a distance of L "meters". If there is no obstacle, you go directly to the goal. I hope this helps, and now I am not going to tell anything more.
      Please write a complete and understable documentation to this program. Present it in class, demonstrate your software on your laptop or on one of PSU computers.
  4. Homework 3. Assigned on the third lecture.
    To be completed in two weeks. These programs will be next linked to the programs from Homework 2.
    This is a group exercise, with at least two and at most three people in every homework group. The homework groups are Homework3A, Homework3B, Homework3C, Homework3D, Homework3E, and Homework3F; and are not necessarily the same as in projects. You can treat groups as "dating period" to see if you like to work with other students on longer projects.

    Familiarize yourself with all the LISP programs stored on my Web Page and links from it. Adapt an existing Lisp program for applications of our class projects. The program can be taken from my WWW page (look to section "ELIZE-LIKE programs") or the Internet. (many collections of Lisp programs and AI programs exist, such as from U.C. Berkeley, Norvig, Stanford, CMU, MIT, etc) Give credit to all sources (books, WWW pages, papers) from which you took Lisp codes or ideas. Try to carefully analyze its data structures and control. Concentrate on basic functions, input-output, interaction, Eliza-like natural-language processing based on matching. Recursion. Learning from somebody's else programs is very, very useful. Of course, you have to create new discussion patterns related to electrical engineering, PSU education and so on, and only if the program will not recognize any of these patterns, it resorts to Eliza-like blah-blah-blah small-talk. Keep this small-talk to make program funny and looking more intelligent. You can also personalize the program, in many ways:
    1. giving it the ability to initiate converstation or waiting for you to initiate, use time function. If you do not start conversation in some time (random), the program starts.
    2. teaching it about Oregon politics, Portland traffic or any other pattern of casual small-talk conversation of PSU students.
    3. Use random functions and intelligence to switch from one Eliza to another Eliza. This makes astounding effects sometimes.

    Based on my past experience in this class; try to make this program really funny and captivating but avoid dirty words or sexually explicit humor.
    1. Homework3A: Adapt several Eliza programs for an interactive agent that will talk about Department of Electrical and Computer Engineering. It must have at least three emotions/personalities, each corresponding to one variant of Eliza. The emotions can be:
      1. friendly and happy guide, eager to help.
      2. unfriendly and unhappy guide, obviously bored and not helpful. Against everything.
      3. philosopher who philosophizes too much and is absentminded and somehow absent with his mind.
      4. a strict policeman.
      5. a janitor who does not know anything but tries to be kind.
      6. a person collecting money for a new Engineering Building, obsessed only with this idea.
      7. a rude teenager interested only in music.
      8. etc, etc, your choice. These personalities should be extreme to make the project easier. Glance through the book on affective computing how to model emotions.


      (In the past I wrote an Eliza-like program which fooled a woman with high school degree for about 15 minutes. Try to fool your friends or spouses). This program, together with other English-speaking programs and text generators, will be next used by Centaur or by People-Bot guide in FAB building.
    2. Homework3B: Adapt several rule-based programs for an interactive agent that will recognize the person who talks to it. It asks questions like "do you have glasses?", "are you a man?" to recognize every faculty in ECE department. Next, these questions will be replaced with features recognized by camera and sonar (person's height). This program will be next used by Centaur or by People-Bot guide in FAB building.
    3. Homework3C: Write a Lisp program that will use simplified English grammar generator and a sophisticated random number generator to generate speeches a'la: President Clinton, President Bush, Marek Perkowski (this one can be in broken English but characteristic to this person), or any other person distinguishable by our students.

      For instance. If you have five components to a sentence and each of them can have 10 patterns, the generated sentence will have 10 * 10 * 10 * 10 * 10 = 10^5 patterns. The nouns in patterns can be taken from a very large vocabulary, so the number of sentences is practically unlimited. There can be also complete citations from books or information taken in real-time from Internet. The success depends on how skillfully you combine patterns, how well is random number generator used and how complex is the English grammar (there are many available on WWW). Use Eliza-like variables to keep context, otherwise the talk will be completely nonsensical. Your goal is to have it limited but somehow to make sense. You can have a parameter to control freedom, controlled from 0 to 1. With value 0 of the parameter the talk is very logical but "mechanical" and boring. Like reading a telephone book or a catalog. With value 1 of the parameter the talk is very random or totally random and makes no general sense, but individual sentences can be amazingly interesting. The most intersting result is to create a personality of a "knowledgeable schizophrenic", with the value somewhere between 0 and 1. You can obtain an effect that few sentences are innovative and make sense. The longer you listen to the program the more you see its limitations, so in future this program will be switched-in for only short period of time.

      Example:

      Parameter 0.


      Dr. Tymerski teaches Power Electronics and Classical Control. Everybody likes his classes.
      Dr. Perkowski teaches Intelligent Robotics and Logic Synthesis. Some students like his classes, everybody thinks he requires too much.
      Dr. Jeske teaches Layout and Fabrication. Some students think that she requires too much.
      Dr. Hall teaches Microprocessors. Some people believe that she requires too little.

      To keep sense, most of the patterns is completely fixed, and randomness is used only for variants such as: "Everybody likes his classes", "Many students enjoy her classes", "Everybody enjoys his lectures", "Most people enjoy her teaching", etc.

      Example:

      Parameter 1.


      Dr. Tymerski teaches when he wants and what he wants in the cinema.
      Dr. Perkowski teaches in the evenings or in the nights or in a tie to the end.
      Dr. Jeske teaches when she does not want or in the night but under an umbrella in the cinema.
      Dr. Hall teaches slowly, uses red chalk and drives bicycle in a tuxedo.
      Dr. Mishchenko teaches quickly, does what everybody like, uses an umbrella and drives a snowboard to work.

      Observe that the sentences have usually correct syntax but do not make sense. The user of the program should be able to control the parameter from 0 to 1. Or, have more parameters. The context variables are some kind of filters that remove sentence patterns that absolutely make no sense. The idea is to have sentences that are correct gramatically, make sense as a whole and are not boring, allowing for totally unexpected sentences that can possible have some semantic truth.



      The program should use a data base of information about our department and sentence patterns / sentences typical for the given person. In the past I wrote a program who mimicked a Polish Communist Party leader speeches, which was a hit in Poland. I wrote also a similar program to ridiculose my grand-mother, which several people thought was very funny. Try to make your program funny. It can be done by a very careful selection of patterns and intelligent design of random number generator which will be not completely random but will be controlled by both the grammar and the data base. This program will be next used by Centaur or by People-Bot guide in FAB building. Its variants will be used by talking heads. Look what heads we have, can you have a good talk for one of our heads: an ape, a skeleton, Hillary Clinton, a little doll Molly, a mechanistic robot?
    4. Homework3D: Write a Lisp program to communicate in English with a robotic arm such as Rhino. You should use the program such as Shrdlu (many versions in Winston book and other WWW pages). You type the text, robot responds by generating text and moving blocks. Robot is blind, it just knows the initial positions of all colored boxes. Next it always stores in mind which block is where. This program will be used on Rhino or OWI.
    5. Homework3E: Write a Lisp program in Golden Hill Common Lisp on the PC from Industrial Robotics lab. Analyze graphics and sound generation of this language. Connect a simple robotic arm controlled from parallel or serial port. This program should allow for blind but programmable movement patterns such as moving chess pieces or solving the Tower of Hanoi or "Man, Wolf and Cabbage" puzzles. This program will be used on Rhino or OWI. Also, a new robot arm can be build using ideas from Robix WWW page.
    6. Homework3F: First install in Golden Hill Common Lisp on some new Pentium computer that has big enough memory to have the entire natural language analysis/synthesis system from OGI. Next write a simple Golden Hill Common Lisp that will be interfaced with OGI tools. This program will be next linked to the program from Homework3E.
  5. Homework 4.
    This project will be on individual basis, there will be one person in a group. Projects for undergraduate students are of course simpler.