Determine the workspace for 2DOF parallel arms

조회 수: 9 (최근 30일)
Soulis
Soulis 2023년 6월 26일
댓글: Soulis 2023년 6월 30일
For the below code I have the following questions
  1. 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.
  2. 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)

채택된 답변

Gandham Heamanth
Gandham Heamanth 2023년 6월 26일
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.
  댓글 수: 2
Soulis
Soulis 2023년 6월 30일
Good evening , I have fixed the code with the workspace and I have tried to extract the angle using R1.Ikine.q and i receive error
Not enough input arguments.
Error in SerialLink/ikine (line 112)
TT = SE3.convert(tr);
if I type T1.ikine.q then i receive the following message " Dot indexing is not supported for variables of this type. " .
Any comment or suggestion is welcome
Soulis
Soulis 2023년 6월 30일
After runninh few times the code then the result is not correct becuase if we are using coordinates outside the working area and the first time we insert wrong values, when we try once more with wrong values then program is executed

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Robotics에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by