Transcribed Text
Assignment Description
The purpose of this assignment is for you to learn more about different representations of orientation in 3D, to think
closely about the structure of the DH parameterization, and to practice the use of the DH convention for
describing forward kinematics on a real robot, the PHANToM Premium.
1. If you have not used MATLAB extensively before, read the MATLAB tutorial entitled "Getting Started" or
"Getting Started with MATLAB" from the tutorial introduction. The tutorial introduction is available online on
the PCs in the campus computing labs, and also comes online with the MATLAB Student Edition.
To
view
it
run MATLAB, and then run Documentation by typing in the command "doc" into the Command Window.
Work through all of the examples. While this may seem tedious, it is the best way to become
comfortable
with
the language and formatting requirements of MATLAB.
2. Write a MATLAB script called lab1 m that will demonstrate each of your working functions, with
appropriate visualization. Use the comments to describe what you are doing, and how each step is
accomplished. Add to this script as you complete each problem.
3.
Consider two frames, frame {A} and frame {B}. The orientation of {B} can be obtained by the
following sequence of operations:
a.
First, place {B} coincident with {A}
b.
Second, rotate {B} by Qy = E/N TE radians about PA.
2
C. Third, rotate {B} by 02 = Tradians about ZB.
Write a function rotate (P_B) that accepts the position vector P_B, referenced to frame {B},
and
returns
the vector P A, which is the same vector now referenced to frame {A}. Here we are strictly adhering to the
conventions of the textbook, i.e., Ap = AR Bp.
4. Write a function [T,T inv] = euler2ht (angles, pos) that accepts a 3element vector
angles of ZYX Euler angles and a 3element column vector pos representing the position vector APB
The function should return the appropriate homogeneous transformation matrix AT and it's inverse B AT1 = BT
,
using the symbolic formula  don't use MATLAB's builtin matrix inverse operator. Be sure to test it for any
reasonable choice of input arguments (always a good idea.)
5.
Write
a
function rollr (roll) which accepts a scalar roll value (in radians) and returns the corresponding
3x3 rotation matrix. You should test your function and your familiarity with MATLAB's 3D plotting features
1
by creating the following figure plots. (These do not need to be submitted.)
(a) Plot all three of the column vectors of this matrix on a single figure. Test this with a few different rotations
about the roll axis.
(b) Plot a 3element column vector. Experiment with plotting various vectors and transformed (rotated and
translated) vectors.
(c) Take two 3element column vectors and plot the vector connecting the two points identified by those
vectors.
Repeat these steps twice, creating new functions pitchr (pitch) and yawr (yaw) that accept pitch and
yaw angles, respectively, and return the appropriate rotation matrices.
6.
Use the functions you created above to write a new function rpyr (angles) that accepts a 3vector [roll,
pitch, yaw] (in radians) and returns the corresponding 3x3 rotation matrix. Test your function by plotting various
general rotations.
7.
Write a function rpytf (twist) that accepts a single 6vector twist containing [x, y, z, roll, pitch, yaw]
(angles in radians) and returns the corresponding 4x4 homogeneous transformation matrix. Test your function
with the function drawFrame provided to you by plotting various general transformations.
8. One way to think of DH parameters is as two pairs of translations and rotations, each pair being along the same
axis. We will informally describe a paired translation and rotation along the same axis as a screw transform.
Write a function screwtf (translation, rotation, ax) that accepts two scalars, translation and
rotation, and a 3D unit vector ax representing the axis of translation/rotation. In the book, you will find a
description of the angleaxis representation of 3D orientation, which will allow you to generate a rotation about
an arbitrary axis. Use the function drawScrew provided to you to test the function you have written, which it
calls, and see some fun visualization with color.
9.
Using your screwtf function, write a function screwDH (a, alpha, d, theta) that accepts four scalar DH
parameters and returns a 4x4 homogeneous transformation matrix according to the DH convention. You can
check your result using the formula for this matrix given in the book and in class.
10. One popular robot configuration in haptics research is a 6R manipulator. These robots consist of a 3R
robot arm and a
3R wrist. Visit the Mechatronics and Haptic Interfaces (MAHI) Lab teaching space, Ryon Lab B14 (basement)
to see the PHANToM robots that use this configuration. 2 Note that although the PHANToM Premium has a
parallel configuration, it can be treated as a serial robot with a simple geometric relationship between the angle
of the last link (to which the stylus is attached) and the angles of the links to which the motors are attached.
Assuming what we can actually specify are the angular positions of the motor shafts, and not the joints
themselves, you will also need to measure the transmission ratios of the cable transmissions used by the
PHANToM.
Figure 1. PHANTOM Premium
(a). Our real version of the robot only consists of the 3R robot arm, and we will be adding the wrist (or gimbal)
in simulation in part (b). Measure the link lengths L1, l2 and l3 (in millimeters). Also measure the cable
transmissions ratios. Make a table of the DH parameters and develop the homogeneous transformation matrix
describing the forward kinematic equations of the serial arm. Place the world frame (the zero frame) at the
actual robot base, so that the first link length is included as a parameter. Draw the robot in its zero position so
that the links are perpendicular to their neighboring links, as it is approximately depicted in the figure above on
the right. In addition to assigning a world frame, and one to each of the three links. Also attach an endeffector
frame to the robot's wrist center (the tip of the stylus in the figure) with its Z axis pointing along the third link.
Turn in your written solution to the PHANToM forward kinematics, including a 3D drawing of the robot and
the table of DH parameters, to the box outside of the MAHI Lab OR in class.
(b). For the following exercise in MATLAB, we will attach an additional frame to the serial manipulator, called
the gimbal frame. The transform from the endeffector frame to the gimbal frame is a pure rotation generated
from rollpitchyaw angles that we can choose arbitrarily. Write a function for the forward kinematics of the
serial
version
of
the
PHANToM
called
[phantomT__O_g,phantom_T]= =
phantomFK(joint_angles,gimbal_angles) that takes as its input a vector joint angles of the

form
01 , O2 , Q3 ] describing the position of each link relative to the previous one, and a vector
gimbal angles of rollpitchyaw angles, and outputs a 4x4 homogeneous transformation
phantom T from the base frame to the gimbal frame and a cell array phantom T of the 4x4
homogeneous transformations for this robot (with positions in millimeters). The transforms needed are { IT,
'T2 , 2T3, 3. Tg }, where the subscripts e and g describe the "endeffector" and "gimbal" frames. Test your
function using various inputs and the function drawPhantom(actuator_angles,gimbal_angles)
and the function movePhantom (path file) provided to you. In order to convert the input
actuator angles
into
joint
angles,
you
must
also
write
a
function
actuator2joint (actuator angles) that takes a 3vector of motor angles and converts them to
PHANToM joint angles using the transmission ratios that you measure on the actual robot (HINT: this mapping
contains more than just scalar multiplication!)
These solutions may offer stepbystep problemsolving explanations or good writing examples that include modern styles of formatting and construction
of bibliographies out of text citations and references. Students may use these solutions for personal skillbuilding and practice.
Unethical use is strictly forbidden.
function movePhantom( path_file )
% Lab 1
% Solutions
%
% Plot a graphical representation of the PHANToM Premium haptic robot with
% attached coordinate frames as it moves through a series of poses
% defined by path_file.
%
% Load path data
data = load(path_file);
s = data.s;
% Draw PHANToM initially in zero position
actuator_angles = [0,0,0];
gimbal_angles = [0,0,0];
handles = drawPhantom(actuator_angles,gimbal_angles);
hold on;
% Draw in 3D
for t = 1:size(s,2)
% Move robot
actuator_angles = s(1:3,t)';
gimbal_angles = s(4:6,t)';
joint_angles = actuator2joint(actuator_angles);
[phantom_T_0_g,phantom...