## Homework 1 16-311 Introduction to Robotics Prof. Howie Choset

### Due at beginning of class Tuesday, January 23rd

Create a webpage containing your text answers (and any pictures) in HTML format.

• Find a picture of a robot, not from Carnegie Mellon, on the web and display it. Comment on its application in terms of sense, plan, and act. As a student of Carnegie Mellon you get free webspace, click here to find out how to use it.

• Program: Matrix-Vector Evaluator
Write a program that runs under unix to perform 3x1 vector and 3x3 matrix arithmetic.

The program should take from standard input one line at a time a sequence of expressions, described below.

A line with nothing on it should do nothing. The command END should terminate the program.

The following are the commands to be defined:

• Vector and Matrix instantiation.
For vectors, a lower case letter followed by an ``='' sign, and then followed by three numbers sets the value for the vector. For matrices, an upper case letter, followed by an ``='' sign, and then followed by nine numbers sets the value for a matrix. To make things easier, assume there could only be 26 vectors and 26 matrices. Hint: there is a nice relationship between chars and ints in C.

• Printing.
A vector or matrix on a line by itself followed by return should print the vector or matrix in their appropriate forms.

c = a + b ------ store the sum of a and b into c.

C = A + B ------ store the sum of A and B into C.

• Multiplication
c = a.b ----- should compute the dot product of a and b and store in it in the first component of c. (Set the other components of c to zero)

c = a*b ----- store the cross product of a and b in c

C = A*B ----- perform matrix multiplication of A and B

v = M*x ----- perform the matrix-vector multiplication.

Feel free to use this sample code written by Cuban and commented by Howie (though you may do this your own way if you like).

Take a look at some clarifications, sample input and a sample program here.

### Turn in:

Submit to Nick Armstrong by email:

• the URL of your web page with the answers to the above questions
• a copy of your source code
• an AFS path to the executable of your code. Make sure there are readable (rl) AFS permissions properly set. To set your AFS permissions properly, do the following. When you are in the relevant directory, type "s setacl . system:anyuser rl". Or you can type the following, substituting your executable name for "matvec", "chmod a+rx matvec". Have a friend check running your code. We will run a script to check your code.

Last updated 1/15/07 by Nick Armstrong