Change all indentation
This commit is contained in:
		@@ -23,8 +23,9 @@ stewart = computeJacobian(stewart);
 | 
			
		||||
stewart = initializeStewartPose(stewart);
 | 
			
		||||
stewart = initializeInertialSensor(stewart, 'type', 'none');
 | 
			
		||||
 | 
			
		||||
ground = initializeGround('type', 'none');
 | 
			
		||||
ground = initializeGround('type', 'rigid', 'rot_point', stewart.platform_F.FO_A);
 | 
			
		||||
payload = initializePayload('type', 'none');
 | 
			
		||||
controller = initializeController('type', 'open-loop');
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -58,8 +59,8 @@ figure;
 | 
			
		||||
ax1 = subplot(2, 1, 1);
 | 
			
		||||
hold on;
 | 
			
		||||
for i = 2:6
 | 
			
		||||
  set(gca,'ColorOrderIndex',2);
 | 
			
		||||
  plot(freqs, abs(squeeze(freqresp(G(['Dm', num2str(i)], 'F1'), freqs, 'Hz'))));
 | 
			
		||||
    set(gca,'ColorOrderIndex',2);
 | 
			
		||||
    plot(freqs, abs(squeeze(freqresp(G(['Dm', num2str(i)], 'F1'), freqs, 'Hz'))));
 | 
			
		||||
end
 | 
			
		||||
set(gca,'ColorOrderIndex',1);
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G('Dm1', 'F1'), freqs, 'Hz'))));
 | 
			
		||||
@@ -70,8 +71,8 @@ ylabel('Amplitude [m/N]'); set(gca, 'XTickLabel',[]);
 | 
			
		||||
ax2 = subplot(2, 1, 2);
 | 
			
		||||
hold on;
 | 
			
		||||
for i = 2:6
 | 
			
		||||
  set(gca,'ColorOrderIndex',2);
 | 
			
		||||
  p2 = plot(freqs, 180/pi*angle(squeeze(freqresp(G(['Dm', num2str(i)], 'F1'), freqs, 'Hz'))));
 | 
			
		||||
    set(gca,'ColorOrderIndex',2);
 | 
			
		||||
    p2 = plot(freqs, 180/pi*angle(squeeze(freqresp(G(['Dm', num2str(i)], 'F1'), freqs, 'Hz'))));
 | 
			
		||||
end
 | 
			
		||||
set(gca,'ColorOrderIndex',1);
 | 
			
		||||
p1 = plot(freqs, 180/pi*angle(squeeze(freqresp(G('Dm1', 'F1'), freqs, 'Hz'))));
 | 
			
		||||
@@ -156,17 +157,17 @@ plot(real(tzero(G)),  imag(tzero(G)),  'o');
 | 
			
		||||
plot(real(tzero(Gf)), imag(tzero(Gf)), 'o');
 | 
			
		||||
plot(real(tzero(Ga)), imag(tzero(Gf)), 'o');
 | 
			
		||||
for i = 1:length(gains)
 | 
			
		||||
  set(gca,'ColorOrderIndex',1);
 | 
			
		||||
  cl_poles = pole(feedback(G, (gains(i)*s)*eye(6)));
 | 
			
		||||
  p1 = plot(real(cl_poles), imag(cl_poles), '.');
 | 
			
		||||
    set(gca,'ColorOrderIndex',1);
 | 
			
		||||
    cl_poles = pole(feedback(G, (gains(i)*s)*eye(6)));
 | 
			
		||||
    p1 = plot(real(cl_poles), imag(cl_poles), '.');
 | 
			
		||||
 | 
			
		||||
  set(gca,'ColorOrderIndex',2);
 | 
			
		||||
  cl_poles = pole(feedback(Gf, (gains(i)*s)*eye(6)));
 | 
			
		||||
  p2 = plot(real(cl_poles), imag(cl_poles), '.');
 | 
			
		||||
    set(gca,'ColorOrderIndex',2);
 | 
			
		||||
    cl_poles = pole(feedback(Gf, (gains(i)*s)*eye(6)));
 | 
			
		||||
    p2 = plot(real(cl_poles), imag(cl_poles), '.');
 | 
			
		||||
 | 
			
		||||
  set(gca,'ColorOrderIndex',3);
 | 
			
		||||
  cl_poles = pole(feedback(Ga, (gains(i)*s)*eye(6)));
 | 
			
		||||
  p3 = plot(real(cl_poles), imag(cl_poles), '.');
 | 
			
		||||
    set(gca,'ColorOrderIndex',3);
 | 
			
		||||
    cl_poles = pole(feedback(Ga, (gains(i)*s)*eye(6)));
 | 
			
		||||
    p3 = plot(real(cl_poles), imag(cl_poles), '.');
 | 
			
		||||
end
 | 
			
		||||
ylim([0, 1.1*max(imag(pole(G)))]);
 | 
			
		||||
xlim([-1.1*max(imag(pole(G))),0]);
 | 
			
		||||
 
 | 
			
		||||
@@ -23,17 +23,14 @@ stewart = computeJacobian(stewart);
 | 
			
		||||
stewart = initializeStewartPose(stewart);
 | 
			
		||||
stewart = initializeInertialSensor(stewart, 'type', 'none');
 | 
			
		||||
 | 
			
		||||
ground = initializeGround('type', 'none');
 | 
			
		||||
ground = initializeGround('type', 'rigid', 'rot_point', stewart.platform_F.FO_A);
 | 
			
		||||
payload = initializePayload('type', 'none');
 | 
			
		||||
controller = initializeController('type', 'open-loop');
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
% And we identify the dynamics from force actuators to force sensors.
 | 
			
		||||
 | 
			
		||||
%% Options for Linearized
 | 
			
		||||
options = linearizeOptions;
 | 
			
		||||
options.SampleTime = 0;
 | 
			
		||||
 | 
			
		||||
%% Name of the Simulink File
 | 
			
		||||
mdl = 'stewart_platform_model';
 | 
			
		||||
 | 
			
		||||
@@ -43,7 +40,7 @@ io(io_i) = linio([mdl, '/Controller'],        1, 'openinput');  io_i = io_i + 1;
 | 
			
		||||
io(io_i) = linio([mdl, '/Stewart Platform'],  1, 'openoutput', [], 'Taum'); io_i = io_i + 1; % Force Sensor Outputs [N]
 | 
			
		||||
 | 
			
		||||
%% Run the linearization
 | 
			
		||||
G = linearize(mdl, io, options);
 | 
			
		||||
G = linearize(mdl, io);
 | 
			
		||||
G.InputName  = {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'};
 | 
			
		||||
G.OutputName = {'Fm1', 'Fm2', 'Fm3', 'Fm4', 'Fm5', 'Fm6'};
 | 
			
		||||
 | 
			
		||||
@@ -58,8 +55,8 @@ figure;
 | 
			
		||||
ax1 = subplot(2, 1, 1);
 | 
			
		||||
hold on;
 | 
			
		||||
for i = 2:6
 | 
			
		||||
  set(gca,'ColorOrderIndex',2);
 | 
			
		||||
  plot(freqs, abs(squeeze(freqresp(G(['Fm', num2str(i)], 'F1'), freqs, 'Hz'))));
 | 
			
		||||
    set(gca,'ColorOrderIndex',2);
 | 
			
		||||
    plot(freqs, abs(squeeze(freqresp(G(['Fm', num2str(i)], 'F1'), freqs, 'Hz'))));
 | 
			
		||||
end
 | 
			
		||||
set(gca,'ColorOrderIndex',1);
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G('Fm1', 'F1'), freqs, 'Hz'))));
 | 
			
		||||
@@ -70,8 +67,8 @@ ylabel('Amplitude [N/N]'); set(gca, 'XTickLabel',[]);
 | 
			
		||||
ax2 = subplot(2, 1, 2);
 | 
			
		||||
hold on;
 | 
			
		||||
for i = 2:6
 | 
			
		||||
  set(gca,'ColorOrderIndex',2);
 | 
			
		||||
  p2 = plot(freqs, 180/pi*angle(squeeze(freqresp(G(['Fm', num2str(i)], 'F1'), freqs, 'Hz'))));
 | 
			
		||||
    set(gca,'ColorOrderIndex',2);
 | 
			
		||||
    p2 = plot(freqs, 180/pi*angle(squeeze(freqresp(G(['Fm', num2str(i)], 'F1'), freqs, 'Hz'))));
 | 
			
		||||
end
 | 
			
		||||
set(gca,'ColorOrderIndex',1);
 | 
			
		||||
p1 = plot(freqs, 180/pi*angle(squeeze(freqresp(G('Fm1', 'F1'), freqs, 'Hz'))));
 | 
			
		||||
@@ -88,7 +85,7 @@ linkaxes([ax1,ax2],'x');
 | 
			
		||||
% We add some stiffness and damping in the flexible joints and we re-identify the dynamics.
 | 
			
		||||
 | 
			
		||||
stewart = initializeJointDynamics(stewart, 'type_F', 'universal', 'type_M', 'spherical');
 | 
			
		||||
Gf = linearize(mdl, io, options);
 | 
			
		||||
Gf = linearize(mdl, io);
 | 
			
		||||
Gf.InputName  = {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'};
 | 
			
		||||
Gf.OutputName = {'Fm1', 'Fm2', 'Fm3', 'Fm4', 'Fm5', 'Fm6'};
 | 
			
		||||
 | 
			
		||||
@@ -97,7 +94,7 @@ Gf.OutputName = {'Fm1', 'Fm2', 'Fm3', 'Fm4', 'Fm5', 'Fm6'};
 | 
			
		||||
% We now use the amplified actuators and re-identify the dynamics
 | 
			
		||||
 | 
			
		||||
stewart = initializeAmplifiedStrutDynamics(stewart);
 | 
			
		||||
Ga = linearize(mdl, io, options);
 | 
			
		||||
Ga = linearize(mdl, io);
 | 
			
		||||
Ga.InputName  = {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'};
 | 
			
		||||
Ga.OutputName = {'Fm1', 'Fm2', 'Fm3', 'Fm4', 'Fm5', 'Fm6'};
 | 
			
		||||
 | 
			
		||||
@@ -156,17 +153,17 @@ plot(real(tzero(G)),  imag(tzero(G)),  'o');
 | 
			
		||||
plot(real(tzero(Gf)), imag(tzero(Gf)), 'o');
 | 
			
		||||
plot(real(tzero(Ga)), imag(tzero(Ga)), 'o');
 | 
			
		||||
for i = 1:length(gains)
 | 
			
		||||
  cl_poles = pole(feedback(G, (gains(i)/s)*eye(6)));
 | 
			
		||||
  set(gca,'ColorOrderIndex',1);
 | 
			
		||||
  p1 = plot(real(cl_poles), imag(cl_poles), '.');
 | 
			
		||||
    cl_poles = pole(feedback(G, (gains(i)/s)*eye(6)));
 | 
			
		||||
    set(gca,'ColorOrderIndex',1);
 | 
			
		||||
    p1 = plot(real(cl_poles), imag(cl_poles), '.');
 | 
			
		||||
 | 
			
		||||
  cl_poles = pole(feedback(Gf, (gains(i)/s)*eye(6)));
 | 
			
		||||
  set(gca,'ColorOrderIndex',2);
 | 
			
		||||
  p2 = plot(real(cl_poles), imag(cl_poles), '.');
 | 
			
		||||
    cl_poles = pole(feedback(Gf, (gains(i)/s)*eye(6)));
 | 
			
		||||
    set(gca,'ColorOrderIndex',2);
 | 
			
		||||
    p2 = plot(real(cl_poles), imag(cl_poles), '.');
 | 
			
		||||
 | 
			
		||||
  cl_poles = pole(feedback(Ga, (gains(i)/s)*eye(6)));
 | 
			
		||||
  set(gca,'ColorOrderIndex',3);
 | 
			
		||||
  p3 = plot(real(cl_poles), imag(cl_poles), '.');
 | 
			
		||||
    cl_poles = pole(feedback(Ga, (gains(i)/s)*eye(6)));
 | 
			
		||||
    set(gca,'ColorOrderIndex',3);
 | 
			
		||||
    p3 = plot(real(cl_poles), imag(cl_poles), '.');
 | 
			
		||||
end
 | 
			
		||||
ylim([0, 1.1*max(imag(pole(G)))]);
 | 
			
		||||
xlim([-1.1*max(imag(pole(G))),0]);
 | 
			
		||||
@@ -187,20 +184,20 @@ gains = logspace(0, 5, 1000);
 | 
			
		||||
figure;
 | 
			
		||||
hold on;
 | 
			
		||||
for i = 1:length(gains)
 | 
			
		||||
  set(gca,'ColorOrderIndex',1);
 | 
			
		||||
  cl_poles = pole(feedback(G, (gains(i)/s)*eye(6)));
 | 
			
		||||
  poles_damp = phase(cl_poles(imag(cl_poles)>0)) - pi/2;
 | 
			
		||||
  p1 = plot(gains(i)*ones(size(poles_damp)), poles_damp, '.');
 | 
			
		||||
    set(gca,'ColorOrderIndex',1);
 | 
			
		||||
    cl_poles = pole(feedback(G, (gains(i)/s)*eye(6)));
 | 
			
		||||
    poles_damp = phase(cl_poles(imag(cl_poles)>0)) - pi/2;
 | 
			
		||||
    p1 = plot(gains(i)*ones(size(poles_damp)), poles_damp, '.');
 | 
			
		||||
 | 
			
		||||
  set(gca,'ColorOrderIndex',2);
 | 
			
		||||
  cl_poles = pole(feedback(Gf, (gains(i)/s)*eye(6)));
 | 
			
		||||
  poles_damp = phase(cl_poles(imag(cl_poles)>0)) - pi/2;
 | 
			
		||||
  p2 = plot(gains(i)*ones(size(poles_damp)), poles_damp, '.');
 | 
			
		||||
    set(gca,'ColorOrderIndex',2);
 | 
			
		||||
    cl_poles = pole(feedback(Gf, (gains(i)/s)*eye(6)));
 | 
			
		||||
    poles_damp = phase(cl_poles(imag(cl_poles)>0)) - pi/2;
 | 
			
		||||
    p2 = plot(gains(i)*ones(size(poles_damp)), poles_damp, '.');
 | 
			
		||||
 | 
			
		||||
  set(gca,'ColorOrderIndex',3);
 | 
			
		||||
  cl_poles = pole(feedback(Ga, (gains(i)/s)*eye(6)));
 | 
			
		||||
  poles_damp = phase(cl_poles(imag(cl_poles)>0)) - pi/2;
 | 
			
		||||
  p3 = plot(gains(i)*ones(size(poles_damp)), poles_damp, '.');
 | 
			
		||||
    set(gca,'ColorOrderIndex',3);
 | 
			
		||||
    cl_poles = pole(feedback(Ga, (gains(i)/s)*eye(6)));
 | 
			
		||||
    poles_damp = phase(cl_poles(imag(cl_poles)>0)) - pi/2;
 | 
			
		||||
    p3 = plot(gains(i)*ones(size(poles_damp)), poles_damp, '.');
 | 
			
		||||
end
 | 
			
		||||
xlabel('Control Gain');
 | 
			
		||||
ylabel('Damping of the Poles');
 | 
			
		||||
 
 | 
			
		||||
@@ -22,8 +22,9 @@ stewart = computeJacobian(stewart);
 | 
			
		||||
stewart = initializeStewartPose(stewart);
 | 
			
		||||
stewart = initializeInertialSensor(stewart, 'type', 'accelerometer', 'freq', 5e3);
 | 
			
		||||
 | 
			
		||||
ground = initializeGround('type', 'none');
 | 
			
		||||
ground = initializeGround('type', 'rigid', 'rot_point', stewart.platform_F.FO_A);
 | 
			
		||||
payload = initializePayload('type', 'none');
 | 
			
		||||
controller = initializeController('type', 'open-loop');
 | 
			
		||||
 | 
			
		||||
%% Options for Linearized
 | 
			
		||||
options = linearizeOptions;
 | 
			
		||||
@@ -53,8 +54,8 @@ figure;
 | 
			
		||||
ax1 = subplot(2, 1, 1);
 | 
			
		||||
hold on;
 | 
			
		||||
for i = 2:6
 | 
			
		||||
  set(gca,'ColorOrderIndex',2);
 | 
			
		||||
  plot(freqs, abs(squeeze(freqresp(G(['Vm', num2str(i)], 'F1'), freqs, 'Hz'))));
 | 
			
		||||
    set(gca,'ColorOrderIndex',2);
 | 
			
		||||
    plot(freqs, abs(squeeze(freqresp(G(['Vm', num2str(i)], 'F1'), freqs, 'Hz'))));
 | 
			
		||||
end
 | 
			
		||||
set(gca,'ColorOrderIndex',1);
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G('Vm1', 'F1'), freqs, 'Hz'))));
 | 
			
		||||
@@ -65,8 +66,8 @@ ylabel('Amplitude [$\frac{m/s}{N}$]'); set(gca, 'XTickLabel',[]);
 | 
			
		||||
ax2 = subplot(2, 1, 2);
 | 
			
		||||
hold on;
 | 
			
		||||
for i = 2:6
 | 
			
		||||
  set(gca,'ColorOrderIndex',2);
 | 
			
		||||
  p2 = plot(freqs, 180/pi*angle(squeeze(freqresp(G(['Vm', num2str(i)], 'F1'), freqs, 'Hz'))));
 | 
			
		||||
    set(gca,'ColorOrderIndex',2);
 | 
			
		||||
    p2 = plot(freqs, 180/pi*angle(squeeze(freqresp(G(['Vm', num2str(i)], 'F1'), freqs, 'Hz'))));
 | 
			
		||||
end
 | 
			
		||||
set(gca,'ColorOrderIndex',1);
 | 
			
		||||
p1 = plot(freqs, 180/pi*angle(squeeze(freqresp(G('Vm1', 'F1'), freqs, 'Hz'))));
 | 
			
		||||
@@ -151,17 +152,17 @@ plot(real(tzero(G)),  imag(tzero(G)),  'o');
 | 
			
		||||
plot(real(tzero(Gf)), imag(tzero(Gf)), 'o');
 | 
			
		||||
plot(real(tzero(Ga)), imag(tzero(Ga)), 'o');
 | 
			
		||||
for i = 1:length(gains)
 | 
			
		||||
  set(gca,'ColorOrderIndex',1);
 | 
			
		||||
  cl_poles = pole(feedback(G, gains(i)*eye(6)));
 | 
			
		||||
  p1 = plot(real(cl_poles), imag(cl_poles), '.');
 | 
			
		||||
    set(gca,'ColorOrderIndex',1);
 | 
			
		||||
    cl_poles = pole(feedback(G, gains(i)*eye(6)));
 | 
			
		||||
    p1 = plot(real(cl_poles), imag(cl_poles), '.');
 | 
			
		||||
 | 
			
		||||
  set(gca,'ColorOrderIndex',2);
 | 
			
		||||
  cl_poles = pole(feedback(Gf, gains(i)*eye(6)));
 | 
			
		||||
  p2 = plot(real(cl_poles), imag(cl_poles), '.');
 | 
			
		||||
    set(gca,'ColorOrderIndex',2);
 | 
			
		||||
    cl_poles = pole(feedback(Gf, gains(i)*eye(6)));
 | 
			
		||||
    p2 = plot(real(cl_poles), imag(cl_poles), '.');
 | 
			
		||||
 | 
			
		||||
  set(gca,'ColorOrderIndex',3);
 | 
			
		||||
  cl_poles = pole(feedback(Ga, gains(i)*eye(6)));
 | 
			
		||||
  p3 = plot(real(cl_poles), imag(cl_poles), '.');
 | 
			
		||||
    set(gca,'ColorOrderIndex',3);
 | 
			
		||||
    cl_poles = pole(feedback(Ga, gains(i)*eye(6)));
 | 
			
		||||
    p3 = plot(real(cl_poles), imag(cl_poles), '.');
 | 
			
		||||
end
 | 
			
		||||
ylim([0, 3*max(imag(pole(G)))]);
 | 
			
		||||
xlim([-3*max(imag(pole(G))),0]);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user