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

43 ビュー (過去 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!
  1 件のコメント
Anoop Kumar Sinha
Anoop Kumar Sinha 2021 年 2 月 15 日
Thank you Reshma

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by