ECE 452: Matlab Simulation of a Robotic Manipulator

ECE 452: Robotics, Algorithms and Control final project, spring 2014. This project was developed by Bryan Bickel.

Project Objective: The objective of this project was to develop a program which would animate the movement of a serial link robotic manipulator in MATLAB. The program was to implement a graphical user interface (GUI). The problem statement defines the number of links, the initial twist coordinates, the initial configuration of the manipulator, velocity, and the end point as the user input. Project Methodology: Because the program needed to work with any serial link manipulator that the user could specify, “End point” was assumed to be a vector specifying the end value of each joint’s variable.

Part 1: The Easy Hard Way

A command line program (one utilizing the command window and work space in MATLAB) was first developed to gather and interpret user data. An example manipulator was programmed in to streamline testing. The program gathered N, the number of joints, and then ran a for loop N times to gather information on each joint. Points qi, a 3 by 1 vector, and the joint twist zeta_i, a 6 x 1 vector, were gathered in the for loop. Once the joint information was gathered, the initial transformation matrix gst(0) was created for each point qi. This matrix was equal to [R P; 0 1] where R is the 3×3 identity matrix and P is the vector qi. 0 a 1×3 vector of all zeros, and 1 is 1×1 and equal to 1. Another for loop gathered the end point data which consisted of each joint’s ending angle and the frame in which it would reach this angle by. This allows some joints to move quickly through their angle and others to move much more slowly. Once all the information was gathered, each animation frame was created through a for loop. Each iteration of the for loop would create the twist hat matrix [ OmegaHat, v; 0] where OmegaHat is the skew symmetric matrix created from the twist’s axis w and v is the twist’s velocity. A twist is a 6×1 vector consisting of 2 3×1 vectors [v; w]. Lowercase v is velocity and w is the axis. Each joint’s zetaHat matrix is multiplied by the joint’s ending angle Theta and the frame count/the joint’s end frame. This quantity is then passed to MATLAB’s “expm(<var>)” function to create the matrix exponential. The code snippet is: zetaTheta = expm(zetaHat*(endTheta(1)*(thetaFrame(1)/thetaFrameEnd(1) ))); The matrix exponential is used to create the matrix gst(t) for each point qi by multiplying the exponential matrix by the original gst(0). The vector P inside each gst(t) matrix is extracted and plotted using scatter3 and plot3 to create our animated robotic manipulator. Getframe and Movie are used to create the animation. The command line program is available for download here: https://copy.com/z41DpJzmonSw

Part 2: The Easy Hard Way

The GUI was developed utilizing code adapted from the above example. It was developed using MATLAB’s built in GUI editor, GUIDE. The final version of the GUI has several built in examples and also accepts user input. A screenshot of the final GUI is shown below: The GUI went through several iterations until the simplest, easiest to use form was decided on. The options were labeled as intuitively as I could make them. On the left, the “End Frame” option allows the user to edit how long the animation should run for. The “Number of joints (q)” option allows the user to specify how many points, which represent each joint, in the manipulator. “Autocreate Twists” allows the user to decide if the computer should create the twists using Twist = (  -w x q; w) where w, v are 3×1 vectors representing the axis and point q. The twist is a 6×1 vector. The autocreate feature only creates revolute joints. If the joint is prismatic, you will have to edit it (while the ‘autocreate’ checkbox is unchecked) to be Twist = ( w, 0) where w and 0 are 3×1 vectors specifying the axis and 0 is all zeros. “Normalize w and create Theta” normalizes the axis and uses the magnitude as the value for each joint’s end Theta. The popup box labeled “Twists zeta” in the screenshot allows the user to examine the matrices representing points q, axis w, twists zeta, ending angles, and the ending frames in the table. Each column represents data pertaining to the column number’s joint. (Column 1 represents q1 when q is selected. Column 4 would represent q4.) “Flush All Tables to MATLAB” saves all of the variables specified in the GUI to the work space in MATLAB’s command window. On the right side, starting in the top, are the example manipulators. Most of the examples pick random values for end frame and ending angles. Screenshots of the simulation and their real life counterparts are shown below: uArm manipulators by UFactory Drawing of a SCARA manipulator

The Kraft Viper Manipulator was also simulated, but because of it’s unique geometry, I recommend using another program that can visualize the wire frame of the manipulator. The jaws opening is represented by point farthest left in the screenshot. The prismatic joint does work, but the entire jaw mechanism is represented by two points at the left of the picture, which does not visually represent the manipulator well. Real life Kraft Viper Manipulator: