How to plot manipulability index of a 5dof robotic arm?

조회 수: 26 (최근 30일)
Anoop Kumar Sinha
Anoop Kumar Sinha 2021년 1월 22일
댓글: Anoop Kumar Sinha 2021년 2월 15일
Hi communinty,
I am trying to plot the manipulability index of my robotic arm. Here is the code:
clc; clear all;close all;
syms d1 th1 th2 th3 th4 th5 a2 a3 d5
a2 = 20;
a3 = 25;
d1 = 104;
d5 = 102;
px =(cos(th1)*(a2*cos(th2)+a3*cos(th2+th3)+d5*cos(th2+th3+th4)));
py = (sin(th1)*(a2*cos(th2)+a3*cos(th2+th3)+d5*cos(th2+th3+th4)));
pz = d1-a2*sin(th2)-a3*sin(th2+th3)-d5*sin(th2+th3+th4);
% Matlab function for Jacobian Calculation
J = jacobian([px; py; pz], [th1; th2; th3; th4; th5])
J1=J';
J2=J*J1
% discretization of joint angles (in rads)
delta=5; th1=[-pi:delta:pi]; th2=[-pi:delta:pi]; th3=[-pi:delta:pi]; th4=[-pi:delta:pi];th5=[-pi:delta:pi];
for i =1:length(th1), for j=1:length(th2), for k=1:length(th3), for m=1:length(th4), for n=1:length(th5),
H(i,j,k,m,n)=sqrt(det (J2));
end; end; end; end; end;
[X,Y]=meshgrid(px,py);
mesh(X,Y,H);
title('Manipulability index H of planar 3R robot');
xlabel('px');ylabel('py');zlabel('sqrt (det J*JT)');
The error I am getting is:
Error using mesh (line 71)
Data dimensions must agree.
Error in TwoDOFFKVisualisation (line 27)
mesh(X,Y,H);
Any idea how to correct this? or any alternate idea that you can suggest?
Thanks for help in advance.

답변 (1개)

Reshma Nerella
Reshma Nerella 2021년 1월 31일
Hi,
In this line of code,
[X,Y]=meshgrid(px,py);
>> X =
cos(th1)*(102*cos(th2 + th3 + th4) + 25*cos(th2 + th3) + 20*cos(th2))
>> Y
Y =
sin(th1)*(102*cos(th2 + th3 + th4) + 25*cos(th2 + th3) + 20*cos(th2))
The output variables X, Y from meshgrid function are of type 'sym', which can not be used as input for 'mesh' function.
Mesh function can only take vectors and matrices as input arguments.
Conisder converting variables to the type the required function(mesh) can take as inputs.
For more information and examples on meshgrid and mesh functions, refer to the documentation page.
Hope this helps!

카테고리

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