I've generated some code samples to give a starting point for Project 2. Each of the following programs generates a simple VAL program that can be transferred to the PUMA controller via the GUI.
Each program does essentially the same thing: it defines a starting point, and then generates a circular arc trajectory (in the x-y plan) for the robot to follow. The generated VAL program has two parts:
gcc -o arc arc.c -lmand to execute it, type
arc r theta countwhere r, theta and count are the desired radius, arc angle and the number of subsegments which will approximate the arc, e.g.,
arc 45 180 10will produce code to trace an arc of radius 45mm, tracing 180 degrees which will be approximated by 10 straight line segments. If you type
arc 60 90 100the program will produce code to trace an arc of radius 60, tracing 90 degrees which will be approximated by 100 straight line segments.
g77 -o arc arc.fand to execute it, type
arcand the program will read r, theta and count from the file "input.txt." If you change the file name, you have to change the fortran code. (On a SUN computer, you should use "f77" instead of "g77").
chmod +x arc.pland to execute it, type
arc.pl r theta countwhere r, theta and count are as above. Note: you only have to run the "chmod" command one time. Even if you alter the program, you don't have to run "chmod" again.
javac Arc.javaand to execute it, type
java Arcand the program will read r, theta and count from the file "input.txt" and produce the file "program.txt" which contains the VAL code that can be transferred to the Puma controller via the GUI.
chmod +x arc.pyand then type
arc.pyto execute it.
Each program has the default output VAL program written to a file named "program.txt." To have the robot execute the program, you have to transfer it to the PUMA controller using the GUI (using "Transfer" under the "Program" menu option) like you did in Project 1.
Hint: both emacs and xemacs have a "mode" in which various codes are rendered in a way that makes them much easier to read, e.g., various commands, comments, etc., are rendered in different colors. To get this mode working, you have to be running emacs or xemacs (duh), and then start the appropriate "mode" for the type of programming language you are using (if you have a .emacs file in your home directory, this may be done automatically). For example, to start the "c mode", in (x)emacs type
ESC-x c-modeFor fortran, perl, or whatever, replace "c" with "fortran" "perl" or whatever.
ESC-x font-lock-modeand everything should appear in a nicely readable colorized format.