How to manage the Inverse Kinematics in a Robotic Arm with 3 joints?

11 次查看(过去 30 天)
The example with 2 joints is given in: http://uk.mathworks.com/help/fuzzy/examples/modeling-inverse-kinematics-in-a-robotic-arm.html?refresh=true; and I've already modified the original code into a 3-joint-robotic arms:
l1 = 10; % length of first arm
l2 = 7; % length of second arm
l3 = 6;
theta1 = 0:0.1:pi/2;% all possible theta1 values
theta2 = 0:0.1:pi;% all possible theta2 values
theta3 = 0:0.1:pi;
[THETA1, THETA2, THETA3] = meshgrid(theta1, theta2,theta3); % generate a grid of theta1 and theta2 values
X = l1 * cos(THETA1) + l2 * cos(THETA1+THETA2) + l3 * cos(THETA1+THETA2+THETA3) ; % compute x coordinates
Y = l1 * sin(THETA1) + l2 * sin(THETA1+THETA2) + l3 * sin(THETA1+THETA2+THETA3) ;
X1 = reshape(X, size(X,1), size(X,2)*size(X,3));
Y1 = reshape(Y, size(Y,1), size(Y,2)*size(Y,3));
plot(X1, Y1);
U = l1 * cos(THETA1) + l2 * cos(THETA1+THETA2);
V = l1 * sin(THETA1) + l2 * sin(THETA1+THETA2);
U1 = reshape(U, size(U,1), size(U,2)*size(U,3));
V1 = reshape(V, size(V,1), size(V,2)*size(V,3));
The code is CORRECT and it be can successfully plotted. I am now confused with how to set the data as well as the following steps such as ANFIS network training and the equation of 3-joint-robotic arm. At first I guessed that the angle of the joint theta 1,2,3 as well as the position of the final joint (U,V) and the tip(X,Y) is needed so I typed:
data1 = [X(:) Y(:) U(:) V(:) THETA1(:)]; % create x-y-theta1 dataset
data2 = [X(:) Y(:) U(:) V(:) THETA2(:)]; % create x-y-theta2 dataset
data3 = [X(:) Y(:) U(:) V(:) THETA3(:)]; % create x-y-theta2 dataset
When I tried to train the ANFIS network the system broke down because the data were to large.
Anyone can show me an improved commands?

回答(1 个)

Junhao Jiang
Junhao Jiang 2020-4-22
if it doesn't solve in mathmatic euqation, neural network maybe a good way to approximate the model

类别

Help CenterFile Exchange 中查找有关 Robotics 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by