MATLAB Answers

1

Forward Dynamics of Robot using Robotics Toolbox

Asked by Mohsina Zafar on 10 Jul 2019
I am using robotics toolbox to compute the forward dynamics of a robot but I am unable to get the torque function to compute it.
The code I am using is:
l2=0.28;
l3=0.2;
d1=0.03;
syms q q1 q2 q3
L(1)= Link([0 d1 0 -pi/2]); %D-H Parameters
L(2)= Link([0 0 l2 0]);
L(3)= Link([0 0 l3 0]);
L(1).m = 1;
L(1).m = 4;
L(1).m = 3;
q=[q1 q2 q3]
robot=SerialLink(L) %create robot
I am trying to compute the torque using a Simulink model and use the output in forward dynamic function
[t, q, qd] = fdyn(robot, t1, torqfunction, q0, qd0, varargin) %I need the torqfunction.
I am getting torque values from this MATLab code and attached Simulink code.
load('Motor_Param.mat')
t = 0:0.1:10;
T_o = [0.05*(10-t);0.04*(10-t);0.03*(10-t)];
T_d = zeros(size(T_o));
T_e = (T_d - T_o);
C_PD = pid(100,0,10,100);
T_u = timeseries(zeros(size(T_e)),t);
for k=1:size(T_e,1)
T_u.Data(k,:) = lsim(C_PD,T_e(k,:),t);
a = sim('Motor_Control','SimulationMode','normal');
out = a.get('T_l')
end

  0 Comments

Sign in to comment.

0 Answers