3PRR Planar Parallel Manipulator Analysis
Click here to load reader
-
Upload
mail2priyanshu8428 -
Category
Documents
-
view
1.892 -
download
8
description
Transcript of 3PRR Planar Parallel Manipulator Analysis
KINEMATIC MODELING AND ANALYSIS OF
3-PRR PARALLEL MANIPULATOR USING MATLAB GUI
By
PRIYANSHU AGARWAL KUMAR VISHWAJEET
DECEMBER 2009
Department of Mechanical and Aerospace Engineering
State University of New York at Buffalo
Buffalo, New York 14260
i
Abstract
The analysis of 3-PRR manipulators is carried out. Forward and Inverse
pose kinematics of the manipulator is derived. The Jacobian matrix relating
the task space velocity to the join-space velocity is then symbolically
evaluated. Various algorithms are devised for implementation of
manipulability calculation, workspace evaluation and path tracking of the
manipulator. A study of the manipulability is carried out using Yoshikawa’s
Manipulability index and Condition number index. Workspace analysis is
carried out for maximal, dexterous and constant orientation type workspace.
Different types of control (open and closed loop) are implemented and
analyzed. The system is developed in the form of a MATLAB GUI.
ii
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
iii
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
1
Chapter 1
Introduction 1.1 Problem Formulation
Figure 1-1 Different configurations of the 3-PRR parallel manipulator
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.2 Challenges Involved The following are the challenges involved in solving the aforementioned problem: 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.
2
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 3 deals with kinematic modeling of the manipulator. Chapter 4 provides algorithms used for implementing the GUI. Chapter 5 presents the results obtained from the manipulability, workspace and path tracking analysis. Chapter 6 closes the report with a discussion. Appendix A contains the MATLAB code for the programs and GUI used for the analysis of 3-PRR Planar Parallel manipulator.
3
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
2.2 Measure of Manipulability The degree of manipulability provides information about the quality of kinematic structure in executing tasks described by the manipulation variable. [3] The following measures of manipulability (indices) are considered in this study: 1. Yoshikawa’s Index A scalar value w given by the following equation is called the measure of manipulability at state θ with respect to manipulation variable X.
Tw JJ=
2. Manipulability index and condition number The condition number index is often used for parallel robots. Consider the linear system:
AX = B for a norm we have
From which we get
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.
4
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.
Figure 3-1 Nomenclature used in the modeling of the 3-PRR manipulator From the above figure we have
31 31eθ ϕ δ= + 3.1.1 Forward Pose Kinematics The forward pose kinematics problem is as follows: Known: d1, d2 and d3
a13
β3
X
Y
d1 d2
P11 P12
P13
d3
δ31
a11
a12
a21
a23
a22
δ33 δ32 φe
θ11 θ12
θ13
β1
β2
(xe, ye)
P21
P31
P22 P32
P23
P33
(x1, y1) (x2, y2)
(x3, y3)
θ23
θ22
θ21
5
Unknown: θ11, θ12, θ13, xe, ye and φe Considering the point P31 to break the loop, we have
1 1 11 1131 11
1 1 11 11
cos cossin sin
d aP P
d aβ θβ θ
⎡ ⎤ ⎡ ⎤= + +⎢ ⎥ ⎢ ⎥
⎣ ⎦ ⎣ ⎦
Also, the coordinates of the point can be expressed in terms of end-effector coordinates. 21 31
3121 31
cossin
e
e
x aP
y aθθ
⎡ ⎤ ⎡ ⎤= +⎢ ⎥ ⎢ ⎥⎣ ⎦ ⎣ ⎦
Equating the above equations and substituting the value of θ31 we get,
( )1 1 1 11 11 21 31cos cos cose ex d a x aβ θ ϕ δ+ + = + +
( )1 1 1 11 11 21 31sin sin sine ey d a y aβ θ ϕ δ+ + = + + Similarly breaking the loop about points P32 and P33, we can obtain
( )2 2 2 12 12 22 32cos cos cose ex d a x aβ θ ϕ δ+ + = + +
( )2 2 2 12 12 22 32sin sin sine ey d a y aβ θ ϕ δ+ + = + +
( )3 3 3 13 13 23 33cos cos cose ex d a x aβ θ ϕ δ+ + = + +
( )3 3 3 13 13 23 33sin sin sine ey d a y aβ θ ϕ δ+ + = + + 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. 3.1.2 Inverse Pose Kinematics The inverse pose kinematics problem is as follows: Known: xe, ye and φe Unknown: θ11, θ12, θ13, d1, d2 and d3
Let the coordinates of the point P31 be (x31, y31) and that of P21 be (x21, y21), then
( )( )
31 21 31
31 21 31
cos
sin
e e
e e
x x a
y y a
ϕ δ
ϕ δ
= + +
= + +
( )( )
21 31 11 21
21 31 11 21
cos
sin
x x a
y y a
θ
θ
= +
= +
6
Now, the equation of the line passing through P11 and P21 can be expressed as
1 1 1tan ( )y y x xβ− = − 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
( ) ( )31 11 21 1 1 31 11 21 1sin tan ( cos )y a y x a xθ β θ+ − = + −
Now, using half-tan substitution for sin(θ21) and cos(θ21), and assuming 21tan2
tθ⎛ ⎞ =⎜ ⎟⎝ ⎠
, we get
2 2 231 1 11 31 1 1 11 1( )(1 ) 2 ( ) tan (1 ) tan (1 )y y t a t x x t a tβ β− + + = − + + −
Solving the above quadratic equation for t, we get
2
31 1 31 1 1 11 1
11
31 1 31 1 1 11 1
42
,( ) ( ) tan tan2( ) ( ) tan tan
B B ACtA
whereA y y x x aB aC y y x x a
β β
β β
− ± −=
= − − − +== − − − −
Now,
221 2atan2( 4 ,2 )B B AC Aθ = − ± −
2 21 21 1 21 1( ) ( )d x x y y= − + −
( )( )
21 31 1 1 111
21 31 1 1 1
cos costan
sin sine e
e e
x a x dy a y d
ϕ δ βθ
ϕ δ β+ + − −
=+ + − −
Similarly, θ12, θ13, d2 and d3 can be evaluated. Hence, the inverse pose kinematics has a closed loop solution. 3.2 Jacobian Matrix Evaluation Now, in order to calculate the Jacobian matrix, consider the equations derived for the forward pose kinematics of the system
( )1 1 1 11 11 21 31cos cos cose ex d a x aβ θ ϕ δ+ + = + +
( )1 1 1 11 11 21 31sin sin sine ey d a y aβ θ ϕ δ+ + = + +
( )2 2 2 12 12 22 32cos cos cose ex d a x aβ θ ϕ δ+ + = + +
( )2 2 2 12 12 22 32sin sin sine ey d a y aβ θ ϕ δ+ + = + +
7
( )3 3 3 13 13 23 33cos cos cose ex d a x aβ θ ϕ δ+ + = + +
( )3 3 3 13 13 23 33sin sin sine ey d a y aβ θ ϕ δ+ + = + + Differentiating the above set of equations, we have
( )( )( )( )( )( )
21 31 1 11 11
22 32 1 12 12
23 33 1 13 13
21 31 1 11 11
22 32
23 33
1 0 sin cos 0 0 sin 0 01 0 sin 0 cos 0 0 sin 01 0 sin 0 0 cos 0 0 sin0 1 cos sin 0 0 sin0 1 cos0 1 cos
e
ee
ee
ee
e
e
a aa a
xa a
ya aaa
ϕ δ β θϕ δ β θϕ δ β θϕ δ β θ
ϕϕ δϕ δ
− +⎡ ⎤ −⎢ ⎥− + −⎢ ⎥ ⎡ ⎤⎢ ⎥− + −⎢ ⎥ =⎢ ⎥ ⎢ ⎥+⎢ ⎥ ⎢ ⎥⎣ ⎦⎢ ⎥+⎢ ⎥
+⎢ ⎥⎣ ⎦
1
1
1
11
2 12 12 12
3 13 13 13
0 00 sin 0 0 sin 00 0 sin 0 0 sin
ddd
aa
θβ θ θ
β θ θ
⎡ ⎤⎡ ⎤⎢ ⎥⎢ ⎥⎢ ⎥⎢ ⎥⎢ ⎥⎢ ⎥⎢ ⎥⎢ ⎥⎢ ⎥⎢ ⎥⎢ ⎥⎢ ⎥⎢ ⎥⎢ ⎥⎢ ⎥⎣ ⎦ ⎣ ⎦
The above equation can be written in the form, AX Bθ=
1X A Bθ−⇒ = So, 1J A B−=
8
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 4.1.2 Inverse Pose Kinematics
No
Yes
Collect xe, ye, φe, a11, a12, a13, a21, a22, a23,
β1, β 2 and β 3 from the GUI
Solve using closed form solution obtained
If solution exists
Return
Return Solution doesn’t exist
Yes
If counter < limit
Collect d1, d2, d3, xe, ye, φe, a11, a12, a13, a21, a22, a23,
β1, β 2 and β 3 from the GUI
Solve using FSOLVE
If solution exists
Return
Change intial guess (x0) (increment counter)
Consider current (xe,ye,φe) as intial guess (x0)
No
9
4.1.3 Manipulator Parameters Variation 4.1.4 Yoshikawa’s/Condition Number Manipulability Index 4.1.5 Workspace Analysis
No
Yes Return Configuration not possible
If slider clicked Collect xe, ye, φe,
d1, d2, d3 a11, a12, a13, a21, a22, a23,
β1, β 2 and β 3 from the GUI
Invoke Forward Kinematics function
If solution exists
Return
No
Yes
Collect xmin, xmax, ymin, ymax, φe, a11, a12, a13, a21, a22, a23,
β1, β 2 and β 3 from the GUI
Invoke Inverse Kinematics function
If solution exists
Calculate Tw JJ=
k = rcond(J-TJ-1)
x = xmin->xmax, y = ymin->ymax
w = 0 Iterate if x<xmax
and y<ymax
Iterate if x<xmax and y<ymax
10
This section presents algorithm to evaluate different types of workspaces. 4.1.5.1 Maximal Workspace 4.1.5.2 Dextrous Workspace 4.1.5.3 Constant Orientation Workspace
No
Yes
Collect xmin, xmax, ymin, ymax, a11, a12, a13, a21, a22, a23,
β1, β 2 and β 3 from the GUI
Invoke Inverse Kinematics function
If solution exists
Store (x,y)
x = xmin->xmax, y = ymin->ymax and φe=0->360
Ignore (x,y) Iterate if x<xmax
and y<ymax
Iterate if x<xmax and y<ymax
No
Yes
Collect xmin, xmax, ymin, ymax, a11, a12, a13, a21, a22, a23,
β1, β 2 and β 3 from the GUI
Invoke Inverse Kinematics function
If solution exists for every φe
Store (x,y)
x = xmin->xmax, y = ymin->ymax and φe=0->360
Ignore (x,y) Iterate if x<xmax
and y<ymax
Iterate if x<xmax and y<ymax
11
4.1.6 Path Tracking
No
Yes
Collect xmin, xmax, ymin, ymax, φe, a11, a12, a13, a21, a22, a23,
β1, β 2 and β 3 from the GUI
Invoke Inverse Kinematics function
If solution exists for particular φe
Store (x,y)
x = xmin->xmax, y = ymin->ymax
Ignore (x,y) Iterate if x<xmax
and y<ymax
Iterate if x<xmax and y<ymax
Collect xe, ye, φe, Path Type: Circle/Ellipse
ed ed/ϕ ϕ , Simulation Time Type of Control: Open/Close (Joint/Task) (Control Gain)
a11, a12, a13, a21, a22, a23, β1, β 2 and β 3 from the GUI
Open Loop: Invoke Forward Kinematics function Closed Loop: Joint: Invoke Inverse Kinematics function (desired value) Invoke Forward Kinematics function Task: Invoke Forward Kinematics function
If solution exists
Invoke Ode45
Iterate if t<Simulation
time
Calculate Xd and dX (Circle/Ellipse)
A
B
Yes
No
0dθ = Iterate if
t<Simulation time
12
4.2 Development of MATLAB program and GUI
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.
Calculate J-1
Open Loop: 1J Xθ −= Closed Loop: Joint: 1 ( )d aJ X Kθ θ θ−= + −
Task: 1 ( )d aJ X K X Xθ −= + −
A
B
13
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.
14
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.
15
Chapter 5
Results 5.1 Manipulability Analysis Figure 5-1 illustrates the manipulability plots of 3-PRR manipulator. The plots are obtained using
0
5
10
15
02
4
680
0.2
0.4
0.6
0.8
XeYe
Yos
hika
wa'
s M
anip
ulab
ility
(a)
0
5
10
15
02
4
680
0.1
0.2
0.3
0.4
XeYe
1/k
(b)
Figure 5-1 Manipulability plots of 3-PRR parallel planar manipulator. a) Yoshikawa’s manipulability plot, b) Condition number manipulability plot Yoshikawa’s manipulability index and condition number index. 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
16
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”
17
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)
Figure 5-3Workspace of the manipulator. a) Maximal workspace, b) Dexterous workspace and c) Constant Orientation workspace
rotating for 360 degrees. However, the developed GUI is able to find it only when high resolution is used for the analysis. The constant orientation workspace varies with the angle of end-effector under consideration. For an angle of 19 degrees the constant orientation workspace for the manipulator is a triangle.
5.3 Path Tracking Performance Analysis
(a) (b)
(c)
18
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.
19
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.
3. Path Tracking Performance Analysis: i) Open Loop Control: Significant drift is observed from the trajectory being traced. ii) Joint Space Closed Loop Control: Works with extremely low (0.01) value of gains but poor path
tracking capability. iii) Task Space Closed Loop Control: Shows smooth tracking with low (0.3) value of gains which deteriorates as higher value is used.
20
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
- 1 -
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));
- 2 -
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); D = [d1 d2 d3 t11 t12 t13]; else D = []; End ------------------------------------------------------------------------------------------------------------ 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,:); h11 = line([P11(1) P11(1)+d(1)*cos(b(1))], [P11(2) P11(2)+d(1)*sin(b(1))],'LineWidth',10,'Color',[0 1 0]); %Displaying h12 = line([P11(1)+d(1)*cos(b(1)) P11(1)+d(1)*cos(b(1))+a(1)*cos(t(1))], [P11(2)+d(1)*sin(b(1)) P11(2)+d(1)*sin(b(1))+a(1)*sin(t(1))],'LineWidth',3,'Color',[1 0 0]); %Displaying 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
- 3 -
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],...
- 4 -
'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','FontWeight','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)*sin(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,:); h11 = line([P11(1) P11(1)+d(1)*cos(b(1))], [P11(2) P11(2)+d(1)*sin(b(1))],'LineWidth',10,'Color',[0 1 0]); %Displaying h12 = line([P11(1)+d(1)*cos(b(1)) P11(1)+d(1)*cos(b(1))+a(1)*cos(t(1))], [P11(2)+d(1)*sin(b(1)) P11(2)+d(1)*sin(b(1))+a(1)*sin(t(1))],'LineWidth',3,'Color',[1 0 0]); %Displaying
- 5 -
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);
- 6 -
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','FontWeight','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)*sin(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 ------------------------------------------------------------------------------------------------------------
- 7 -
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 % Copyright 2002-2003 The MathWorks, Inc. % Edit the above text to modify the response to help PRR3_GUI_2 % Last Modified by GUIDE v2.5 21-Dec-2009 02:34:57 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @PRR3_GUI_2_OpeningFcn, ... 'gui_OutputFcn', @PRR3_GUI_2_OutputFcn, ... 'gui_LayoutFcn', [] , ... 'gui_Callback', []); if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1}); end if nargout [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else gui_mainfcn(gui_State, varargin{:}); end % End initialization code - DO NOT EDIT % --- Executes just before PRR3_GUI_2 is made visible. function PRR3_GUI_2_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
- 8 -
% varargin command line arguments to PRR3_GUI_2 (see VARARGIN) % Choose default command line output for PRR3_GUI_2 handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes PRR3_GUI_2 wait for user response (see UIRESUME) % uiwait(handles.figure1); %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; %Setting slider values for d1, d2 and d3 slider_step(1) = 0.4/(10-(-10)); slider_step(2) = 1/(10-(-10)); set(handles.d1_slider,'sliderstep',slider_step,... 'max',10,'min',-10);%,'Value',3); 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); %Setting slider values for b1, b2 and b3 slider_step(1) = 5/(360-0); slider_step(2) = 10/(360-0); set(handles.b1_slider,'sliderstep',slider_step,... 'max',2*pi,'min',0);%,'Value',pi/6);
- 9 -
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); %Setting slider values for Tracking Simulation Time slider_step(1) = 0.5/20; slider_step(2) = 1/20; set(handles.simulation_time_slider,'sliderstep',slider_step,... 'max',20,'min',0); %Setting slider values for Control Gain slider_step(1) = 0.01/1; slider_step(2) = 0.1/1; set(handles.gain_slider,'sliderstep',slider_step,... 'max',1,'min',0); %Setting slider values for Phie desired slider_step(1) = 0.01/0.4; slider_step(2) = 0.1/0.4; set(handles.phie_desired_slider,'sliderstep',slider_step,... 'max',0.2,'min',-0.2); set(handles.phiedot_desired_slider,'sliderstep',slider_step,... 'max',0.2,'min',-0.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')];
- 10 -
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')); %Setting slider values for Xe, Ye slider_step(1) = 0.4/(10-(-10)); slider_step(2) = 1/(10-(-10)); set(handles.xe_slider,'sliderstep',slider_step,... 'max',10,'min',-10,'Value',Pe(1)); set(handles.ye_slider,'sliderstep',slider_step,... 'max',10,'min',-10,'Value',Pe(2)); %Setting slider values for Phie slider_step(1) = 5/(180-(-180)); slider_step(2) = 10/(180-(-180)); 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.
- 11 -
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) % Get default command line output from handles structure varargout{1} = handles.output; % --- Executes on slider movement. function d1_slider_Callback(hObject, eventdata, handles) set(handles.d1_disp,'String',num2str(get(handles.d1_slider,'Value'))); set(handles.status_text,'String','Evaluating Please Wait!','ForegroundColor',[0 0 0]); drawnow; 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)); % --- Executes during object creation, after setting all properties. function d1_slider_CreateFcn(hObject, eventdata, handles) if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]);
- 12 -
end % --- Executes on slider movement. function d2_slider_Callback(hObject, eventdata, handles) set(handles.d2_disp,'String',num2str(get(handles.d2_slider,'Value'))); set(handles.status_text,'String','Evaluating Please Wait!','ForegroundColor',[0 0 0]); drawnow; 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!(d2 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)); % --- Executes during object creation, after setting all properties. function d2_slider_CreateFcn(hObject, eventdata, handles) if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end % --- Executes on slider movement. function d3_slider_Callback(hObject, eventdata, handles) set(handles.d3_disp,'String',num2str(get(handles.d3_slider,'Value'))); set(handles.status_text,'String','Evaluating Please Wait!','ForegroundColor',[0 0 0]); drawnow;
- 13 -
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!(d3 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)); % --- Executes during object creation, after setting all properties. function d3_slider_CreateFcn(hObject, eventdata, handles) if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end % --- Executes on slider movement. function xe_slider_Callback(hObject, eventdata, handles) set(handles.xe_disp,'String',num2str(get(handles.xe_slider,'Value'))); set(handles.status_text,'String','Evaluating Please Wait!','ForegroundColor',[0 0 0]); drawnow; 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')];
- 14 -
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))); % --- Executes during object creation, after setting all properties. function xe_slider_CreateFcn(hObject, eventdata, handles) if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end % --- Executes on slider movement. function ye_slider_Callback(hObject, eventdata, handles) set(handles.ye_disp,'String',num2str(get(handles.ye_slider,'Value'))); set(handles.status_text,'String','Evaluating Please Wait!','ForegroundColor',[0 0 0]); drawnow; 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;
- 15 -
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))); % --- Executes during object creation, after setting all properties. function ye_slider_CreateFcn(hObject, eventdata, handles) if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end % --- Executes on slider movement. function phie_slider_Callback(hObject, eventdata, handles) set(handles.phie_disp,'String',num2str(get(handles.phie_slider,'Value')*180/pi)); set(handles.status_text,'String','Evaluating Please Wait!','ForegroundColor',[0 0 0]); drawnow; 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 = [d' t] S = PRR3_InversePosKin(P11,P12,P13,Pe,b,a,d3) if(isempty(S)) set(handles.status_text,'String','Configuration Not Possible!(Phie limit exceeded)','ForegroundColor',[1 0 0]); drawnow;
- 16 -
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))); % --- Executes during object creation, after setting all properties. function phie_slider_CreateFcn(hObject, eventdata, handles) if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end % --- Executes on slider movement. function a11_slider_Callback(hObject, eventdata, handles) set(handles.a11_disp,'String',num2str(get(handles.a11_slider,'Value'))); set(handles.status_text,'String','Evaluating Please Wait!','ForegroundColor',[0 0 0]); drawnow; 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!(a11 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]);
- 17 -
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)); % --- Executes during object creation, after setting all properties. function a11_slider_CreateFcn(hObject, eventdata, handles) if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end % --- Executes on slider movement. function a12_slider_Callback(hObject, eventdata, handles) set(handles.a12_disp,'String',num2str(get(handles.a12_slider,'Value'))); set(handles.status_text,'String','Evaluating Please Wait!','ForegroundColor',[0 0 0]); drawnow; 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!(a12 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));
- 18 -
% --- 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 % --- Executes on slider movement. function a13_slider_Callback(hObject, eventdata, handles) set(handles.a13_disp,'String',num2str(get(handles.a13_slider,'Value'))); set(handles.status_text,'String','Evaluating Please Wait!','ForegroundColor',[0 0 0]); drawnow; 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!(a13 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)); % --- Executes during object creation, after setting all properties. function a13_slider_CreateFcn(hObject, eventdata, handles) if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end % --- Executes during object creation, after setting all properties.
- 19 -
function a21_slider_CreateFcn(hObject, eventdata, handles) if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end % --- Executes on slider movement. function a22_slider_Callback(hObject, eventdata, handles) set(handles.a22_disp,'String',num2str(get(handles.a22_slider,'Value'))); set(handles.status_text,'String','Evaluating Please Wait!','ForegroundColor',[0 0 0]); drawnow; 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!(a22 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)); % --- Executes during object creation, after setting all properties. function a22_slider_CreateFcn(hObject, eventdata, handles) if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end % --- Executes on slider movement. function a23_slider_Callback(hObject, eventdata, handles)
- 20 -
set(handles.a23_disp,'String',num2str(get(handles.a23_slider,'Value'))); set(handles.status_text,'String','Evaluating Please Wait!','ForegroundColor',[0 0 0]); drawnow; 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!(a23 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)); % --- Executes during object creation, after setting all properties. function a23_slider_CreateFcn(hObject, eventdata, handles) if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end % --- Executes on slider movement. function a21_slider_Callback(hObject, eventdata, handles) set(handles.a21_disp,'String',num2str(get(handles.a21_slider,'Value'))); set(handles.status_text,'String','Evaluating Please Wait!','ForegroundColor',[0 0 0]); drawnow; global Pe t P11 = [0;0]; P12 = [15;0]; P13 = [15/2;15*sin(pi/3)];
- 21 -
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)); % --- Executes on slider movement. function b1_slider_Callback(hObject, eventdata, handles) set(handles.b1_disp,'String',num2str(get(handles.b1_slider,'Value')*180/pi)); set(handles.status_text,'String','Evaluating Please Wait!','ForegroundColor',[0 0 0]); drawnow; 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!(b1 limit exceeded)','ForegroundColor',[1 0 0]);
- 22 -
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)); % --- Executes during object creation, after setting all properties. function b1_slider_CreateFcn(hObject, eventdata, handles) if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end % --- Executes on slider movement. function b2_slider_Callback(hObject, eventdata, handles) set(handles.b2_disp,'String',num2str(get(handles.b2_slider,'Value')*180/pi)); set(handles.status_text,'String','Evaluating Please Wait!','ForegroundColor',[0 0 0]); drawnow; 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; 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!(b2 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]);
- 23 -
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)); % --- Executes during object creation, after setting all properties. function b2_slider_CreateFcn(hObject, eventdata, handles) if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end % --- Executes on slider movement. function b3_slider_Callback(hObject, eventdata, handles) set(handles.b3_disp,'String',num2str(get(handles.b3_slider,'Value')*180/pi)); set(handles.status_text,'String','Evaluating Please Wait!','ForegroundColor',[0 0 0]); drawnow; 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!(b3 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));
- 24 -
% --- 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 % --- Executes on button press in reset_button. function reset_button_Callback(hObject, eventdata, handles) set(handles.d1_slider,'Value',3); set(handles.d2_slider,'Value',3); set(handles.d3_slider,'Value',3); set(handles.a11_slider,'Value',3); set(handles.a12_slider,'Value',3); set(handles.a13_slider,'Value',3); set(handles.a21_slider,'Value',3); set(handles.a22_slider,'Value',3); set(handles.a23_slider,'Value',3); set(handles.b1_slider,'Value',pi/6); set(handles.b2_slider,'Value',2*pi/3+pi/6); set(handles.b3_slider,'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'))); 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; Pe = [15/2 15/3*sin(pi/3) -0.3316]; % 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)Restart GUI','ForegroundColor',[1 0 0]); 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
- 25 -
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)); % --- Executes on button press in max_workspace_button. function max_workspace_button_Callback(hObject, eventdata, handles) % Wx = 0:0.5:15; % Wy = 0:0.5:15; Wx = str2num(get(handles.xmin_limit_edit,'String')):0.5:str2num(get(handles.xmax_limit_edit,'String')); Wy = str2num(get(handles.ymin_limit_edit,'String')):0.5:str2num(get(handles.ymax_limit_edit,'String')); Phie = [0:5:360]*pi/180; Ws = []; n = 0; set(handles.status_text,'String','Evaluating Please Wait!','ForegroundColor',[0 0 0]); drawnow; 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; flag = 0; for i=1:1:length(Wx) for j=1:1:length(Wy) for k=1:1:length(Phie) Pe = [Wx(i) Wy(j) Phie(k)]; x0 = [d' t]; S = PRR3_InversePosKin(P11,P12,P13,Pe,b,a,d3); if(isempty(S)) else n = n+1; flag = 1; Ws(n,1)=Wx(i); Ws(n,2)=Wy(j);
- 26 -
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; % --- Executes on button press in dex_workspace_button. function dex_workspace_button_Callback(hObject, eventdata, handles) % Wx = 7:0.1:8; % Wy = 4:0.1:5; Wx = str2num(get(handles.xmin_limit_edit,'String')):0.1:str2num(get(handles.xmax_limit_edit,'String')); Wy = str2num(get(handles.ymin_limit_edit,'String')):0.1:str2num(get(handles.ymax_limit_edit,'String')); Phie = [0:5:360]*pi/180; Ws = []; n = 0; set(handles.status_text,'String','Evaluating Please Wait!','ForegroundColor',[0 0 0]); drawnow; 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; flag = 1; for i=1:1:length(Wx) for j=1:1:length(Wy) for k=1:1:length(Phie) Pe = [Wx(i) Wy(j) Phie(k)]; x0 = [d' t]; S = PRR3_InversePosKin(P11,P12,P13,Pe,b,a,d3); if(isempty(S)) flag = 0; break; else t = [S(4) S(5) S(6)];
- 27 -
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; % --- Executes on button press in c_orient_workspace_button. function c_orient_workspace_button_Callback(hObject, eventdata, handles) % Wx = 0:0.5:15; % Wy = 0:0.5:5; Wx = str2num(get(handles.xmin_limit_edit,'String')):0.5:str2num(get(handles.xmax_limit_edit,'String')); Wy = str2num(get(handles.ymin_limit_edit,'String')):0.5:str2num(get(handles.ymax_limit_edit,'String')); Phie = get(handles.phie_slider,'Value'); Ws = []; n = 0; set(handles.status_text,'String','Evaluating Please Wait!','ForegroundColor',[0 0 0]); drawnow; 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;
- 28 -
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; % --- Executes on button press in pushbutton6. function yoshi_manipulability_button_Callback(hObject, eventdata, handles) 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;
- 29 -
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; % --- Executes on button press in yoshi_manipulability_button. function yoshi_manipulability_button_Callback(hObject, eventdata, handles) % --- Executes on button press in cond_manipulability_button. function cond_manipulability_button_Callback(hObject, eventdata, handles)
- 30 -
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);
- 31 -
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]); % --- Executes on button press in trace_button. function trace_button_Callback(hObject, eventdata, handles) global Pe t X Y MainGUIdata; MainGUIdata = guidata(PRR3_GUI_2); axes(handles.Main_axes); if(get(handles.grid_checkbox,'Value')==1) grid off grid minor else grid off end X = []; Y = []; d = [get(handles.d1_slider,'Value'); get(handles.d2_slider,'Value'); get(handles.d3_slider,'Value')]; t0 = [d' t]; st = get(handles.simulation_time_slider,'Value'); if(get(handles.circle_radio,'Value')==1) % Choosing figure to be traced ft = 1; elseif(get(handles.ellipse_radio,'Value')==1) ft = 2; end if(get(handles.open_loop_radio,'Value')==1) % Choosing control type ct = 1; elseif(get(handles.joint_space_radio,'Value')==1) ct = 2; elseif(get(handles.task_space_radio,'Value')==1) ct = 3; end [tdot,time] = ode45(@Control,[0,st],t0,[],ft,ct,st); set(handles.status_text,'String','Click Reset to set to Initial Position!','ForegroundColor',[0 0 0]); function dy = Control(time,y, ft,ct,st) global Pe t X Y dypre MainGUIdata set(MainGUIdata.status_text,'String','Evaluating Please Wait!','ForegroundColor',[0 0 0]); drawnow; K_tsc = get(MainGUIdata.gain_slider,'Value'); K_jsc = get(MainGUIdata.gain_slider,'Value'); P11 = [0;0]; P12 = [15;0];
- 32 -
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)];
- 33 -
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);
- 34 -
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; % --- Executes on button press in clear_button. function clear_button_Callback(hObject, eventdata, handles) 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; Pe = [get(handles.xe_slider,'Value') get(handles.ye_slider,'Value') get(handles.phie_slider,'Value')]; x0 = [Pe t]; axes(handles.Main_axes); PRR3_Manipulator_Display(P11,P12,P13,d,b,t,a,Pe,get(handles.display_names_checkbox,'Value')); % --- Executes on button press in open_loop_radio. function open_loop_radio_Callback(hObject, eventdata, handles) set(handles.open_loop_radio,'Value',1); set(handles.joint_space_radio,'Value',0); set(handles.task_space_radio,'Value',0); PRR3_GUI_2_OpeningFcn(hObject, eventdata, handles) axes(handles.Main_axes); if(get(handles.grid_checkbox,'Value')==1) grid off grid minor else grid off end set(handles.status_text,'String','Open Loop Control Selected','ForegroundColor',[0 0 0]); % --- Executes on button press in joint_space_radio. function joint_space_radio_Callback(hObject, eventdata, handles) set(handles.open_loop_radio,'Value',0); set(handles.joint_space_radio,'Value',1); set(handles.task_space_radio,'Value',0); set(handles.gain_slider,'Value',0.01); set(handles.gain_edit,'String',num2str(get(handles.gain_slider,'Value'))); PRR3_GUI_2_OpeningFcn(hObject, eventdata, handles) axes(handles.Main_axes); if(get(handles.grid_checkbox,'Value')==1)
- 35 -
grid off grid minor else grid off end set(handles.status_text,'String','Joint Space Closed Loop Control Selected','ForegroundColor',[0 0 0]); % --- Executes on button press in task_space_radio. function task_space_radio_Callback(hObject, eventdata, handles) set(handles.open_loop_radio,'Value',0); set(handles.joint_space_radio,'Value',0); set(handles.task_space_radio,'Value',1); set(handles.gain_slider,'Value',0.3); set(handles.gain_edit,'String',num2str(get(handles.gain_slider,'Value'))); PRR3_GUI_2_OpeningFcn(hObject, eventdata, handles) axes(handles.Main_axes); if(get(handles.grid_checkbox,'Value')==1) grid off grid minor else grid off end set(handles.status_text,'String','Task Space Closed Loop Control Selected','ForegroundColor',[0 0 0]); % --- Executes on button press in circle_radio. function circle_radio_Callback(hObject, eventdata, handles) set(handles.circle_radio,'Value',1); set(handles.ellipse_radio,'Value',0); PRR3_GUI_2_OpeningFcn(hObject, eventdata, handles) axes(handles.Main_axes); if(get(handles.grid_checkbox,'Value')==1) grid off grid minor else grid off end set(handles.status_text,'String','Circle to be Traced','ForegroundColor',[0 0 0]); % --- Executes on button press in ellipse_radio. function ellipse_radio_Callback(hObject, eventdata, handles) set(handles.circle_radio,'Value',0); set(handles.ellipse_radio,'Value',1); PRR3_GUI_2_OpeningFcn(hObject, eventdata, handles) axes(handles.Main_axes); if(get(handles.grid_checkbox,'Value')==1) grid off grid minor else grid off end set(handles.status_text,'String','Ellipse to be Traced','ForegroundColor',[0 0 0]); % --- Executes on slider movement. function simulation_time_slider_Callback(hObject, eventdata, handles) set(handles.trace_simulation_time_edit,'String',num2str(get(handles.simulation_time_slider,'Value')));
- 36 -
% --- Executes during object creation, after setting all properties. function simulation_time_slider_CreateFcn(hObject, eventdata, handles) if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end function trace_simulation_time_edit_Callback(hObject, eventdata, handles) if(str2num(get(handles.trace_simulation_time_edit,'String'))>=get(handles.simulation_time_slider,'Min') & str2num(get(handles.trace_simulation_time_edit,'String'))<=get(handles.simulation_time_slider,'Max')) set(handles.simulation_time_slider,'Value',str2num(get(handles.trace_simulation_time_edit,'String'))); else set(handles.trace_simulation_time_edit,'String',num2str(get(handles.simulation_time_slider,'Value'))); end % --- Executes during object creation, after setting all properties. function trace_simulation_time_edit_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on slider movement. function gain_slider_Callback(hObject, eventdata, handles) set(handles.gain_edit,'String',num2str(get(handles.gain_slider,'Value'))); % --- Executes during object creation, after setting all properties. function gain_slider_CreateFcn(hObject, eventdata, handles) if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end function gain_edit_Callback(hObject, eventdata, handles) if(str2num(get(handles.gain_edit,'String'))>=get(handles.gain_slider,'Min') & str2num(get(handles.gain_edit,'String'))<=get(handles.gain_slider,'Max')) set(handles.gain_slider,'Value',str2num(get(handles.gain_edit,'String'))); else set(handles.gain_edit,'String',num2str(get(handles.gain_slider,'Value'))); end % --- Executes during object creation, after setting all properties. function gain_edit_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on slider movement. function phie_desired_slider_Callback(hObject, eventdata, handles)
- 37 -
set(handles.phie_desired_edit,'String',num2str(get(handles.phie_desired_slider,'Value')*180/pi,'%3.2g')); set(handles.phiedot_desired_slider,'Value',0); set(handles.phiedot_desired_edit,'String',num2str(get(handles.phiedot_desired_slider,'Value')*180/pi,'%3.2g')); % pause; % --- Executes during object creation, after setting all properties. function phie_desired_slider_CreateFcn(hObject, eventdata, handles) if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end function phie_desired_edit_Callback(hObject, eventdata, handles) if(str2num(get(handles.phie_desired_edit,'String'))*pi/180>=get(handles.phie_desired_slider,'Min') & str2num(get(handles.phie_desired_edit,'String'))*pi/180<=get(handles.phie_desired_slider,'Max')) set(handles.phie_desired_slider,'Value',str2num(get(handles.phie_desired_edit,'String'))*pi/180); set(handles.phiedot_desired_slider,'Value',0); set(handles.phiedot_desired_edit,'String',num2str(get(handles.phiedot_desired_slider,'Value')*180/pi,'%3.2g')); else set(handles.phie_desired_edit,'String',num2str(get(handles.phie_desired_slider,'Value')*180/pi,'%3.2g')); end % --- Executes during object creation, after setting all properties. function phie_desired_edit_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on slider movement. function phiedot_desired_slider_Callback(hObject, eventdata, handles) set(handles.phiedot_desired_edit,'String',num2str(get(handles.phiedot_desired_slider,'Value')*180/pi,'%3.2g')); set(handles.phie_desired_slider,'Value',0); set(handles.phie_desired_edit,'String',num2str(get(handles.phie_desired_slider,'Value')*180/pi,'%3.2g')); % --- Executes during object creation, after setting all properties. function phiedot_desired_slider_CreateFcn(hObject, eventdata, handles) if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor',[.9 .9 .9]); end function phiedot_desired_edit_Callback(hObject, eventdata, handles) if(str2num(get(handles.phiedot_desired_edit,'String'))*pi/180>=get(handles.phiedot_desired_slider,'Min') & str2num(get(handles.phiedot_desired_edit,'String'))*pi/180<=get(handles.phiedot_desired_slider,'Max'))
- 38 -
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,'Value')*180/pi,'%3.2g')); else set(handles.phiedot_desired_edit,'String',num2str(get(handles.phiedot_desired_slider,'Value')*180/pi,'%3.2g')); end % --- Executes during object creation, after setting all properties. function phiedot_desired_edit_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on button press in display_names_checkbox. function display_names_checkbox_Callback(hObject, eventdata, handles) 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')]; PRR3_Manipulator_Display(P11,P12,P13,d,b,t,a,Pe,get(handles.display_names_checkbox,'Value')); function ymax_limit_edit_Callback(hObject, eventdata, handles) if(str2num(get(handles.ymax_limit_edit,'String'))>-5 & str2num(get(handles.ymax_limit_edit,'String'))<20) elseif(str2num(get(handles.ymax_limit_edit,'String'))<str2num(get(handles.ymin_limit_edit,'String'))) set(handles.ymax_limit_edit,'String','20'); else set(handles.ymax_limit_edit,'String','20'); end % --- Executes during object creation, after setting all properties. function ymax_limit_edit_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function ymin_limit_edit_Callback(hObject, eventdata, handles) if(str2num(get(handles.ymin_limit_edit,'String'))>-5 & str2num(get(handles.ymin_limit_edit,'String'))<20)
- 39 -
elseif(str2num(get(handles.ymin_limit_edit,'String'))>str2num(get(handles.ymax_limit_edit,'String'))) set(handles.ymin_limit_edit,'String','-5'); else set(handles.ymin_limit_edit,'String','-5'); end % --- Executes during object creation, after setting all properties. function ymin_limit_edit_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function xmin_limit_edit_Callback(hObject, eventdata, handles) if(str2num(get(handles.xmin_limit_edit,'String'))>-5 & str2num(get(handles.xmin_limit_edit,'String'))<20) elseif(str2num(get(handles.xmin_limit_edit,'String'))>str2num(get(handles.xmax_limit_edit,'String'))) set(handles.xmin_limit_edit,'String','-5'); else set(handles.xmin_limit_edit,'String','-5'); end % --- Executes during object creation, after setting all properties. function xmin_limit_edit_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end function xmax_limit_edit_Callback(hObject, eventdata, handles) if(str2num(get(handles.xmax_limit_edit,'String'))>-5 & str2num(get(handles.xmax_limit_edit,'String'))<20) elseif(str2num(get(handles.xmax_limit_edit,'String'))<str2num(get(handles.xmin_limit_edit,'String'))) set(handles.xmax_limit_edit,'String','20'); else set(handles.xmax_limit_edit,'String','20'); end % --- Executes during object creation, after setting all properties. function xmax_limit_edit_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end % --- Executes on button press in display_scale_checkbox. function display_scale_checkbox_Callback(hObject, eventdata, handles) 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
- 40 -
% --- 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'); % --- Executes on button press in dextrous_radio. function dextrous_radio_Callback(hObject, eventdata, handles) set(handles.maximal_radio,'Value',0); set(handles.dextrous_radio,'Value',1); set(handles.const_orientation_radio,'Value',0); set(handles.xmin_limit_edit,'String','7'); set(handles.xmax_limit_edit,'String','8'); set(handles.ymin_limit_edit,'String','4'); set(handles.ymax_limit_edit,'String','5'); % --- Executes on button press in const_orientation_radio. function const_orientation_radio_Callback(hObject, eventdata, handles) set(handles.maximal_radio,'Value',0); set(handles.dextrous_radio,'Value',0); set(handles.const_orientation_radio,'Value',1); 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','5'); % --- Executes on button press in grid_checkbox. function grid_checkbox_Callback(hObject, eventdata, handles) if(get(handles.grid_checkbox,'Value')==1) grid off grid minor else grid off end