Determine the workspace for 2DOF parallel arms
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
For the below code I have the following questions
- I want to determine the allowed worspace for both 2DOF arm. Both arm links are 1 m. base of the first arm (R1) is set in x-axis to -0.5 and the second arm (R2) is set to 0.5. distance of bases should be 1m. The end effector final pos shoul be between -0.5 to 0.5 in x-axis and 0.5 to 1.8 in y axis.Final pos coordinates are variable inputs.
- If my workarea exceeds the limits that I set can print a message and call the same program (my program name is New_2R)
fprintf ('Position coords exceed robot working area .Insert new coordinates')
pause (3)
New_2R
3. How can I extract the angles from the Ikine block ?
% Two Link Robotic Arm R1
% DH (Denavit–Hartenberg) Table
% theta d a alpha R/P offset
L1(1) = Link([0 0 1 0 0 0]);
L1(2) = Link([0 0 1 0 0 0]);
% Build a serial robot object
R1 = SerialLink(L1(1:2), 'name', 'R1');
% Robot base coordinates (cartesian space)
R1.base=transl(-0.5,0,0);
% Two Link Robotic Arm R2
% DH (Denavit–Hartenberg) Table
% theta d a alpha R/P offset
L2(1) = Link([0 0 1 0 0 0]);
L2(2) = Link([0 0 1 0 0 0]);
% Build a serial robot object
R2 = SerialLink(L2(1:2), 'name', 'R2');
% Robot base coordinates (cartesian space)
R2.base=transl(0.5,0,0);
x= input('type x coordinate := ');
y= input('type y coordinate := ');
% fprintf ('Position coords exceed robot working area .Insert new coordinates')
% pause (3)
% hold on
view(-2,2);
xlim([-2,2]);ylim([-2,2]); zlim([-2,2]);
% Desired position for R1
p11 = transl(-1.5,0.2, 0); % define the start pose
p12 = transl(-x,y,0); % define the end pose
% calculate the trajectory from p11 to p12
T1 = ctraj(p11,p12,30);
% calculate inverse kinematics for R1
T1_Ikine = R1.ikine(T1,'mask',[1 1 0 0 0 0]);
R1.plot(T1_Ikine)
% Desired position for R2
p21 = transl(1.5, 0.2, 0); % define the start pose
p22 = transl(x,y,0); % define the end pose
% calculate the trajectory from p21 to p22
T2 = ctraj(p21,p22,30);
% calculate inverse kinematics for R2
T2_Ikine = R2.ikine(T2,'mask',[1 1 0 0 0 0]);
R2.plot(T2_Ikine)
0 Commenti
Risposta accettata
Gandham Heamanth
il 26 Giu 2023
To determine the allowed workspace for the 2DOF arms and check if the end effector's final position exceeds the specified limits, you can modify the code as follows:
% Define the workspace limits
xMin = -0.5;
xMax = 0.5;
yMin = 0.5;
yMax = 1.8;
% Get the user input for the desired position
x = input('Type x coordinate: ');
y = input('Type y coordinate: ');
% Check if the desired position is within the workspace limits
if x < xMin || x > xMax || y < yMin || y > yMax
fprintf('Position coordinates exceed robot working area. Insert new coordinates.\n');
pause(3);
New_2R; % Call the same program
else
% Continue with the program
% ... (rest of the code)
% Desired position for R1
p11 = transl(-1.5, 0.2, 0); % define the start pose
p12 = transl(-x, y, 0); % define the end pose
% calculate the trajectory from p11 to p12
T1 = ctraj(p11, p12, 30);
% calculate inverse kinematics for R1
T1_Ikine = R1.ikine(T1, 'mask', [1 1 0 0 0 0]);
R1.plot(T1_Ikine)
% Desired position for R2
p21 = transl(1.5, 0.2, 0); % define the start pose
p22 = transl(x, y, 0); % define the end pose
% calculate the trajectory from p21 to p22
T2 = ctraj(p21, p22, 30);
% calculate inverse kinematics for R2
T2_Ikine = R2.ikine(T2, 'mask', [1 1 0 0 0 0]);
R2.plot(T2_Ikine)
end
This code first checks if the desired position (x and y) is within the specified workspace limits. If the position is outside the limits, it prints a message and calls the same program again (New_2R). Otherwise, it continues with the rest of the program as before.
To extract the joint angles from the Ikine block, you can use the .q property of the resulting transformation matrix. For example, to extract the joint angles for R1, you can use T1_Ikine.q. Similarly, for R2, you can use T2_Ikine.q.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Robotics in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!