Escolar Documentos
Profissional Documentos
Cultura Documentos
By
PRIYANSHU AGARWAL
KUMAR VISHWAJEET
DECEMBER 2009
i
Contents
Abstract
Contents
1 Introduction
1.1 Problem Formulation
1.2 Challenges Involved
1.3 Report Organization
2 Background
2.1 Workspace
2.2 Measure of Manipulability
3 Mathematical/Other methods
3.1 Kinematic Modeling
3.1.1 Forward Pose Kinematics
3.1.2 Inverse Pose Kinematics
3.2 Jacobian Matrix Evaluation
4 Implementation
4.1 MATLAB Implementation Algorithms
4.1.1 Forward Pose Kinematics
4.1.2 Inverse Pose Kinematics
4.1.3 Manipulator Parameters Variation
4.1.4 Yoshikawa’s/Condition Number Manipulability Index
4.1.5 Workspace Analysis
4.1.5.1 Maximal Workspace
4.1.5.2 Dextrous Workspace
4.1.5.3 Constant Orientation Workspace
4.1.6 Path Tracking
4.2 Development of MATLAB program and GUI
5 Results
5.1 Manipulability Analysis
5.2 Workspace Analysis
5.3 Path Tracking Analysis
ii
6 Discussion
Bibliography
Appendix
A.1 MATLAB code for the Forward Kinematics of the 3‐PRR Planar
Parallel manipulator
A.2 MATLAB code for the Inverse kinematics of the 3‐PRR Planar
Parallel manipulator
A.3 MATLAB code for the Manipulator display of the 3‐PRR Planar
Parallel manipulator
A.4 MATLAB code for the Manipulator display of the 3‐PRR Planar
Parallel manipulator along with plotting
A.5 MATLAB code for the GUI of the 3‐PRR Planar Parallel manipulator
iii
Chapter 1
Introduction
1.1 Problem Formulation
A study of one of the above illustrated 3-PRR parallel manipulators will be carried out. In case a
generalized modeling incorporating both the configurations would be feasible, it will be carried out. The
study is categorized in the following major phases:
1. Kinematic modeling of the manipulator. (Forward & Inverse Kinematics)
2. Development of MATLAB program and GUI.
3. Analysis of the manipulator for workspace, manipulability and path tracking.
1. Modeling the system for Forward and Inverse pose Kinematics – Considering the complexity of the
system a closed form solution might not always be possible for forward pose kinematics. In such a
case developing a robust numerical technique that can not only provide a solution but also do so in
least amount of time is needed.
2. Manipulability study – An evaluation of the Jacobian of the system is required for carrying out a
manipulability study of the system which might be challenging.
3. Workspace Evaluation – Different kinds of workspace such as maximal, dexterous and constant
orientation need solving the inverse kinematics of the system iteratively and using suitable
algorithm.
4. Path Tracking Control – Implementing control of the manipulator end effector using different types
of control techniques i.e. open loop, joint space closed loop and task space closed loop is
challenging.
1
1.3 Report Organization
Chapter 1 deals with the overview of the problem addressed.
Chapter 2 deals with the background on types of workspace and measures of manipulability.
Chapter 5 presents the results obtained from the manipulability, workspace and path tracking analysis.
Appendix A contains the MATLAB code for the programs and GUI used for the analysis of 3-PRR
Planar Parallel manipulator.
2
Chapter 2
Background
2.1 Workspace
The different kind of workspaces [4] that are of interest are:
1. Maximal workspace or reachable workspace: all the locations of the operating point C that may be
reached with at least one orientation of the platform.
2. Dexterous workspace: all the locations of C for which all orientations are possible. The dextrous
workspace is a particular case of total orientation workspace, the ranges for the rotation angles being
[0, 2π].
3. Constant orientation workspace or translation workspace: all possible locations of C of the robot that
can be reached with a given orientation
This equation indicates how a relative error in B gets multiplied, and leads to a relative error in X. The
error amplification factor, called the condition number κ, is therefore defined as
κ(A) = ||A||||A−1||
For J−1, the condition number expresses how a relative error in Θ gets multiplied and leads to a relative
error in X. It characterizes in some sense the dexterity of the robot, and will be used as a performance
index. The condition number is dependent on the choice of the matrix norm. The most used norms are as
follows: − the 2-norm, defined as the square root of the largest eigenvalue of matrix J−TJ−1: the condition
number of J−1 is thus the square root of the ratio between the largest and the smallest eigenvalues of
J−TJ−1. The smallest possible value of the condition number is 1. The inverse of the condition number,
which has a value in [0,1], is also often used; a value of 0 indicates that the inverse jacobian matrix is
singular.
3
Chapter 3
Mathematical Methods
3.1 Kinematic Modeling
Objective: To develop the Kinematic Equations for 3-PRR Planar Parallel Manipulator.
Assumptions:
1. The points P11, P12 and P13 are assumed to lie on the vertices of an equilateral triangle.
2. The three connecting points on the endeffector are symmetrically placed around the end-effector
coordinate.
3. The prismatic joints are considered to be the only active joints in system.
β3
θ13 d3
P23
a13 θ23
P33
δ32 a δ
θ21 δ31 23 33
a21 φe
P31
(xe, ye)
a11 a22 θ
22 θ12
P21 θ11 a12
d1 P32 d2
P22
(x1, y1) (x2, y2)
P11 P12
Y β2
β1
X
Figure 3-1 Nomenclature used in the modeling of the 3-PRR manipulator
From the above figure we have
θ 31 = ϕ e + δ 31
Equating the above equations and substituting the value of θ31 we get,
x1 + d 1 cos β 1 + a11 cos θ 11 = xe + a 21 cos (ϕ e + δ 31)
y1 + d 1 sin β 1 + a11 sin θ 11 = ye + a 21 sin (ϕ e + δ 31)
Similarly breaking the loop about points P32 and P33, we can obtain
Considering the complexity of the system obtaining a closed form solution of the system is not possible.
So, using numerical techniques the unknown quantities can be evaluated.
Let the coordinates of the point P31 be (x31, y31) and that of P21 be (x21, y21), then
5
Now, the equation of the line passing through P11 and P21 can be expressed as
y − y1 = tan β 1( x − x1)
Since, it passes through P21, the coordinates of P21 evaluated above must satisfy this equation.
Substituting the values in the equation of the line, we get
y 31 + a11 sin (θ 21) − y1 = tan β 1( x31 + a11 cos (θ 21) − x1)
⎛ θ 21 ⎞
Now, using half-tan substitution for sin(θ21) and cos(θ21), and assuming tan ⎜ ⎟ = t , we get
⎝ 2 ⎠
( y 31 − y1)(1 + t 2 ) + 2a11t = ( x31 − x1) tan β 1(1 + t 2 ) + a11 tan β 1(1 − t 2 )
− B ± B 2 − 4 AC
t=
2A
where,
A = ( y 31 − y1) − ( x31 − x1) tan β 1 + a11 tan β 1
B = 2a11
C = ( y 31 − y1) − ( x31 − x1) tan β 1 − a11 tan β 1
Now,
θ 21 = 2atan2(− B ± B 2 − 4 AC , 2 A)
d 1 = ( x 21 − x1) 2 + ( y 21 − y1) 2
xe + a 21 cos (ϕ e + δ 31) − x1 − d 1 cos β 1
tan θ 11 =
ye + a 21 sin (ϕ e + δ 31) − y1 − d 1 sin β 1
6
x3 + d 3 cos β 3 + a13 cos θ 13 = xe + a 23 cos (ϕ e + δ 33 )
y 3 + d 3 sin β 3 + a13 sin θ 13 = ye + a 23 sin (ϕ e + δ 33 )
AX = Bθ
⇒ X = A−1 Bθ
So, J = A−1 B
7
Chapter 4
Implementation
4.1 MATLAB Implementation Algorithms
The following section presents the algorithms used to implement various features of the GUI. The
algorithms presented are self-explanatory.
4.1.1 Forward Pose Kinematics
If solution No
exists
Yes
Return
4.1.2 Inverse Pose Kinematics
If solution No
exists
Yes Return
8 Solution doesn’t exist
Return
4.1.3 Manipulator Parameters Variation
If slider clicked
Collect xe, ye, φe,
d1, d2, d3
a11, a12, a13,
a21, a22, a23,
β1, β 2 and β 3 from the GUI
If solution No
exists
Yes Return
Configuration not possible
Return
x = xmin->xmax, y = ymin->ymax
Yes
Calculate
w= JJ T
k = rcond(J-TJ-1)
Yes
Store (x,y)
Yes
Store (x,y)
x = xmin->xmax, y = ymin->ymax
Yes
Store (x,y)
Invoke Ode45
dθ = 0 Open Loop: Invoke Forward Kinematics function Iterate if
Iterate if Closed Loop: t<Simulation
t<Simulation Joint: Invoke Inverse Kinematics function (desired value) time
time Invoke Forward Kinematics function
Task: Invoke Forward Kinematics function
B
No If solution exists
A Yes
11
A
Calculate J-1
B
Open Loop: θ = J −1 X
Closed Loop:
Joint: θ = J −1 X + K (θ d − θ a )
Task: θ = J −1 X + K ( Xd − Xa )
Figure 4.1 MATLAB GUI for Kinematic Analysis of 3-PRR Planar Parallel Manipulator
The Graphical User Interface developed for the 3-PRR planar parallel manipulator has the following
features:
1. It has a graphical display of the manipulator.
2. It has sliders to manipulate the joint space coordinates (θs, ds) and based on the forward
kinematics, the (x, y, φe) of the end effector is evaluated.
3. It has sliders to manipulate the task space coordinates (x, y, φe) and based on inverse kinematics,
the (ds) of the manipulator links is calculated.
4. It has sliders to vary the link lengths and end-effector geometry.
5. It has the capability to calculate 2d and 3d plots for Yoshikawa’s Manipulability and Condition
Number Manipulability for the given workspace limits.
6. It has the capability to calculate Maximal, Dextrous and Constant Orientation Workspace of the
manipulator.
12
7. It has the capability to track a circle or ellipse based on the used specified value of end-effector angle
or rate of change of end-effector angle, type of control, control gain in case closed loop control is
specified and simulation time.
8. It has the ability to switch on and off grid, scale and nomenclature of the manipulator.
9. The text beside the sliders also displays the current value of the slider.
10. It displays a message corresponding to the current status of the program working at the rear end.
Figure 4.2 MATLAB GUI displaying message during evaluation of the configuration
11. It comments on the configuration possibilities for a given combination of input parameters and also
displays the possible cause in case of a failure.
13
Figure 4.3 MATLAB GUI commenting on the possibility of configuration and the possible cause of the
failure.
12. It has a reset button to set the manipulator back to its original configuration.
14
Chapter 5
Results
5.1 Manipulability Analysis
Figure 5-1 illustrates the manipulability plots of 3-PRR manipulator. The plots are obtained using
0.8
Yoshikawa's Manipulability
0.6
0.4
0.2
0
8
6 15
4 10
2 5
Ye 0 0
Xe
(a)
0.4
0.3
0.2
1/k
0.1
0
8
6 15
4 10
2 5
Ye 0 0
Xe
(b)
Figure 5-1 Manipulability plots of 3-PRR parallel planar manipulator. a) Yoshikawa’s
manipulability plot, b) Condition number manipulability plot
A study of the variation of the manipulability of the manipulator is carried out by varying the end-
effector angle. The plots shown in Figure 5-2 are obtained from the analysis. It is observed that the
15
Figure 5-2 Variation of manipulability of the manipulator with end-effector angle
manipulability follows a pattern with the variation of the end-effector angle. The projected view of the
manipulability is obtained on the workspace. The shape changes from a hexagon to a triangle as φe
varies from -180 degrees to -120 degrees. Further the manipulability reduces to a point as φe is reduced
to -80 degrees. It then again starts growing as a triangle with further decreases in φe. At φe=0 degrees it
again attains its hexagonal shape. The same variation as mentioned above is obtained for φe varying
from 0 degrees to 180 degrees.
But there is major drawback to the condition number. For a robot having at least one translational and
one rotational d.o.f., the inverse jacobian will be heterogeneous as far as units are concerned. For
instance, for 3-PRR robot, the elements of the matrix corresponding to translations are dimensionless,
whereas those corresponding to the rotations are lengths. A direct consequence is that the condition
number has no clear physical meaning, as the rotations are transformed arbitrarily into “equivalent”
16
translations. Hence one has to be quite careful when using such an index as an optimality criteria for a
parallel robot. [4]
5.2 Workspace Analysis
Figure 5-3 shows the different kind of workspace related to the 3-PRR manipulator.
It is observed that the maximal workspace for the manipulator is a hexagon. For dexterous workspace it
is observed that only one point exists in the entire workspace at which the manipulator is capable of
(a) (b)
(c)
17
Figure 5-3 Path tracking performance of the manipulator. a) Open Loop Control, b) Joint Space
Closed Loop Control and c) Task Space Closed Loop Control
The following observations are made in general for both the circle and the ellipse.
1.For open loop control the manipulator is able to reproduce the exact shape of the path but the position
itself is drifted.
2.For Joint space control the manipulator tries to converge to the path to be traced. However, its ability
to reproduce the exact path depends heavily on the start point of the manipulator, the control gain
value, time step of the solver, robustness of the numerical technique used for solving the forward
kinematics. It is observed that with high gain value though the manipulator tries to converge to the
desired trajectory fast but the inability of the numerical technique to find a solution that lies farther
from the current configuration makes the solution slow. In case less number of iterations is used to
solve the forward kinematics the manipulator drifts from the path due to its inability to find forward
kinematics solutions for a considerable number of times consecutively which leads to error in
trajectory.
3.For task space control the manipulator is able to almost reproduce the exact path. Here also the
manipulator shows a similar behavior as discussed above.
18
Chapter 6
Discussion
The following results are obtained from the study:
1. Manipulability Analysis: The manipulability of the 3-PRR manipulator has a wide range at an end-
effector angle φe of -180 degrees, 0 degrees and 180 degrees which reduces to a point as φe
approaches -90 degrees or 90 degrees.
2. Workspace Analysis: The maximal workspace of 3-PRR manipulator is hexagonal in shape. The
dexterous workspace is a point. The constant orientation workspace can be hexagon or a triangle
depending upon the orientation of the end-effector.
19
Bibliography
[1] Masouleh M T, Gosselin C, 2007, Determination of Singularity-Free Zones in the Workspace of
Planar 3- PRR Parallel Mechanisms, Journal of Mechanical Design.
[2] Stefan Staicu, 2009, Inverse dynamics of the 3-PRR planar parallel robot, Robotics and
Autonomous Systems, ScienceDirect.
[3] Nakamura Yoshihiko, Advanced Robotics Redundancy and Optimization, Addison-Wesley
Publishing Company.
[4] J.-P. MERLET, Parallel Robots, (Second Edition), Springer, ISBN-13 978-1-4020-4133-4
20
Appendix A
A.1 MATLAB code for the Forward Kinematics of the 3-PRR Planar Parallel
manipulator.
function [P] = PRR3_ForwardPosKin(x0,P11,P12,P13,d,b,a,d3,n_limit)
% Function to return the position of the 3PRR manipulator end effector for
% given manipulator geometry and joint variables
ni = 0;
sgn = 1;
%x -> xe ye phie t11 t12 t13
Kin_Eqn = @(x) [P11(1)+d(1)*cos(b(1))+a(1,1)*cos(x(4))-x(1)-a(2,1)*cos(x(3)+d3(1));
P11(2)+d(1)*sin(b(1))+a(1,1)*sin(x(4))-x(2)-a(2,1)*sin(x(3)+d3(1));
P12(1)+d(2)*cos(b(2))+a(1,2)*cos(x(5))-x(1)-a(2,2)*cos(x(3)+d3(2));
P12(2)+d(2)*sin(b(2))+a(1,2)*sin(x(5))-x(2)-a(2,2)*sin(x(3)+d3(2));
P13(1)+d(3)*cos(b(3))+a(1,3)*cos(x(6))-x(1)-a(2,3)*cos(x(3)+d3(3));
P13(2)+d(3)*sin(b(3))+a(1,3)*sin(x(6))-x(2)-a(2,3)*sin(x(3)+d3(3))];
f1 = [0 0 0 0 0 0]';
% options=optimset('Display','iter','MaxFunEvals',1000); % Option to display
output
options=optimset('MaxFunEvals',1000,'Display','Off'); % Option to display output
[P, fval, exitflag] = fsolve(Kin_Eqn,x0,options);
while(exitflag<1 & ni<n_limit)
[P, fval, exitflag] = fsolve(Kin_Eqn,x0,options);
f2 = fval;
% if(ni/2==uint8(ni/2))% Alternate Algorithms tried
% sgn = -1;
% else
% sgn = +1;
% end
% sgn = [sign(f1-f2)]'
% x0(1:2) = x0(1:2) + sgn(1:2)*0.1;
% x0(3) = x0(3) + sgn(3)*ni*0.01;
% x0(4:6) = x0(4:6) + sgn(4:6)*ni*0.01;
x0(1:2) = x0(1:2) + sgn*0.1;
x0(3) = x0(3) + sgn*ni*0.01;
x0(4:6) = x0(4:6) + sgn*ni*0.01;
ni = ni+1;
f1 = f2;
% pause;
end
------------------------------------------------------------------------------------------------------------
A.2 MATLAB code for the Inverse Kinematics of the 3-PRR Planar Parallel
manipulator.
function [D] = PRR3_InversePosKin(P11,P12,P13,Pe,b,a,d3)
% Function to return the joint variables of the 3PRR manipulator for
% given end effector pose and minpulator geometry
sgn1 = -1;
sgn2 = 1;
sgn3 = 1;
x31 = Pe(1)+a(2,1)*cos(Pe(3)+d3(1));
x32 = Pe(1)+a(2,2)*cos(Pe(3)+d3(2));
x33 = Pe(1)+a(2,3)*cos(Pe(3)+d3(3));
y31 = Pe(2)+a(2,1)*sin(Pe(3)+d3(1));
-1-
y32 = Pe(2)+a(2,2)*sin(Pe(3)+d3(2));
y33 = Pe(2)+a(2,3)*sin(Pe(3)+d3(3));
A1 = y31-P11(2)-(x31-P11(1))*tan(b(1))+a(1,1)*tan(b(1));
B1 = 2*a(1,1);
C1 = y31-P11(2)-(x31-P11(1))*tan(b(1))-a(1,1)*tan(b(1));
A2 = y32-P12(2)-(x32-P12(1))*tan(b(2))+a(1,2)*tan(b(2));
B2 = 2*a(1,2);
C2 = y32-P12(2)-(x32-P12(1))*tan(b(2))-a(1,2)*tan(b(2));
A3 = y33-P13(2)-(x33-P13(1))*tan(b(3))+a(1,3)*tan(b(3));
B3 = 2*a(1,3);
C3 = y33-P13(2)-(x33-P13(1))*tan(b(3))-a(1,3)*tan(b(3));
if((isreal(sqrt(B1^2-4*A1*C1)))&(isreal(sqrt(B2^2-4*A2*C2)))&(isreal(sqrt(B3^2-
4*A3*C3))))
t21b = 2*atan2((-B1+sgn1*sqrt(B1^2-4*A1*C1)),(2*A1));
t11 = t21b-pi;
d1 = sqrt((x31+a(1,1)*cos(t21b)-P11(1))^2+ (y31+a(1,1)*sin(t21b)-P11(2))^2);
t22b = 2*atan2((-B2+sgn2*sqrt(B2^2-4*A2*C2)),(2*A2));
t12 = t22b-pi;
d2 = sqrt((x32+a(1,2)*cos(t22b)-P12(1))^2+ (y32+a(1,2)*sin(t22b)-P12(2))^2);
t23b = 2*atan2((-B3+sgn3*sqrt(B3^2-4*A3*C3)),(2*A3));
t13 = t23b-pi;
d3 = sqrt((x33+a(1,3)*cos(t23b)-P13(1))^2+ (y33+a(1,3)*sin(t23b)-P13(2))^2);
------------------------------------------------------------------------------------------------------------
A.3 MATLAB code for the Manipulator display of the 3-PRR Planar Parallel
manipulator.
function [] = PRR3_Manipulator_Display(P11,P12,P13,d,b,t,a,Pe,dn)
% Function to display 3PRR manipulator for given link sizes and angular
% positions
cla
a = a(1,:);
-2-
h32 = line([P13(1)+d(3)*cos(b(3)) P13(1)+d(3)*cos(b(3))+a(3)*cos(t(3))],
[P13(2)+d(3)*sin(b(3))
P13(2)+d(3)*sin(b(3))+a(3)*sin(t(3))],'LineWidth',3,'Color',[1 0 0]); %Displaying
patch([P11(1)-3*cos(b(1))-0.3*sin(b(1)),P11(1)-
3*cos(b(1))+0.3*sin(b(1)),P11(1)+0.3*cos(b(1))+0.3*sin(b(1)),P11(1)+0.3*cos(b(1))-
0.3*sin(b(1))],...
[P11(2)-3*sin(b(1))+0.3*cos(b(1)),P11(2)-3*sin(b(1))-
0.3*cos(b(1)),P11(2)+0.3*sin(b(1))-
0.3*cos(b(1)),P11(2)+0.3*sin(b(1))+0.3*cos(b(1))],...
'k','FaceAlpha',0,'LineWidth',1);
patch([P12(1)-3*cos(b(2))-0.3*sin(b(2)),P12(1)-
3*cos(b(2))+0.3*sin(b(2)),P12(1)+0.3*cos(b(2))+0.3*sin(b(2)),P12(1)+0.3*cos(b(2))-
0.3*sin(b(2))],...
[P12(2)-3*sin(b(2))+0.3*cos(b(2)),P12(2)-3*sin(b(2))-
0.3*cos(b(2)),P12(2)+0.3*sin(b(2))-
0.3*cos(b(2)),P12(2)+0.3*sin(b(2))+0.3*cos(b(2))],...
'k','FaceAlpha',0,'LineWidth',1);
patch([P13(1)-3*cos(b(3))-0.3*sin(b(3)),P13(1)-
3*cos(b(3))+0.3*sin(b(3)),P13(1)+0.3*cos(b(3))+0.3*sin(b(3)),P13(1)+0.3*cos(b(3))-
0.3*sin(b(3))],...
[P13(2)-3*sin(b(3))+0.3*cos(b(3)),P13(2)-3*sin(b(3))-
0.3*cos(b(3)),P13(2)+0.3*sin(b(3))-
0.3*cos(b(3)),P13(2)+0.3*sin(b(3))+0.3*cos(b(3))],...
'k','FaceAlpha',0,'LineWidth',1);
hold on
m = patch([P11(1)+d(1)*cos(b(1))+a(1)*cos(t(1))
P12(1)+d(2)*cos(b(2))+a(2)*cos(t(2)) P13(1)+d(3)*cos(b(3))+a(3)*cos(t(3))],...
[P11(2)+d(1)*sin(b(1))+a(1)*sin(t(1))
P12(2)+d(2)*sin(b(2))+a(2)*sin(t(2))
P13(2)+d(3)*sin(b(3))+a(3)*sin(t(3))],'b','FaceAlpha',0.5); %Displaying
rectangle('Position',[P11(1)+d(1)*cos(b(1))+a(1)*cos(t(1))-
0.4,P11(2)+d(1)*sin(b(1))+a(1)*sin(t(1))-0.4,0.8,0.8],...
'Curvature',[1,1],...
'LineWidth',1);
rectangle('Position',[P12(1)+d(2)*cos(b(2))+a(2)*cos(t(2))-
0.4,P12(2)+d(2)*sin(b(2))+a(2)*sin(t(2))-0.4,0.8,0.8],...
'Curvature',[1,1],...
'LineWidth',1);
rectangle('Position',[P13(1)+d(3)*cos(b(3))+a(3)*cos(t(3))-
0.4,P13(2)+d(3)*sin(b(3))+a(3)*sin(t(3))-0.4,0.8,0.8],...
'Curvature',[1,1],...
'LineWidth',1);
rectangle('Position',[P11(1)+d(1)*cos(b(1))-0.4,P11(2)+d(1)*sin(b(1))-
0.4,0.8,0.8],...
'Curvature',[1,1],...
'LineWidth',1);
rectangle('Position',[P12(1)+d(2)*cos(b(2))-0.4,P12(2)+d(2)*sin(b(2))-
0.4,0.8,0.8],...
-3-
'Curvature',[1,1],...
'LineWidth',1)
rectangle('Position',[P13(1)+d(3)*cos(b(3))-0.4,P13(2)+d(3)*sin(b(3))-
0.4,0.8,0.8],...
'Curvature',[1,1],...
'LineWidth',1)
if(dn==1)
text((P11(1)+P11(1)+d(1)*cos(b(1)))/2,(P11(2)+P11(2)+d(1)*sin(b(1)))/2,'d1','FontWe
ight','Bold');
text((P12(1)+P12(1)+d(2)*cos(b(2)))/2, (P12(2)+P12(2)+d(2)*sin(b(2)))/2
,'d2','FontWeight','Bold');
text((P13(1)+P13(1)+d(3)*cos(b(3)))/2,
(P13(2)+P13(2)+d(3)*sin(b(3)))/2,'d3','FontWeight','Bold');
text((P11(1)+d(1)*cos(b(1))+P11(1)+d(1)*cos(b(1))+a(1)*cos(t(1)))/2,(P11(2)+d(1)*si
n(b(1))+P11(2)+d(1)*sin(b(1))+a(1)*sin(t(1)))/2,'a11','FontWeight','Bold');
text((P12(1)+d(2)*cos(b(2))+P12(1)+d(2)*cos(b(2))+a(2)*cos(t(2)))/2,
(P12(2)+d(2)*sin(b(2))+P12(2)+d(2)*sin(b(2))+a(2)*sin(t(2)))/2,'a12','FontWeight','
Bold');
text((P13(1)+d(3)*cos(b(3))+P13(1)+d(3)*cos(b(3))+a(3)*cos(t(3)))/2,
(P13(2)+d(3)*sin(b(3))+P13(2)+d(3)*sin(b(3))+a(3)*sin(t(3)))/2,'a13','FontWeight','
Bold');
line([P11(1)+d(1)*cos(b(1))+a(1)*cos(t(1))
Pe(1)],[P11(2)+d(1)*sin(b(1))+a(1)*sin(t(1)) Pe(2)],'Color',[0 0 0]);
text((P11(1)+d(1)*cos(b(1))+a(1)*cos(t(1))+Pe(1))/2,(P11(2)+d(1)*sin(b(1))+a(1)*sin
(t(1))+Pe(2))/2,'a21','FontWeight','Bold');
line([P12(1)+d(2)*cos(b(2))+a(2)*cos(t(2))
Pe(1)],[P12(2)+d(2)*sin(b(2))+a(2)*sin(t(2)) Pe(2)],'Color',[0 0 0]);
text((P12(1)+d(2)*cos(b(2))+a(2)*cos(t(2))+Pe(1))/2,(P12(2)+d(2)*sin(b(2))+a(2)*sin
(t(2))+Pe(2))/2,'a22','FontWeight','Bold');
line([P13(1)+d(3)*cos(b(3))+a(3)*cos(t(3))
Pe(1)],[P13(2)+d(3)*sin(b(3))+a(3)*sin(t(3)) Pe(2)],'Color',[0 0 0]);
text((P13(1)+d(3)*cos(b(3))+a(3)*cos(t(3))+Pe(1))/2,(P13(2)+d(3)*sin(b(3))+a(3)*sin
(t(3))+Pe(2))/2,'a23','FontWeight','Bold');
end
drawnow
end
------------------------------------------------------------------------------------------------------------
A.4 MATLAB code for the Manipulator display of the 3-PRR Planar Parallel
manipulator along with plotting.
function [] = PRR3_Manipulator_Display(P11,P12,P13,d,b,t,a,Pe,D,dn)
% Function to display 3PRR manipulator for given link sizes and angular
% positions
cla
a = a(1,:);
-4-
h21 = line([P12(1) P12(1)+d(2)*cos(b(2))], [P12(2)
P12(2)+d(2)*sin(b(2))],'LineWidth',10,'Color',[0 1 0]); %Displaying
h22 = line([P12(1)+d(2)*cos(b(2)) P12(1)+d(2)*cos(b(2))+a(2)*cos(t(2))],
[P12(2)+d(2)*sin(b(2))
P12(2)+d(2)*sin(b(2))+a(2)*sin(t(2))],'LineWidth',3,'Color',[1 0 0]); %Displaying
h31 = line([P13(1) P13(1)+d(3)*cos(b(3))], [P13(2)
P13(2)+d(3)*sin(b(3))],'LineWidth',10,'Color',[0 1 0]); %Displaying
h32 = line([P13(1)+d(3)*cos(b(3)) P13(1)+d(3)*cos(b(3))+a(3)*cos(t(3))],
[P13(2)+d(3)*sin(b(3))
P13(2)+d(3)*sin(b(3))+a(3)*sin(t(3))],'LineWidth',3,'Color',[1 0 0]); %Displaying
patch([P11(1)-3*cos(b(1))-0.3*sin(b(1)),P11(1)-
3*cos(b(1))+0.3*sin(b(1)),P11(1)+0.3*cos(b(1))+0.3*sin(b(1)),P11(1)+0.3*cos(b(1))-
0.3*sin(b(1))],...
[P11(2)-3*sin(b(1))+0.3*cos(b(1)),P11(2)-3*sin(b(1))-
0.3*cos(b(1)),P11(2)+0.3*sin(b(1))-
0.3*cos(b(1)),P11(2)+0.3*sin(b(1))+0.3*cos(b(1))],...
'k','FaceAlpha',0,'LineWidth',1);
patch([P12(1)-3*cos(b(2))-0.3*sin(b(2)),P12(1)-
3*cos(b(2))+0.3*sin(b(2)),P12(1)+0.3*cos(b(2))+0.3*sin(b(2)),P12(1)+0.3*cos(b(2))-
0.3*sin(b(2))],...
[P12(2)-3*sin(b(2))+0.3*cos(b(2)),P12(2)-3*sin(b(2))-
0.3*cos(b(2)),P12(2)+0.3*sin(b(2))-
0.3*cos(b(2)),P12(2)+0.3*sin(b(2))+0.3*cos(b(2))],...
'k','FaceAlpha',0,'LineWidth',1);
patch([P13(1)-3*cos(b(3))-0.3*sin(b(3)),P13(1)-
3*cos(b(3))+0.3*sin(b(3)),P13(1)+0.3*cos(b(3))+0.3*sin(b(3)),P13(1)+0.3*cos(b(3))-
0.3*sin(b(3))],...
[P13(2)-3*sin(b(3))+0.3*cos(b(3)),P13(2)-3*sin(b(3))-
0.3*cos(b(3)),P13(2)+0.3*sin(b(3))-
0.3*cos(b(3)),P13(2)+0.3*sin(b(3))+0.3*cos(b(3))],...
'k','FaceAlpha',0,'LineWidth',1);
hold on
m = patch([P11(1)+d(1)*cos(b(1))+a(1)*cos(t(1))
P12(1)+d(2)*cos(b(2))+a(2)*cos(t(2)) P13(1)+d(3)*cos(b(3))+a(3)*cos(t(3))],...
[P11(2)+d(1)*sin(b(1))+a(1)*sin(t(1)) P12(2)+d(2)*sin(b(2))+a(2)*sin(t(2))
P13(2)+d(3)*sin(b(3))+a(3)*sin(t(3))],'b','FaceAlpha',0.25); %Displaying
% y = quiver(Pe(1),Pe(2),200,200,'r');
rectangle('Position',[P11(1)+d(1)*cos(b(1))+a(1)*cos(t(1))-
0.4,P11(2)+d(1)*sin(b(1))+a(1)*sin(t(1))-0.4,0.8,0.8],...
'Curvature',[1,1],...
'LineWidth',1);
rectangle('Position',[P12(1)+d(2)*cos(b(2))+a(2)*cos(t(2))-
0.4,P12(2)+d(2)*sin(b(2))+a(2)*sin(t(2))-0.4,0.8,0.8],...
'Curvature',[1,1],...
'LineWidth',1);
rectangle('Position',[P13(1)+d(3)*cos(b(3))+a(3)*cos(t(3))-
0.4,P13(2)+d(3)*sin(b(3))+a(3)*sin(t(3))-0.4,0.8,0.8],...
'Curvature',[1,1],...
'LineWidth',1);
-5-
rectangle('Position',[P11(1)+d(1)*cos(b(1))-0.4,P11(2)+d(1)*sin(b(1))-
0.4,0.8,0.8],...
'Curvature',[1,1],...
'LineWidth',1);
rectangle('Position',[P12(1)+d(2)*cos(b(2))-0.4,P12(2)+d(2)*sin(b(2))-
0.4,0.8,0.8],...
'Curvature',[1,1],...
'LineWidth',1)
rectangle('Position',[P13(1)+d(3)*cos(b(3))-0.4,P13(2)+d(3)*sin(b(3))-
0.4,0.8,0.8],...
'Curvature',[1,1],...
'LineWidth',1)
plot(D(:,1),D(:,2),'-r','LineWidth',2);
drawnow;
if(dn==1)
text((P11(1)+P11(1)+d(1)*cos(b(1)))/2,(P11(2)+P11(2)+d(1)*sin(b(1)))/2,'d1','FontWe
ight','Bold');
text((P12(1)+P12(1)+d(2)*cos(b(2)))/2, (P12(2)+P12(2)+d(2)*sin(b(2)))/2
,'d2','FontWeight','Bold');
text((P13(1)+P13(1)+d(3)*cos(b(3)))/2,
(P13(2)+P13(2)+d(3)*sin(b(3)))/2,'d3','FontWeight','Bold');
text((P11(1)+d(1)*cos(b(1))+P11(1)+d(1)*cos(b(1))+a(1)*cos(t(1)))/2,(P11(2)+d(1)*si
n(b(1))+P11(2)+d(1)*sin(b(1))+a(1)*sin(t(1)))/2,'a11','FontWeight','Bold');
text((P12(1)+d(2)*cos(b(2))+P12(1)+d(2)*cos(b(2))+a(2)*cos(t(2)))/2,
(P12(2)+d(2)*sin(b(2))+P12(2)+d(2)*sin(b(2))+a(2)*sin(t(2)))/2,'a12','FontWeight','
Bold');
text((P13(1)+d(3)*cos(b(3))+P13(1)+d(3)*cos(b(3))+a(3)*cos(t(3)))/2,
(P13(2)+d(3)*sin(b(3))+P13(2)+d(3)*sin(b(3))+a(3)*sin(t(3)))/2,'a13','FontWeight','
Bold');
line([P11(1)+d(1)*cos(b(1))+a(1)*cos(t(1))
Pe(1)],[P11(2)+d(1)*sin(b(1))+a(1)*sin(t(1)) Pe(2)],'Color',[0 0 0]);
text((P11(1)+d(1)*cos(b(1))+a(1)*cos(t(1))+Pe(1))/2,(P11(2)+d(1)*sin(b(1))+a(1)*sin
(t(1))+Pe(2))/2,'a21','FontWeight','Bold');
line([P12(1)+d(2)*cos(b(2))+a(2)*cos(t(2))
Pe(1)],[P12(2)+d(2)*sin(b(2))+a(2)*sin(t(2)) Pe(2)],'Color',[0 0 0]);
text((P12(1)+d(2)*cos(b(2))+a(2)*cos(t(2))+Pe(1))/2,(P12(2)+d(2)*sin(b(2))+a(2)*sin
(t(2))+Pe(2))/2,'a22','FontWeight','Bold');
line([P13(1)+d(3)*cos(b(3))+a(3)*cos(t(3))
Pe(1)],[P13(2)+d(3)*sin(b(3))+a(3)*sin(t(3)) Pe(2)],'Color',[0 0 0]);
text((P13(1)+d(3)*cos(b(3))+a(3)*cos(t(3))+Pe(1))/2,(P13(2)+d(3)*sin(b(3))+a(3)*sin
(t(3))+Pe(2))/2,'a23','FontWeight','Bold');
end
drawnow
end
------------------------------------------------------------------------------------------------------------
-6-
A.5 MATLAB code for the GUI of the 3-PRR Planar Parallel manipulator.
function varargout = PRR3_GUI_2(varargin)
% PRR3_GUI_2 M-file for PRR3_GUI_2.fig
% PRR3_GUI_2, by itself, creates a new PRR3_GUI_2 or raises the
% existing
% singleton*.
%
% H = PRR3_GUI_2 returns the handle to a new PRR3_GUI_2 or the handle
% to
% the existing singleton*.
%
% PRR3_GUI_2('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in PRR3_GUI_2.M with the given input arguments.
%
% PRR3_GUI_2('Property','Value',...) creates a new PRR3_GUI_2 or
% raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before PRR3_GUI_2_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to PRR3_GUI_2_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
%Variables
% Pe - Pose of End Effector (xe,ye,phie)
%t - (theta11, theta12, theta13)
clc
global Pe t
Pe = [15/2 15*sin(pi/3)/3 0];
t = [30 150 270]*pi/180;
set(handles.d2_slider,'sliderstep',slider_step,...
'max',10,'min',-10);%,'Value',3);
set(handles.d3_slider,'sliderstep',slider_step,...
'max',10,'min',-10);%,'Value',3);
set(handles.a11_slider,'sliderstep',slider_step,...
'max',10,'min',-10);%,'Value',3);
set(handles.a12_slider,'sliderstep',slider_step,...
'max',10,'min',-10);%,'Value',3);
set(handles.a13_slider,'sliderstep',slider_step,...
'max',10,'min',-10);%,'Value',3);
set(handles.a21_slider,'sliderstep',slider_step,...
'max',10,'min',-10);%,'Value',3);
set(handles.a22_slider,'sliderstep',slider_step,...
'max',10,'min',-10);%,'Value',3);
set(handles.a23_slider,'sliderstep',slider_step,...
'max',10,'min',-10);%,'Value',3);
-8-
set(handles.b2_slider,'sliderstep',slider_step,...
'max',2*pi,'min',0);%,'Value',2*pi/3+pi/6);
set(handles.b3_slider,'sliderstep',slider_step,...
'max',2*pi,'min',0);%,'Value',3*pi/2);
set(handles.d1_disp,'String',num2str(get(handles.d1_slider,'Value')));
set(handles.d2_disp,'String',num2str(get(handles.d2_slider,'Value')));
set(handles.d3_disp,'String',num2str(get(handles.d3_slider,'Value')));
set(handles.a11_disp,'String',num2str(get(handles.a11_slider,'Value')));
set(handles.a12_disp,'String',num2str(get(handles.a12_slider,'Value')));
set(handles.a13_disp,'String',num2str(get(handles.a13_slider,'Value')));
set(handles.a21_disp,'String',num2str(get(handles.a21_slider,'Value')));
set(handles.a22_disp,'String',num2str(get(handles.a22_slider,'Value')));
set(handles.a23_disp,'String',num2str(get(handles.a23_slider,'Value')));
set(handles.b1_disp,'String',num2str(get(handles.b1_slider,'Value')*180/pi));
set(handles.b2_disp,'String',num2str(get(handles.b2_slider,'Value')*180/pi));
set(handles.b3_disp,'String',num2str(get(handles.b3_slider,'Value')*180/pi));
% set(handles.open_loop_radio,'Value',0);
% set(handles.joint_space_radio,'Value',1);
% set(handles.task_space_radio,'Value',0);
%Displaying Manipulator
P11 = [0;0];
P12 = [15;0];
P13 = [15/2;15*sin(pi/3)];
d = [get(handles.d1_slider,'Value'); get(handles.d2_slider,'Value');
get(handles.d3_slider,'Value')];% (d1,d2,d3)
b = [get(handles.b1_slider,'Value'); get(handles.b2_slider,'Value');
get(handles.b3_slider,'Value')];
-9-
a = [get(handles.a11_slider,'Value') get(handles.a12_slider,'Value')
get(handles.a13_slider,'Value');get(handles.a21_slider,'Value')
get(handles.a22_slider,'Value') get(handles.a23_slider,'Value')];
d3 = [210; 330; 90]*pi/180; %(delta31,delta32,delta33)
% t = [30; 150; 270]*pi/180;
% Pe = [get(handles.xe_slider,'Value') get(handles.ye_slider,'Value')
get(handles.phie_slider,'Value')];
x0 = [Pe t];
S = PRR3_ForwardPosKin(x0,P11,P12,P13,d,b,a,d3,10);
if(isempty(S))
set(handles.status_text,'String','Configuration Not Possible!(Initialization
Error) Resetting...','ForegroundColor',[1 0 0]);
pause(1);
reset_button_Callback(hObject, eventdata, handles);
drawnow;
else
t = [S(4) S(5) S(6)];
Pe = [S(1) S(2) S(3)];
axes(handles.Main_axes);
if(get(handles.display_scale_checkbox,'Value')==1)
set(handles.Main_axes,'FontSize',10);
else
set(handles.Main_axes,'FontSize',1);
end
grid off
if(get(handles.grid_checkbox,'Value')==1)
grid off
grid minor
else
grid off
end
axis([-5 20 -5 20]);
PRR3_Manipulator_Display(P11,P12,P13,d,b,t,a,Pe,get(handles.display_names_checkbox,
'Value'));
set(handles.ye_slider,'sliderstep',slider_step,...
'max',10,'min',-10,'Value',Pe(2));
set(handles.phie_slider,'sliderstep',slider_step,...
'max',pi,'min',-pi,'Value',Pe(3));
set(handles.xe_disp,'String',num2str(get(handles.xe_slider,'Value')));
set(handles.ye_disp,'String',num2str(get(handles.ye_slider,'Value')));
set(handles.phie_disp,'String',num2str(get(handles.phie_slider,'Value')*180/pi));
end
% --- Outputs from this function are returned to the command line.
- 10 -
function varargout = PRR3_GUI_2_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global Pe t
P11 = [0;0];
P12 = [15;0];
P13 = [15/2;15*sin(pi/3)];
d = [get(handles.d1_slider,'Value'); get(handles.d2_slider,'Value');
get(handles.d3_slider,'Value')];
b = [get(handles.b1_slider,'Value'); get(handles.b2_slider,'Value');
get(handles.b3_slider,'Value')];
a = [get(handles.a11_slider,'Value') get(handles.a12_slider,'Value')
get(handles.a13_slider,'Value');get(handles.a21_slider,'Value')
get(handles.a22_slider,'Value') get(handles.a23_slider,'Value')];
d3 = [210; 330; 90]*pi/180;
% t = [30; 150; 270]*pi/180;
Pe = [get(handles.xe_slider,'Value') get(handles.ye_slider,'Value')
get(handles.phie_slider,'Value')];
x0 = [Pe t];
S = PRR3_ForwardPosKin(x0,P11,P12,P13,d,b,a,d3,10);
if(isempty(S))
set(handles.status_text,'String','Configuration Not Possible!(d1 limit
exceeded)','ForegroundColor',[1 0 0]);
drawnow;
else
t = [S(4) S(5) S(6)];
Pe = [S(1) S(2) S(3)];
axes(handles.Main_axes);
PRR3_Manipulator_Display(P11,P12,P13,d,b,t,a,Pe,get(handles.display_names_checkbox,
'Value'));
set(handles.status_text,'String','Done!','ForegroundColor',[0 0 0]);
end
set(handles.xe_slider,'Value',Pe(1));
set(handles.ye_slider,'Value',Pe(2));
set(handles.phie_slider,'Value',Pe(3));
set(handles.xe_disp,'String',num2str(Pe(1)));
set(handles.ye_disp,'String',num2str(Pe(2)));
set(handles.phie_disp,'String',num2str(Pe(3)*180/pi));
PRR3_Manipulator_Display(P11,P12,P13,d,b,t,a,Pe,get(handles.display_names_checkbox,
'Value'));
set(handles.status_text,'String','Done!','ForegroundColor',[0 0 0]);
end
set(handles.xe_slider,'Value',Pe(1));
set(handles.ye_slider,'Value',Pe(2));
set(handles.phie_slider,'Value',Pe(3));
set(handles.xe_disp,'String',num2str(Pe(1)));
set(handles.ye_disp,'String',num2str(Pe(2)));
set(handles.phie_disp,'String',num2str(Pe(3)*180/pi));
PRR3_Manipulator_Display(P11,P12,P13,d,b,t,a,Pe,get(handles.display_names_checkbox,
'Value'));
set(handles.status_text,'String','Done!','ForegroundColor',[0 0 0]);
end
set(handles.xe_slider,'Value',Pe(1));
set(handles.ye_slider,'Value',Pe(2));
set(handles.phie_slider,'Value',Pe(3));
set(handles.xe_disp,'String',num2str(Pe(1)));
set(handles.ye_disp,'String',num2str(Pe(2)));
set(handles.phie_disp,'String',num2str(Pe(3)*180/pi));
- 13 -
b = [get(handles.b1_slider,'Value'); get(handles.b2_slider,'Value');
get(handles.b3_slider,'Value')];
a = [get(handles.a11_slider,'Value') get(handles.a12_slider,'Value')
get(handles.a13_slider,'Value');get(handles.a21_slider,'Value')
get(handles.a22_slider,'Value') get(handles.a23_slider,'Value')];
d3 = [210; 330; 90]*pi/180;
% t = [30; 150; 270]*pi/180;
Pe = [get(handles.xe_slider,'Value') get(handles.ye_slider,'Value')
get(handles.phie_slider,'Value')];
x0 = [d' t]
S = PRR3_InversePosKin(P11,P12,P13,Pe,b,a,d3)
if(isempty(S))
set(handles.status_text,'String','Configuration Not Possible!(Xe limit
exceeded)','ForegroundColor',[1 0 0]);
drawnow;
else
t = [S(4) S(5) S(6)]
d = [S(1) S(2) S(3)]
axes(handles.Main_axes);
PRR3_Manipulator_Display(P11,P12,P13,d,b,t,a,Pe,get(handles.display_names_checkbox,
'Value'))
set(handles.status_text,'String','Done!','ForegroundColor',[0 0 0]);
end
set(handles.d1_slider,'Value',d(1));
set(handles.d2_slider,'Value',d(2));
set(handles.d3_slider,'Value',d(3));
set(handles.d1_disp,'String',num2str(d(1)));
set(handles.d2_disp,'String',num2str(d(2)));
set(handles.d3_disp,'String',num2str(d(3)));
- 14 -
Pe = [get(handles.xe_slider,'Value') get(handles.ye_slider,'Value')
get(handles.phie_slider,'Value')];
x0 = [d' t]
S = PRR3_InversePosKin(P11,P12,P13,Pe,b,a,d3)
if(isempty(S))
set(handles.status_text,'String','Configuration Not Possible!(Ye limit
exceeded)','ForegroundColor',[1 0 0]);
drawnow;
else
t = [S(4) S(5) S(6)]
d = [S(1) S(2) S(3)]
axes(handles.Main_axes);
PRR3_Manipulator_Display(P11,P12,P13,d,b,t,a,Pe,get(handles.display_names_checkbox,
'Value'))
set(handles.status_text,'String','Done!','ForegroundColor',[0 0 0]);
end
set(handles.d1_slider,'Value',d(1));
set(handles.d2_slider,'Value',d(2));
set(handles.d3_slider,'Value',d(3));
set(handles.d1_disp,'String',num2str(d(1)));
set(handles.d2_disp,'String',num2str(d(2)));
set(handles.d3_disp,'String',num2str(d(3)));
- 15 -
else
t = [S(4) S(5) S(6)]
d = [S(1) S(2) S(3)]
axes(handles.Main_axes);
PRR3_Manipulator_Display(P11,P12,P13,d,b,t,a,Pe,get(handles.display_names_checkbox,
'Value'))
set(handles.status_text,'String','Done!','ForegroundColor',[0 0 0]);
end
set(handles.d1_slider,'Value',d(1));
set(handles.d2_slider,'Value',d(2));
set(handles.d3_slider,'Value',d(3));
set(handles.d1_disp,'String',num2str(d(1)));
set(handles.d2_disp,'String',num2str(d(2)));
set(handles.d3_disp,'String',num2str(d(3)));
PRR3_Manipulator_Display(P11,P12,P13,d,b,t,a,Pe,get(handles.display_names_checkbox,
'Value'));
set(handles.status_text,'String','Done!','ForegroundColor',[0 0 0]);
- 16 -
end
set(handles.xe_slider,'Value',Pe(1));
set(handles.ye_slider,'Value',Pe(2));
set(handles.phie_slider,'Value',Pe(3));
set(handles.xe_disp,'String',num2str(Pe(1)));
set(handles.ye_disp,'String',num2str(Pe(2)));
set(handles.phie_disp,'String',num2str(Pe(3)*180/pi));
PRR3_Manipulator_Display(P11,P12,P13,d,b,t,a,Pe,get(handles.display_names_checkbox,
'Value'));
set(handles.status_text,'String','Done!','ForegroundColor',[0 0 0]);
end
set(handles.xe_slider,'Value',Pe(1));
set(handles.ye_slider,'Value',Pe(2));
set(handles.phie_slider,'Value',Pe(3));
set(handles.xe_disp,'String',num2str(Pe(1)));
set(handles.ye_disp,'String',num2str(Pe(2)));
set(handles.phie_disp,'String',num2str(Pe(3)*180/pi));
- 17 -
% --- Executes during object creation, after setting all properties.
function a12_slider_CreateFcn(hObject, eventdata, handles)
if isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
PRR3_Manipulator_Display(P11,P12,P13,d,b,t,a,Pe,get(handles.display_names_checkbox,
'Value'));
set(handles.status_text,'String','Done!','ForegroundColor',[0 0 0]);
end
set(handles.xe_slider,'Value',Pe(1));
set(handles.ye_slider,'Value',Pe(2));
set(handles.phie_slider,'Value',Pe(3));
set(handles.xe_disp,'String',num2str(Pe(1)));
set(handles.ye_disp,'String',num2str(Pe(2)));
set(handles.phie_disp,'String',num2str(Pe(3)*180/pi));
PRR3_Manipulator_Display(P11,P12,P13,d,b,t,a,Pe,get(handles.display_names_checkbox,
'Value'));
set(handles.status_text,'String','Done!','ForegroundColor',[0 0 0]);
end
set(handles.xe_slider,'Value',Pe(1));
set(handles.ye_slider,'Value',Pe(2));
set(handles.phie_slider,'Value',Pe(3));
set(handles.xe_disp,'String',num2str(Pe(1)));
set(handles.ye_disp,'String',num2str(Pe(2)));
set(handles.phie_disp,'String',num2str(Pe(3)*180/pi));
PRR3_Manipulator_Display(P11,P12,P13,d,b,t,a,Pe,get(handles.display_names_checkbox,
'Value'));
set(handles.status_text,'String','Done!','ForegroundColor',[0 0 0]);
end
set(handles.xe_slider,'Value',Pe(1));
set(handles.ye_slider,'Value',Pe(2));
set(handles.phie_slider,'Value',Pe(3));
set(handles.xe_disp,'String',num2str(Pe(1)));
set(handles.ye_disp,'String',num2str(Pe(2)));
set(handles.phie_disp,'String',num2str(Pe(3)*180/pi));
- 20 -
d = [get(handles.d1_slider,'Value'); get(handles.d2_slider,'Value');
get(handles.d3_slider,'Value')];
b = [get(handles.b1_slider,'Value'); get(handles.b2_slider,'Value');
get(handles.b3_slider,'Value')];
a = [get(handles.a11_slider,'Value') get(handles.a12_slider,'Value')
get(handles.a13_slider,'Value');get(handles.a21_slider,'Value')
get(handles.a22_slider,'Value') get(handles.a23_slider,'Value')];
d3 = [210; 330; 90]*pi/180;
Pe = [get(handles.xe_slider,'Value') get(handles.ye_slider,'Value')
get(handles.phie_slider,'Value')];
x0 = [Pe t];
S = PRR3_ForwardPosKin(x0,P11,P12,P13,d,b,a,d3,10);
if(isempty(S))
set(handles.status_text,'String','Configuration Not Possible!(a21 limit
exceeded)','ForegroundColor',[1 0 0]);
drawnow;
else
t = [S(4) S(5) S(6)];
Pe = [S(1) S(2) S(3)];
axes(handles.Main_axes);
PRR3_Manipulator_Display(P11,P12,P13,d,b,t,a,Pe,get(handles.display_names_checkbox,
'Value'));
set(handles.status_text,'String','Done!','ForegroundColor',[0 0 0]);
end
set(handles.xe_slider,'Value',Pe(1));
set(handles.ye_slider,'Value',Pe(2));
set(handles.phie_slider,'Value',Pe(3));
set(handles.xe_disp,'String',num2str(Pe(1)));
set(handles.ye_disp,'String',num2str(Pe(2)));
set(handles.phie_disp,'String',num2str(Pe(3)*180/pi));
- 21 -
drawnow;
else
t = [S(4) S(5) S(6)];
Pe = [S(1) S(2) S(3)];
axes(handles.Main_axes);
PRR3_Manipulator_Display(P11,P12,P13,d,b,t,a,Pe,get(handles.display_names_checkbox,
'Value'));
set(handles.status_text,'String','Done!','ForegroundColor',[0 0 0]);
end
set(handles.xe_slider,'Value',Pe(1));
set(handles.ye_slider,'Value',Pe(2));
set(handles.phie_slider,'Value',Pe(3));
set(handles.xe_disp,'String',num2str(Pe(1)));
set(handles.ye_disp,'String',num2str(Pe(2)));
set(handles.phie_disp,'String',num2str(Pe(3)*180/pi));
PRR3_Manipulator_Display(P11,P12,P13,d,b,t,a,Pe,get(handles.display_names_checkbox,
'Value'));
set(handles.status_text,'String','Done!','ForegroundColor',[0 0 0]);
- 22 -
end
set(handles.xe_slider,'Value',Pe(1));
set(handles.ye_slider,'Value',Pe(2));
set(handles.phie_slider,'Value',Pe(3));
set(handles.xe_disp,'String',num2str(Pe(1)));
set(handles.ye_disp,'String',num2str(Pe(2)));
set(handles.phie_disp,'String',num2str(Pe(3)*180/pi));
PRR3_Manipulator_Display(P11,P12,P13,d,b,t,a,Pe,get(handles.display_names_checkbox,
'Value'));
set(handles.status_text,'String','Done!','ForegroundColor',[0 0 0]);
end
set(handles.xe_slider,'Value',Pe(1));
set(handles.ye_slider,'Value',Pe(2));
set(handles.phie_slider,'Value',Pe(3));
set(handles.xe_disp,'String',num2str(Pe(1)));
set(handles.ye_disp,'String',num2str(Pe(2)));
set(handles.phie_disp,'String',num2str(Pe(3)*180/pi));
- 23 -
% --- Executes during object creation, after setting all properties.
function b3_slider_CreateFcn(hObject, eventdata, handles)
if isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
- 24 -
set(handles.Main_axes,'FontSize',1);
end
PRR3_Manipulator_Display(P11,P12,P13,d,b,t,a,Pe,get(handles.display_names_checkbox,
'Value'));
set(handles.status_text,'String','Done!','ForegroundColor',[0 0 0]);
end
set(handles.xe_slider,'Value',Pe(1));
set(handles.ye_slider,'Value',Pe(2));
set(handles.phie_slider,'Value',Pe(3));
set(handles.xe_disp,'String',num2str(Pe(1)));
set(handles.ye_disp,'String',num2str(Pe(2)));
set(handles.phie_disp,'String',num2str(Pe(3)*180/pi));
set(handles.b1_disp,'String',num2str(get(handles.b1_slider,'Value')*180/pi));
set(handles.b2_disp,'String',num2str(get(handles.b2_slider,'Value')*180/pi));
set(handles.b3_disp,'String',num2str(get(handles.b3_slider,'Value')*180/pi));
- 25 -
t = [S(4) S(5) S(6)];
d = [S(1); S(2); S(3)];
break
end
end
end
end
axes(handles.Main_axes);
plot(Ws(:,1),Ws(:,2),'*','Markersize',10);
patch([Wx(1) Wx(length(Wx)) Wx(length(Wx)) Wx(1)],[Wy(1) Wy(1) Wy(length(Wy))
Wy(length(Wy))],[0 0 0],'FaceAlpha',0,'LineWidth',2);
text(-1,17.5,['Maximal Workspace for given
configuration'],'FontWeight','bold','FontSize',14);
set(handles.status_text,'String','Done!','ForegroundColor',[0 0 0]);
set(handles.status_text,'String','Click Reset to set to Initial
Position!','ForegroundColor',[0 0 0]);
drawnow;
- 26 -
d = [S(1); S(2); S(3)];
axes(handles.Main_axes);
PRR3_Manipulator_Display_Plot(P11,P12,P13,d,b,t,a,Pe,[Wx(i)
Wy(j)],get(handles.display_names_checkbox,'Value'));
plot(Wx(i),Wy(j),'+','Markersize',10);
text(Wx(i),Wy(j),['(' num2str(Wx(i)) ',' num2str(Wy(j)) ')']);
pause(0.001)
end
end
if(flag == 1)
n = n+1;
Ws(n,1)=Wx(i);
Ws(n,2)=Wy(j);
end
end
end
axes(handles.Main_axes);
if(~isempty(Ws))
plot(Ws(:,1),Ws(:,2),'*','Markersize',10);
end
patch([Wx(1) Wx(length(Wx)) Wx(length(Wx)) Wx(1)],[Wy(1) Wy(1) Wy(length(Wy))
Wy(length(Wy))],[0 0 0],'FaceAlpha',0,'LineWidth',2);
text(-1,17.5,['Dextrous Workspace for given
configuration'],'FontWeight','bold','FontSize',14);
set(handles.status_text,'String','Done!','ForegroundColor',[0 0 0]);
set(handles.status_text,'String','Click Reset to set to Initial
Position!','ForegroundColor',[0 0 0]);
drawnow;
- 27 -
flag = 1;
for i=1:1:length(Wx)
for j=1:1:length(Wy)
Pe = [Wx(i) Wy(j) Phie];
x0 = [d' t];
S = PRR3_InversePosKin(P11,P12,P13,Pe,b,a,d3);
if(isempty(S))
else
n = n+1;
Ws(n,1)=Wx(i);
Ws(n,2)=Wy(j);
t = [S(4) S(5) S(6)];
d = [S(1); S(2); S(3)];
PRR3_Manipulator_Display_Plot(P11,P12,P13,d,b,t,a,Pe,[Wx(i)
Wy(j)],get(handles.display_names_checkbox,'Value'));
plot(Wx(i),Wy(j),'+','Markersize',10);
text(Wx(i),Wy(j),['(' num2str(Wx(i)) ',' num2str(Wy(j)) ')']);
pause(0.001)
end
end
end
axes(handles.Main_axes);
plot(Ws(:,1),Ws(:,2),'*','Markersize',10);
patch([Wx(1) Wx(length(Wx)) Wx(length(Wx)) Wx(1)],[Wy(1) Wy(1) Wy(length(Wy))
Wy(length(Wy))],[0 0 0],'FaceAlpha',0,'LineWidth',2);
text(-1,17.5,['Constant Orientation Workspace for \0e='
num2str(Pe(3)*180/pi,'%3.2g')],'FontWeight','bold','FontSize',14);
set(handles.status_text,'String','Done!','ForegroundColor',[0 0 0]);
set(handles.status_text,'String','Click Reset to set to Initial
Position!','ForegroundColor',[0 0 0]);
drawnow;
- 28 -
for ye = Y
Pe = [xe ye get(handles.phie_slider,'Value')];
S = PRR3_InversePosKin(P11,P12,P13,Pe,b,a,d3);
if(isempty(S))
M(j,i)=0;
else
A = [1 0 -a(2,1)*sin(Pe(3)+d3(1));
1 0 -a(2,2)*sin(Pe(3)+d3(2));
1 0 -a(2,3)*sin(Pe(3)+d3(3));
0 1 a(2,1)*cos(Pe(3)+d3(1));
0 1 a(2,2)*cos(Pe(3)+d3(2));
0 1 a(2,3)*cos(Pe(3)+d3(3))];
B = [cos(b(1)) 0 0 -a(1,1)*sin(S(4)) 0
0;
0 cos(b(2)) 0 0 -a(1,2)*sin(S(5))
0;
0 0 cos(b(3)) 0 0 -
a(1,3)*sin(S(6));
sin(b(1)) 0 0 a(1,1)*cos(S(4)) 0
0;
0 sin(b(2)) 0 0 a(1,2)*cos(S(5))
0;
0 0 sin(b(3)) 0 0
a(1,3)*cos(S(6))];
J = pinv(A)*B;
M(j,i) = sqrt(det(J*J'));
end
j=j+1;
end
i=i+1;
end
axes(handles.Main_axes);
set(handles.Main_axes,'FontSize',10);
hold on;
surf(X,Y,M);
colormap bone
text(-2,17.5,['Condition Number Manipulability Plot at \0e='
num2str(Pe(3)*180/pi,'%3.2g')],'FontWeight','bold','FontSize',14,'Color',[1 1 1]);
text(-1,17.5,['Yoshikawa''s Manipulability Plot at \0e='
num2str(Pe(3)*180/pi,'%3.2g')],'FontWeight','bold','FontSize',14);
figure
hold on;
surf(X,Y,M);
colormap hsv
xlabel('Xe');
ylabel('Ye');
zlabel('Yoshikawa''s Manipulability');
view(3);
grid on;
set(handles.status_text,'String','Done!','ForegroundColor',[0 0 0]);
drawnow;
- 29 -
set(handles.status_text,'String','Evaluating Please Wait!','ForegroundColor',[0 0
0]);
drawnow;
P11 = [0;0];
P12 = [15;0];
P13 = [15/2;15*sin(pi/3)];
b = [get(handles.b1_slider,'Value'); get(handles.b2_slider,'Value');
get(handles.b3_slider,'Value')];
a = [get(handles.a11_slider,'Value') get(handles.a12_slider,'Value')
get(handles.a13_slider,'Value');get(handles.a21_slider,'Value')
get(handles.a22_slider,'Value') get(handles.a23_slider,'Value')];
d3 = [210; 330; 90]*pi/180;
M = [];
i=1;
j=1;
x0 = [0 0 0 0 0 0];
X =
str2num(get(handles.xmin_limit_edit,'String')):0.25:str2num(get(handles.xmax_limit_
edit,'String'));
Y =
str2num(get(handles.ymin_limit_edit,'String')):0.25:str2num(get(handles.ymax_limit_
edit,'String'));
for xe = X
j = 1;
for ye = Y
Pe = [xe ye get(handles.phie_slider,'Value')];
S = PRR3_InversePosKin(P11,P12,P13,Pe,b,a,d3);
if(isempty(S))
M(j,i)=0;
else
A = [1 0 -a(2,1)*sin(Pe(3)+d3(1));
1 0 -a(2,2)*sin(Pe(3)+d3(2));
1 0 -a(2,3)*sin(Pe(3)+d3(3));
0 1 a(2,1)*cos(Pe(3)+d3(1));
0 1 a(2,2)*cos(Pe(3)+d3(2));
0 1 a(2,3)*cos(Pe(3)+d3(3))];
B = [cos(b(1)) 0 0 -a(1,1)*sin(S(4)) 0
0;
0 cos(b(2)) 0 0 -a(1,2)*sin(S(5))
0;
0 0 cos(b(3)) 0 0 -
a(1,3)*sin(S(6));
sin(b(1)) 0 0 a(1,1)*cos(S(4)) 0
0;
0 sin(b(2)) 0 0 a(1,2)*cos(S(5))
0;
0 0 sin(b(3)) 0 0
a(1,3)*cos(S(6))];
Jinv = pinv(B)*(A);
M(j,i) = sqrt(rcond(Jinv'*Jinv));
end
j=j+1;
end
i=i+1;
end
axes(handles.Main_axes);
set(handles.Main_axes,'FontSize',10);
hold on;
surf(X,Y,M);
- 30 -
colormap bone
text(-1,17.5,['Yoshikawa''s Manipulability Plot at \0e='
num2str(Pe(3)*180/pi,'%3.2g')],'FontWeight','bold','FontSize',14,'Color',[1 1 1]);
text(-2,17.5,['Condition Number Manipulability Plot at \0e='
num2str(Pe(3)*180/pi,'%3.2g')],'FontWeight','bold','FontSize',14);
figure
hold on;
surf(X,Y,M);
xlabel('Xe');
ylabel('Ye');
zlabel('1/k');
colormap hsv
view(3);
grid on;
set(handles.status_text,'String','Done!','ForegroundColor',[0 0 0]);
- 31 -
P13 = [15/2;15*sin(pi/3)];
d = [y(1) y(2) y(3)];
b = [get(MainGUIdata.b1_slider,'Value'); get(MainGUIdata.b2_slider,'Value');
get(MainGUIdata.b3_slider,'Value')];
a = [get(MainGUIdata.a11_slider,'Value') get(MainGUIdata.a12_slider,'Value')
get(MainGUIdata.a13_slider,'Value');get(MainGUIdata.a21_slider,'Value')
get(MainGUIdata.a22_slider,'Value') get(MainGUIdata.a23_slider,'Value')];
d3 = [210; 330; 90]*pi/180;
switch(ft)
case 1
cx = 15/2;
cy = 15*sin(pi/3)/3;
cr = 1;
if(get(MainGUIdata.phiedot_desired_slider,'Value')~=0)
Xd = [cx+cr*cos(time) cy+cr*sin(time)
get(MainGUIdata.phiedot_desired_slider,'Value')*time];
else
Xd = [cx+cr*cos(time) cy+cr*sin(time)
get(MainGUIdata.phie_desired_slider,'Value')];
end
Xdot = [-cr*sin(time) cr*cos(time)
get(MainGUIdata.phiedot_desired_slider,'Value')]';
case 2
ex = 15/2;
ey = 15*sin(pi/3)/3;
ea = 1;
eb = 0.5;
if(get(MainGUIdata.phiedot_desired_slider,'Value')~=0)
Xd = [ex+ea*cos(time) ey+eb*sin(time)
get(MainGUIdata.phiedot_desired_slider,'Value')*time];
else
Xd = [ex+ea*cos(time) ey+eb*sin(time)
get(MainGUIdata.phie_desired_slider,'Value')];
end
Xdot = [-ea*sin(time) eb*cos(time)
get(MainGUIdata.phiedot_desired_slider,'Value')]';
end
set(MainGUIdata.xe_slider,'Value',Pe(1));
set(MainGUIdata.ye_slider,'Value',Pe(2));
set(MainGUIdata.phie_slider,'Value',Pe(3));
set(MainGUIdata.xe_disp,'String',num2str(Pe(1)));
set(MainGUIdata.ye_disp,'String',num2str(Pe(2)));
set(MainGUIdata.phie_disp,'String',num2str(Pe(3)*180/pi));
set(MainGUIdata.d1_slider,'Value',y(1));
set(MainGUIdata.d2_slider,'Value',y(2));
set(MainGUIdata.d3_slider,'Value',y(3));
set(MainGUIdata.d1_disp,'String',num2str(y(1)));
set(MainGUIdata.d2_disp,'String',num2str(y(2)));
set(MainGUIdata.d3_disp,'String',num2str(y(3)));
switch(ct)
case 1
x0 = [Pe t];
S = PRR3_ForwardPosKin(x0,P11,P12,P13,d,b,a,d3,10);
if(isempty(S))
dy = dypre;
return
end
t = [S(4) S(5) S(6)];
Pe = [S(1) S(2) S(3)];
- 32 -
case 2
Ped = Xd;
x0 = [d t];
S = PRR3_InversePosKin(P11,P12,P13,Ped,b,a,d3);
if(isempty(S))
dy = 0*ones(1,6);
return
end
Td = [S(1:6)];
x0 = [Pe t];
S = PRR3_ForwardPosKin(x0,P11,P12,P13,d,b,a,d3,10);
if(isempty(S))
dy = 0*ones(1,6);
return
end
t = [S(4) S(5) S(6)];
Pe = [S(1) S(2) S(3)];
case 3
x0 = [Pe t];
S = PRR3_ForwardPosKin(x0,P11,P12,P13,d,b,a,d3,10);
if(isempty(S))
dy = 0*ones(1,6);
return
end
t = [S(4) S(5) S(6)];
Pe = [S(1) S(2) S(3)];
end
A = [1 0 -a(2,1)*sin(Pe(3)+d3(1));
1 0 -a(2,2)*sin(Pe(3)+d3(2));
1 0 -a(2,3)*sin(Pe(3)+d3(3));
0 1 a(2,1)*cos(Pe(3)+d3(1));
0 1 a(2,2)*cos(Pe(3)+d3(2));
0 1 a(2,3)*cos(Pe(3)+d3(3))];
B = [cos(b(1)) 0 0 -a(1,1)*sin(y(4)) 0 0;
0 cos(b(2)) 0 0 -a(1,2)*sin(y(5)) 0;
0 0 cos(b(3)) 0 0 -
a(1,3)*sin(y(6));
sin(b(1)) 0 0 a(1,1)*cos(y(4)) 0 0;
0 sin(b(2)) 0 0 a(1,2)*cos(y(5)) 0;
0 0 sin(b(3)) 0 0
a(1,3)*cos(y(6))];
Jinv = inv(B)*A;
switch(ct)
case 1 %'OpenLoop'
dy = Jinv*Xdot;
case 2 %'JointSpaceClosedLoop'
dy = Jinv*Xdot+K_jsc*(Td'-[y(1:6)]);
case 3 %TaskSpaceClosedLoop
dy = Jinv*(Xdot+K_tsc*(Xd'-Pe'));
end
axes(MainGUIdata.Main_axes);
X = [X Pe(1)];
Y = [Y Pe(2)];
set(MainGUIdata.status_text,'String','Tracing','ForegroundColor',[0 0 0]);
PRR3_Manipulator_Display_Plot(P11,P12,P13,d,b,t,a,Pe,[X
Y],get(MainGUIdata.display_names_checkbox,'Value'));
switch(ft)
case 1
plot(cx+cr*cos(0:0.01:st),cy+cr*sin(0:0.01:st),'-b','LineWidth',2);
- 33 -
case 2
plot(ex+ea*cos(0:0.01:st),ey+eb*sin(0:0.01:st),'-b','LineWidth',2);
end
plot(X,Y,'-r','LineWidth',2);
text(-1,-4,['Simulation Time: '
num2str(time,'%3.2g')],'FontWeight','bold','FontSize',12);
pause(0.01);
drawnow;
dypre = dy;
Pepre = Pe;
set(handles.trace_simulation_time_edit,'String',num2str(get(handles.simulation_time
_slider,'Value')));
end
- 36 -
set(handles.phie_desired_edit,'String',num2str(get(handles.phie_desired_slider,'Val
ue')*180/pi,'%3.2g'));
set(handles.phiedot_desired_slider,'Value',0);
set(handles.phiedot_desired_edit,'String',num2str(get(handles.phiedot_desired_slide
r,'Value')*180/pi,'%3.2g'));
% pause;
set(handles.phie_desired_edit,'String',num2str(get(handles.phie_desired_slider,'Val
ue')*180/pi,'%3.2g'));
end
- 37 -
set(handles.phiedot_desired_slider,'Value',str2num(get(handles.phiedot_desired_edit
,'String'))*pi/180);
set(handles.phie_desired_slider,'Value',0);
set(handles.phie_desired_edit,'String',num2str(get(handles.phie_desired_slider,'Val
ue')*180/pi,'%3.2g'));
else
set(handles.phiedot_desired_edit,'String',num2str(get(handles.phiedot_desired_slide
r,'Value')*180/pi,'%3.2g'));
end
- 39 -
% --- Executes on button press in maximal_radio.
function maximal_radio_Callback(hObject, eventdata, handles)
set(handles.maximal_radio,'Value',1);
set(handles.dextrous_radio,'Value',0);
set(handles.const_orientation_radio,'Value',0);
set(handles.xmin_limit_edit,'String','0');
set(handles.xmax_limit_edit,'String','15');
set(handles.ymin_limit_edit,'String','0');
set(handles.ymax_limit_edit,'String','15');
- 40 -