Simulink Control Design™ - MathWorks

(Tuis.) #1
(outputs of PID blocks) and the measurement signals (output of "6 DOF Robot Arm"
block).

SnapshotTimes = 0:1:5;
% Plant is from PID outputs to Robot Arm outputs
LinIOs = [...
linio('cst_robotarm/Controller/turntablePID',1,'openinput'),...
linio('cst_robotarm/Controller/bicepPID',1,'openinput'),...
linio('cst_robotarm/Controller/forearmPID',1,'openinput'),...
linio('cst_robotarm/Controller/wristPID',1,'openinput'),...
linio('cst_robotarm/Controller/handPID',1,'openinput'),...
linio('cst_robotarm/Controller/gripperPID',1,'openinput'),...
linio('cst_robotarm/6 DOF Robot Arm',1,'output')];
LinOpt = linearizeOptions('SampleTime',0); % seek continuous-time model
G = linearize('cst_robotarm',LinIOs,SnapshotTimes,LinOpt);

size(G)

6x1 array of state-space models.
Each model has 6 outputs, 6 inputs, and 19 states.

Plot the gap between the linearized models at t=0,1,2,3,4 seconds and the final model at
t=5 seconds.

G5 = G(:,:,end); % t=5
G5.SamplingGrid = [];
sigma(G5,G(:,:,2:5)-G5,{1e-3,1e3}), grid
title('Variation of linearized dynamics along trajectory')
legend('Linearization at t=5 s','Absolute variation',...
'location','SouthWest')

13 Control System Tuning Examples

Free download pdf