#+TITLE: Stewart Platform - Decentralized Active Damping
:DRAWER:
#+STARTUP: overview
#+LANGUAGE: en
#+EMAIL: dehaeze.thomas@gmail.com
#+AUTHOR: Dehaeze Thomas
#+HTML_LINK_HOME: ./index.html
#+HTML_LINK_UP: ./index.html
#+HTML_HEAD:
#+HTML_HEAD:
#+HTML_HEAD:
#+HTML_HEAD:
#+HTML_HEAD:
#+HTML_HEAD:
#+PROPERTY: header-args:matlab :session *MATLAB*
#+PROPERTY: header-args:matlab+ :comments org
#+PROPERTY: header-args:matlab+ :exports both
#+PROPERTY: header-args:matlab+ :results none
#+PROPERTY: header-args:matlab+ :eval no-export
#+PROPERTY: header-args:matlab+ :noweb yes
#+PROPERTY: header-args:matlab+ :mkdirp yes
#+PROPERTY: header-args:matlab+ :output-dir figs
#+PROPERTY: header-args:latex :headers '("\\usepackage{tikz}" "\\usepackage{import}" "\\import{$HOME/Cloud/tikz/org/}{config.tex}")
#+PROPERTY: header-args:latex+ :imagemagick t :fit yes
#+PROPERTY: header-args:latex+ :iminoptions -scale 100% -density 150
#+PROPERTY: header-args:latex+ :imoutoptions -quality 100
#+PROPERTY: header-args:latex+ :results file raw replace
#+PROPERTY: header-args:latex+ :buffer no
#+PROPERTY: header-args:latex+ :eval no-export
#+PROPERTY: header-args:latex+ :exports results
#+PROPERTY: header-args:latex+ :mkdirp yes
#+PROPERTY: header-args:latex+ :output-dir figs
#+PROPERTY: header-args:latex+ :post pdf2svg(file=*this*, ext="png")
:END:
* Introduction :ignore:
The following decentralized active damping techniques are briefly studied:
- Inertial Control (proportional feedback of the absolute velocity): Section [[sec:active_damping_inertial]]
- Integral Force Feedback: Section [[sec:active_damping_iff]]
- Direct feedback of the relative velocity of each strut: Section [[sec:active_damping_dvf]]
* Inertial Control
:PROPERTIES:
:header-args:matlab+: :tangle ../matlab/active_damping_inertial.m
:header-args:matlab+: :comments org :mkdirp yes
:END:
<>
#+begin_note
The Matlab script corresponding to this section is accessible [[file:../matlab/active_damping_inertial.m][here]].
To run the script, open the Simulink Project, and type =run active_damping_inertial.m=.
#+end_note
** Introduction :ignore:
** Matlab Init :noexport:ignore:
#+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name)
<>
#+end_src
#+begin_src matlab :exports none :results silent :noweb yes
<>
#+end_src
#+begin_src matlab
simulinkproject('../');
#+end_src
#+begin_src matlab
open('stewart_platform_model.slx')
#+end_src
** Identification of the Dynamics
#+begin_src matlab
stewart = initializeStewartPlatform();
stewart = initializeFramesPositions(stewart, 'H', 90e-3, 'MO_B', 45e-3);
stewart = generateGeneralConfiguration(stewart);
stewart = computeJointsPose(stewart);
stewart = initializeStrutDynamics(stewart);
stewart = initializeJointDynamics(stewart, 'type_F', 'universal_p', 'type_M', 'spherical_p');
stewart = initializeCylindricalPlatforms(stewart);
stewart = initializeCylindricalStruts(stewart);
stewart = computeJacobian(stewart);
stewart = initializeStewartPose(stewart);
stewart = initializeInertialSensor(stewart, 'type', 'accelerometer', 'freq', 5e3);
#+end_src
#+begin_src matlab
ground = initializeGround('type', 'rigid', 'rot_point', stewart.platform_F.FO_A);
payload = initializePayload('type', 'none');
controller = initializeController('type', 'open-loop');
#+end_src
#+begin_src matlab
%% Options for Linearized
options = linearizeOptions;
options.SampleTime = 0;
%% Name of the Simulink File
mdl = 'stewart_platform_model';
%% Input/Output definition
clear io; io_i = 1;
io(io_i) = linio([mdl, '/Controller'], 1, 'openinput'); io_i = io_i + 1; % Actuator Force Inputs [N]
io(io_i) = linio([mdl, '/Stewart Platform'], 1, 'openoutput', [], 'Vm'); io_i = io_i + 1; % Absolute velocity of each leg [m/s]
%% Run the linearization
G = linearize(mdl, io, options);
G.InputName = {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'};
G.OutputName = {'Vm1', 'Vm2', 'Vm3', 'Vm4', 'Vm5', 'Vm6'};
#+end_src
The transfer function from actuator forces to force sensors is shown in Figure [[fig:inertial_plant_coupling]].
#+begin_src matlab :exports none
freqs = logspace(1, 4, 1000);
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'))));
end
set(gca,'ColorOrderIndex',1);
plot(freqs, abs(squeeze(freqresp(G('Vm1', 'F1'), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
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'))));
end
set(gca,'ColorOrderIndex',1);
p1 = plot(freqs, 180/pi*angle(squeeze(freqresp(G('Vm1', 'F1'), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
ylabel('Phase [deg]'); xlabel('Frequency [Hz]');
ylim([-180, 180]);
yticks([-180, -90, 0, 90, 180]);
legend([p1, p2], {'$F_{m,i}/F_i$', '$F_{m,j}/F_i$'})
linkaxes([ax1,ax2],'x');
#+end_src
#+header: :tangle no :exports results :results none :noweb yes
#+begin_src matlab :var filepath="figs/inertial_plant_coupling.pdf" :var figsize="full-tall" :post pdf2svg(file=*this*, ext="png")
<>
#+end_src
#+name: fig:inertial_plant_coupling
#+caption: Transfer function from the Actuator force $F_{i}$ to the absolute velocity of the same leg $v_{m,i}$ and to the absolute velocity of the other legs $v_{m,j}$ with $i \neq j$ in grey ([[./figs/inertial_plant_coupling.png][png]], [[./figs/inertial_plant_coupling.pdf][pdf]])
[[file:figs/inertial_plant_coupling.png]]
** Effect of the Flexible Joint stiffness and Actuator amplification on the Dynamics
We add some stiffness and damping in the flexible joints and we re-identify the dynamics.
#+begin_src matlab
stewart = initializeJointDynamics(stewart, 'type_F', 'universal', 'type_M', 'spherical');
Gf = linearize(mdl, io, options);
Gf.InputName = {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'};
Gf.OutputName = {'Vm1', 'Vm2', 'Vm3', 'Vm4', 'Vm5', 'Vm6'};
#+end_src
We now use the amplified actuators and re-identify the dynamics
#+begin_src matlab
stewart = initializeAmplifiedStrutDynamics(stewart);
Ga = linearize(mdl, io, options);
Ga.InputName = {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'};
Ga.OutputName = {'Vm1', 'Vm2', 'Vm3', 'Vm4', 'Vm5', 'Vm6'};
#+end_src
The new dynamics from force actuator to force sensor is shown in Figure [[fig:inertial_plant_flexible_joint_decentralized]].
#+begin_src matlab :exports none
freqs = logspace(1, 4, 1000);
figure;
ax1 = subplot(2, 1, 1);
hold on;
plot(freqs, abs(squeeze(freqresp(G( 'Vm1', 'F1'), freqs, 'Hz'))));
plot(freqs, abs(squeeze(freqresp(Gf('Vm1', 'F1'), freqs, 'Hz'))));
plot(freqs, abs(squeeze(freqresp(Ga('Vm1', 'F1'), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('Amplitude [$\frac{m/s}{N}$]'); set(gca, 'XTickLabel',[]);
ax2 = subplot(2, 1, 2);
hold on;
plot(freqs, 180/pi*angle(squeeze(freqresp(G( 'Vm1', 'F1'), freqs, 'Hz'))), 'DisplayName', 'Perfect Joints');
plot(freqs, 180/pi*angle(squeeze(freqresp(Gf('Vm1', 'F1'), freqs, 'Hz'))), 'DisplayName', 'Flexible Joints');
plot(freqs, 180/pi*angle(squeeze(freqresp(Ga('Vm1', 'F1'), freqs, 'Hz'))), 'DisplayName', 'Amplified Actuator');
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
ylabel('Phase [deg]'); xlabel('Frequency [Hz]');
ylim([-180, 180]);
yticks([-180, -90, 0, 90, 180]);
legend('location', 'southwest')
linkaxes([ax1,ax2],'x');
#+end_src
#+header: :tangle no :exports results :results none :noweb yes
#+begin_src matlab :var filepath="figs/inertial_plant_flexible_joint_decentralized.pdf" :var figsize="full-tall" :post pdf2svg(file=*this*, ext="png")
<>
#+end_src
#+name: fig:inertial_plant_flexible_joint_decentralized
#+caption: Transfer function from the Actuator force $F_{i}$ to the absolute velocity sensor $v_{m,i}$ ([[./figs/inertial_plant_flexible_joint_decentralized.png][png]], [[./figs/inertial_plant_flexible_joint_decentralized.pdf][pdf]])
[[file:figs/inertial_plant_flexible_joint_decentralized.png]]
** Obtained Damping
The control is a performed in a decentralized manner.
The $6 \times 6$ control is a diagonal matrix with pure proportional action on the diagonal:
\[ K(s) = g
\begin{bmatrix}
1 & & 0 \\
& \ddots & \\
0 & & 1
\end{bmatrix} \]
The root locus is shown in figure [[fig:root_locus_inertial_rot_stiffness]].
#+begin_src matlab :exports none
gains = logspace(2, 5, 100);
figure;
hold on;
plot(real(pole(G)), imag(pole(G)), 'x');
plot(real(pole(Gf)), imag(pole(Gf)), 'x');
plot(real(pole(Ga)), imag(pole(Ga)), 'x');
set(gca,'ColorOrderIndex',1);
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',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), '.');
end
ylim([0, 3*max(imag(pole(G)))]);
xlim([-3*max(imag(pole(G))),0]);
xlabel('Real Part')
ylabel('Imaginary Part')
axis square
legend([p1, p2, p3], {'Perfect Joints', 'Flexible Joints', 'Amplified Actuator'}, 'location', 'northwest');
#+end_src
#+header: :tangle no :exports results :results none :noweb yes
#+begin_src matlab :var filepath="figs/root_locus_inertial_rot_stiffness.pdf" :var figsize="wide-tall" :post pdf2svg(file=*this*, ext="png")
<>
#+end_src
#+name: fig:root_locus_inertial_rot_stiffness
#+caption: Root Locus plot with Decentralized Inertial Control when considering the stiffness of flexible joints ([[./figs/root_locus_inertial_rot_stiffness.png][png]], [[./figs/root_locus_inertial_rot_stiffness.pdf][pdf]])
[[file:figs/root_locus_inertial_rot_stiffness.png]]
** Conclusion
#+begin_important
We do not have guaranteed stability with Inertial control. This is because of the flexibility inside the internal sensor.
#+end_important
* Integral Force Feedback
:PROPERTIES:
:header-args:matlab+: :tangle ../matlab/active_damping_iff.m
:header-args:matlab+: :comments org :mkdirp yes
:END:
<>
#+begin_note
The Matlab script corresponding to this section is accessible [[file:../matlab/active_damping_iff.m][here]].
To run the script, open the Simulink Project, and type =run active_damping_iff.m=.
#+end_note
** Introduction :ignore:
** Matlab Init :noexport:ignore:
#+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name)
<>
#+end_src
#+begin_src matlab :exports none :results silent :noweb yes
<>
#+end_src
#+begin_src matlab
simulinkproject('../');
#+end_src
#+begin_src matlab
open('stewart_platform_model.slx')
#+end_src
** Identification of the Dynamics with perfect Joints
We first initialize the Stewart platform without joint stiffness.
#+begin_src matlab
stewart = initializeStewartPlatform();
stewart = initializeFramesPositions(stewart, 'H', 90e-3, 'MO_B', 45e-3);
stewart = generateGeneralConfiguration(stewart);
stewart = computeJointsPose(stewart);
stewart = initializeStrutDynamics(stewart);
stewart = initializeJointDynamics(stewart, 'type_F', 'universal_p', 'type_M', 'spherical_p');
stewart = initializeCylindricalPlatforms(stewart);
stewart = initializeCylindricalStruts(stewart);
stewart = computeJacobian(stewart);
stewart = initializeStewartPose(stewart);
stewart = initializeInertialSensor(stewart, 'type', 'none');
#+end_src
#+begin_src matlab
ground = initializeGround('type', 'rigid', 'rot_point', stewart.platform_F.FO_A);
payload = initializePayload('type', 'none');
controller = initializeController('type', 'open-loop');
#+end_src
And we identify the dynamics from force actuators to force sensors.
#+begin_src matlab
%% Name of the Simulink File
mdl = 'stewart_platform_model';
%% Input/Output definition
clear io; io_i = 1;
io(io_i) = linio([mdl, '/Controller'], 1, 'openinput'); io_i = io_i + 1; % Actuator Force Inputs [N]
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);
G.InputName = {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'};
G.OutputName = {'Fm1', 'Fm2', 'Fm3', 'Fm4', 'Fm5', 'Fm6'};
#+end_src
The transfer function from actuator forces to force sensors is shown in Figure [[fig:iff_plant_coupling]].
#+begin_src matlab :exports none
freqs = logspace(1, 4, 1000);
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'))));
end
set(gca,'ColorOrderIndex',1);
plot(freqs, abs(squeeze(freqresp(G('Fm1', 'F1'), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
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'))));
end
set(gca,'ColorOrderIndex',1);
p1 = plot(freqs, 180/pi*angle(squeeze(freqresp(G('Fm1', 'F1'), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
ylabel('Phase [deg]'); xlabel('Frequency [Hz]');
ylim([-180, 180]);
yticks([-180, -90, 0, 90, 180]);
legend([p1, p2], {'$F_{m,i}/F_i$', '$F_{m,j}/F_i$'})
linkaxes([ax1,ax2],'x');
#+end_src
#+header: :tangle no :exports results :results none :noweb yes
#+begin_src matlab :var filepath="figs/iff_plant_coupling.pdf" :var figsize="full-tall" :post pdf2svg(file=*this*, ext="png")
<>
#+end_src
#+name: fig:iff_plant_coupling
#+caption: Transfer function from the Actuator force $F_{i}$ to the Force sensor of the same leg $F_{m,i}$ and to the force sensor of the other legs $F_{m,j}$ with $i \neq j$ in grey ([[./figs/iff_plant_coupling.png][png]], [[./figs/iff_plant_coupling.pdf][pdf]])
[[file:figs/iff_plant_coupling.png]]
** Effect of the Flexible Joint stiffness and Actuator amplification on the Dynamics
We add some stiffness and damping in the flexible joints and we re-identify the dynamics.
#+begin_src matlab
stewart = initializeJointDynamics(stewart, 'type_F', 'universal', 'type_M', 'spherical');
Gf = linearize(mdl, io);
Gf.InputName = {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'};
Gf.OutputName = {'Fm1', 'Fm2', 'Fm3', 'Fm4', 'Fm5', 'Fm6'};
#+end_src
We now use the amplified actuators and re-identify the dynamics
#+begin_src matlab
stewart = initializeAmplifiedStrutDynamics(stewart);
Ga = linearize(mdl, io);
Ga.InputName = {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'};
Ga.OutputName = {'Fm1', 'Fm2', 'Fm3', 'Fm4', 'Fm5', 'Fm6'};
#+end_src
The new dynamics from force actuator to force sensor is shown in Figure [[fig:iff_plant_flexible_joint_decentralized]].
#+begin_src matlab :exports none
freqs = logspace(1, 4, 1000);
figure;
ax1 = subplot(2, 1, 1);
hold on;
plot(freqs, abs(squeeze(freqresp(G( 'Fm1', 'F1'), freqs, 'Hz'))));
plot(freqs, abs(squeeze(freqresp(Gf('Fm1', 'F1'), freqs, 'Hz'))));
plot(freqs, abs(squeeze(freqresp(Ga('Fm1', 'F1'), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('Amplitude [N/N]'); set(gca, 'XTickLabel',[]);
ax2 = subplot(2, 1, 2);
hold on;
plot(freqs, 180/pi*angle(squeeze(freqresp(G( 'Fm1', 'F1'), freqs, 'Hz'))), 'DisplayName', 'Perfect Joints');
plot(freqs, 180/pi*angle(squeeze(freqresp(Gf('Fm1', 'F1'), freqs, 'Hz'))), 'DisplayName', 'Flexible Joints');
plot(freqs, 180/pi*angle(squeeze(freqresp(Ga('Fm1', 'F1'), freqs, 'Hz'))), 'DisplayName', 'Amplified Actuators');
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
ylabel('Phase [deg]'); xlabel('Frequency [Hz]');
ylim([-180, 180]);
yticks([-180, -90, 0, 90, 180]);
legend('location', 'southwest')
linkaxes([ax1,ax2],'x');
#+end_src
#+header: :tangle no :exports results :results none :noweb yes
#+begin_src matlab :var filepath="figs/iff_plant_flexible_joint_decentralized.pdf" :var figsize="full-tall" :post pdf2svg(file=*this*, ext="png")
<>
#+end_src
#+name: fig:iff_plant_flexible_joint_decentralized
#+caption: Transfer function from the Actuator force $F_{i}$ to the force sensor $F_{m,i}$ ([[./figs/iff_plant_flexible_joint_decentralized.png][png]], [[./figs/iff_plant_flexible_joint_decentralized.pdf][pdf]])
[[file:figs/iff_plant_flexible_joint_decentralized.png]]
** Obtained Damping
The control is a performed in a decentralized manner.
The $6 \times 6$ control is a diagonal matrix with pure integration action on the diagonal:
\[ K(s) = g
\begin{bmatrix}
\frac{1}{s} & & 0 \\
& \ddots & \\
0 & & \frac{1}{s}
\end{bmatrix} \]
The root locus is shown in figure [[fig:root_locus_iff_rot_stiffness]] and the obtained pole damping function of the control gain is shown in figure [[fig:pole_damping_gain_iff_rot_stiffness]].
#+begin_src matlab :exports none
gains = logspace(0, 5, 1000);
figure;
hold on;
plot(real(pole(G)), imag(pole(G)), 'x');
plot(real(pole(Gf)), imag(pole(Gf)), 'x');
plot(real(pole(Ga)), imag(pole(Ga)), 'x');
set(gca,'ColorOrderIndex',1);
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(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), '.');
end
ylim([0, 1.1*max(imag(pole(G)))]);
xlim([-1.1*max(imag(pole(G))),0]);
xlabel('Real Part')
ylabel('Imaginary Part')
axis square
legend([p1, p2, p3], {'Perfect Joints', 'Flexible Joints', 'Amplified Actuator'}, 'location', 'northwest');
#+end_src
#+header: :tangle no :exports results :results none :noweb yes
#+begin_src matlab :var filepath="figs/root_locus_iff_rot_stiffness.pdf" :var figsize="wide-tall" :post pdf2svg(file=*this*, ext="png")
<>
#+end_src
#+name: fig:root_locus_iff_rot_stiffness
#+caption: Root Locus plot with Decentralized Integral Force Feedback when considering the stiffness of flexible joints ([[./figs/root_locus_iff_rot_stiffness.png][png]], [[./figs/root_locus_iff_rot_stiffness.pdf][pdf]])
[[file:figs/root_locus_iff_rot_stiffness.png]]
#+begin_src matlab :exports none
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',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, '.');
end
xlabel('Control Gain');
ylabel('Damping of the Poles');
set(gca, 'XScale', 'log');
ylim([0,pi/2]);
legend([p1, p2, p3], {'Perfect Joints', 'Flexible Joints', 'Amplified Actuator'}, 'location', 'northwest');
#+end_src
#+header: :tangle no :exports results :results none :noweb yes
#+begin_src matlab :var filepath="figs/pole_damping_gain_iff_rot_stiffness.pdf" :var figsize="wide-tall" :post pdf2svg(file=*this*, ext="png")
<>
#+end_src
#+name: fig:pole_damping_gain_iff_rot_stiffness
#+caption: Damping of the poles with respect to the gain of the Decentralized Integral Force Feedback when considering the stiffness of flexible joints ([[./figs/pole_damping_gain_iff_rot_stiffness.png][png]], [[./figs/pole_damping_gain_iff_rot_stiffness.pdf][pdf]])
[[file:figs/pole_damping_gain_iff_rot_stiffness.png]]
** Conclusion
#+begin_important
The joint stiffness has a huge impact on the attainable active damping performance when using force sensors.
Thus, if Integral Force Feedback is to be used in a Stewart platform with flexible joints, the rotational stiffness of the joints should be minimized.
#+end_important
* Direct Velocity Feedback
:PROPERTIES:
:header-args:matlab+: :tangle ../matlab/active_damping_dvf.m
:header-args:matlab+: :comments org :mkdirp yes
:END:
<>
#+begin_note
The Matlab script corresponding to this section is accessible [[file:../matlab/active_damping_dvf.m][here]].
To run the script, open the Simulink Project, and type =run active_damping_dvf.m=.
#+end_note
** Introduction :ignore:
** Matlab Init :noexport:ignore:
#+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name)
<>
#+end_src
#+begin_src matlab :exports none :results silent :noweb yes
<>
#+end_src
#+begin_src matlab
simulinkproject('../');
#+end_src
#+begin_src matlab
open('stewart_platform_model.slx')
#+end_src
** Identification of the Dynamics with perfect Joints
We first initialize the Stewart platform without joint stiffness.
#+begin_src matlab
stewart = initializeStewartPlatform();
stewart = initializeFramesPositions(stewart, 'H', 90e-3, 'MO_B', 45e-3);
stewart = generateGeneralConfiguration(stewart);
stewart = computeJointsPose(stewart);
stewart = initializeStrutDynamics(stewart);
stewart = initializeJointDynamics(stewart, 'type_F', 'universal_p', 'type_M', 'spherical_p');
stewart = initializeCylindricalPlatforms(stewart);
stewart = initializeCylindricalStruts(stewart);
stewart = computeJacobian(stewart);
stewart = initializeStewartPose(stewart);
stewart = initializeInertialSensor(stewart, 'type', 'none');
#+end_src
#+begin_src matlab
ground = initializeGround('type', 'rigid', 'rot_point', stewart.platform_F.FO_A);
payload = initializePayload('type', 'none');
controller = initializeController('type', 'open-loop');
#+end_src
And we identify the dynamics from force actuators to force sensors.
#+begin_src matlab
%% Options for Linearized
options = linearizeOptions;
options.SampleTime = 0;
%% Name of the Simulink File
mdl = 'stewart_platform_model';
%% Input/Output definition
clear io; io_i = 1;
io(io_i) = linio([mdl, '/Controller'], 1, 'openinput'); io_i = io_i + 1; % Actuator Force Inputs [N]
io(io_i) = linio([mdl, '/Stewart Platform'], 1, 'openoutput', [], 'dLm'); io_i = io_i + 1; % Relative Displacement Outputs [m]
%% Run the linearization
G = linearize(mdl, io, options);
G.InputName = {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'};
G.OutputName = {'Dm1', 'Dm2', 'Dm3', 'Dm4', 'Dm5', 'Dm6'};
#+end_src
The transfer function from actuator forces to relative motion sensors is shown in Figure [[fig:dvf_plant_coupling]].
#+begin_src matlab :exports none
freqs = logspace(1, 4, 1000);
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'))));
end
set(gca,'ColorOrderIndex',1);
plot(freqs, abs(squeeze(freqresp(G('Dm1', 'F1'), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
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'))));
end
set(gca,'ColorOrderIndex',1);
p1 = plot(freqs, 180/pi*angle(squeeze(freqresp(G('Dm1', 'F1'), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
ylabel('Phase [deg]'); xlabel('Frequency [Hz]');
ylim([-180, 180]);
yticks([-180, -90, 0, 90, 180]);
legend([p1, p2], {'$D_{m,i}/F_i$', '$D_{m,j}/F_i$'})
linkaxes([ax1,ax2],'x');
#+end_src
#+header: :tangle no :exports results :results none :noweb yes
#+begin_src matlab :var filepath="figs/dvf_plant_coupling.pdf" :var figsize="full-tall" :post pdf2svg(file=*this*, ext="png")
<>
#+end_src
#+name: fig:dvf_plant_coupling
#+caption: Transfer function from the Actuator force $F_{i}$ to the Relative Motion Sensor $D_{m,j}$ with $i \neq j$ ([[./figs/dvf_plant_coupling.png][png]], [[./figs/dvf_plant_coupling.pdf][pdf]])
[[file:figs/dvf_plant_coupling.png]]
** Effect of the Flexible Joint stiffness and Actuator amplification on the Dynamics
We add some stiffness and damping in the flexible joints and we re-identify the dynamics.
#+begin_src matlab
stewart = initializeJointDynamics(stewart, 'type_F', 'universal', 'type_M', 'spherical');
Gf = linearize(mdl, io, options);
Gf.InputName = {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'};
Gf.OutputName = {'Dm1', 'Dm2', 'Dm3', 'Dm4', 'Dm5', 'Dm6'};
#+end_src
We now use the amplified actuators and re-identify the dynamics
#+begin_src matlab
stewart = initializeAmplifiedStrutDynamics(stewart);
Ga = linearize(mdl, io, options);
Ga.InputName = {'F1', 'F2', 'F3', 'F4', 'F5', 'F6'};
Ga.OutputName = {'Dm1', 'Dm2', 'Dm3', 'Dm4', 'Dm5', 'Dm6'};
#+end_src
The new dynamics from force actuator to relative motion sensor is shown in Figure [[fig:dvf_plant_flexible_joint_decentralized]].
#+begin_src matlab :exports none
freqs = logspace(1, 4, 1000);
figure;
ax1 = subplot(2, 1, 1);
hold on;
plot(freqs, abs(squeeze(freqresp(G( 'Dm1', 'F1'), freqs, 'Hz'))));
plot(freqs, abs(squeeze(freqresp(Gf('Dm1', 'F1'), freqs, 'Hz'))));
plot(freqs, abs(squeeze(freqresp(Ga('Dm1', 'F1'), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('Amplitude [m/N]'); set(gca, 'XTickLabel',[]);
ax2 = subplot(2, 1, 2);
hold on;
plot(freqs, 180/pi*angle(squeeze(freqresp(G( 'Dm1', 'F1'), freqs, 'Hz'))), 'DisplayName', 'Perfect Joints');
plot(freqs, 180/pi*angle(squeeze(freqresp(Gf('Dm1', 'F1'), freqs, 'Hz'))), 'DisplayName', 'Flexible Joints');
plot(freqs, 180/pi*angle(squeeze(freqresp(Ga('Dm1', 'F1'), freqs, 'Hz'))), 'DisplayName', 'Amplified Actuators');
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
ylabel('Phase [deg]'); xlabel('Frequency [Hz]');
ylim([-180, 180]);
yticks([-180, -90, 0, 90, 180]);
legend('location', 'northeast');
linkaxes([ax1,ax2],'x');
#+end_src
#+header: :tangle no :exports results :results none :noweb yes
#+begin_src matlab :var filepath="figs/dvf_plant_flexible_joint_decentralized.pdf" :var figsize="full-tall" :post pdf2svg(file=*this*, ext="png")
<>
#+end_src
#+name: fig:dvf_plant_flexible_joint_decentralized
#+caption: Transfer function from the Actuator force $F_{i}$ to the relative displacement sensor $D_{m,i}$ ([[./figs/dvf_plant_flexible_joint_decentralized.png][png]], [[./figs/dvf_plant_flexible_joint_decentralized.pdf][pdf]])
[[file:figs/dvf_plant_flexible_joint_decentralized.png]]
** Obtained Damping
The control is a performed in a decentralized manner.
The $6 \times 6$ control is a diagonal matrix with pure derivative action on the diagonal:
\[ K(s) = g
\begin{bmatrix}
s & & \\
& \ddots & \\
& & s
\end{bmatrix} \]
The root locus is shown in figure [[fig:root_locus_dvf_rot_stiffness]].
#+begin_src matlab :exports none
gains = logspace(0, 5, 1000);
figure;
hold on;
plot(real(pole(G)), imag(pole(G)), 'x');
plot(real(pole(Gf)), imag(pole(Gf)), 'x');
plot(real(pole(Ga)), imag(pole(Gf)), 'x');
set(gca,'ColorOrderIndex',1);
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',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), '.');
end
ylim([0, 1.1*max(imag(pole(G)))]);
xlim([-1.1*max(imag(pole(G))),0]);
xlabel('Real Part')
ylabel('Imaginary Part')
axis square
legend([p1, p2, p3], {'Perfect Joints', 'Flexible Joints', 'Amplified Actuator'}, 'location', 'northwest');
#+end_src
#+header: :tangle no :exports results :results none :noweb yes
#+begin_src matlab :var filepath="figs/root_locus_dvf_rot_stiffness.pdf" :var figsize="wide-tall" :post pdf2svg(file=*this*, ext="png")
<>
#+end_src
#+name: fig:root_locus_dvf_rot_stiffness
#+caption: Root Locus plot with Direct Velocity Feedback when considering the Stiffness of flexible joints ([[./figs/root_locus_dvf_rot_stiffness.png][png]], [[./figs/root_locus_dvf_rot_stiffness.pdf][pdf]])
[[file:figs/root_locus_dvf_rot_stiffness.png]]
** Conclusion
#+begin_important
Joint stiffness does increase the resonance frequencies of the system but does not change the attainable damping when using relative motion sensors.
#+end_important
* Compliance and Transmissibility Comparison
** Introduction :ignore:
** Matlab Init :noexport:ignore:
#+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name)
<>
#+end_src
#+begin_src matlab :exports none :results silent :noweb yes
<>
#+end_src
#+begin_src matlab
simulinkproject('../');
#+end_src
#+begin_src matlab
open('stewart_platform_model.slx')
#+end_src
** Initialization
We first initialize the Stewart platform without joint stiffness.
#+begin_src matlab
stewart = initializeStewartPlatform();
stewart = initializeFramesPositions(stewart, 'H', 90e-3, 'MO_B', 45e-3);
stewart = generateGeneralConfiguration(stewart);
stewart = computeJointsPose(stewart);
stewart = initializeStrutDynamics(stewart);
stewart = initializeJointDynamics(stewart, 'type_F', 'universal_p', 'type_M', 'spherical_p');
stewart = initializeCylindricalPlatforms(stewart);
stewart = initializeCylindricalStruts(stewart);
stewart = computeJacobian(stewart);
stewart = initializeStewartPose(stewart);
stewart = initializeInertialSensor(stewart, 'type', 'none');
#+end_src
The rotation point of the ground is located at the origin of frame $\{A\}$.
#+begin_src matlab
ground = initializeGround('type', 'rigid', 'rot_point', stewart.platform_F.FO_A);
payload = initializePayload('type', 'none');
controller = initializeController('type', 'open-loop');
#+end_src
** Identification
Let's first identify the transmissibility and compliance in the open-loop case.
#+begin_src matlab
controller = initializeController('type', 'open-loop');
[T_ol, T_norm_ol, freqs] = computeTransmissibility();
[C_ol, C_norm_ol, freqs] = computeCompliance();
#+end_src
Now, let's identify the transmissibility and compliance for the Integral Force Feedback architecture.
#+begin_src matlab
controller = initializeController('type', 'iff');
K_iff = (1e4/s)*eye(6);
[T_iff, T_norm_iff, ~] = computeTransmissibility();
[C_iff, C_norm_iff, ~] = computeCompliance();
#+end_src
And for the Direct Velocity Feedback.
#+begin_src matlab
controller = initializeController('type', 'dvf');
K_dvf = 1e4*s/(1+s/2/pi/5000)*eye(6);
[T_dvf, T_norm_dvf, ~] = computeTransmissibility();
[C_dvf, C_norm_dvf, ~] = computeCompliance();
#+end_src
** Results
#+begin_src matlab :exports none
p_handle = zeros(6*6,1);
fig = figure;
for ix = 1:6
for iy = 1:6
p_handle((ix-1)*6 + iy) = subplot(6, 6, (ix-1)*6 + iy);
hold on;
set(gca,'ColorOrderIndex',1);
plot(freqs, abs(squeeze(freqresp(T_ol(ix, iy), freqs, 'Hz'))));
set(gca,'ColorOrderIndex',2);
plot(freqs, abs(squeeze(freqresp(T_iff(ix, iy), freqs, 'Hz'))));
set(gca,'ColorOrderIndex',3);
plot(freqs, abs(squeeze(freqresp(T_dvf(ix, iy), freqs, 'Hz'))));
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
if ix < 6
xticklabels({});
end
if iy > 1
yticklabels({});
end
end
end
linkaxes(p_handle, 'xy')
xlim([freqs(1), freqs(end)]);
han = axes(fig, 'visible', 'off');
han.XLabel.Visible = 'on';
han.YLabel.Visible = 'on';
xlabel(han, 'Frequency [Hz]');
ylabel(han, 'Transmissibility');
#+end_src
#+header: :tangle no :exports results :results none :noweb yes
#+begin_src matlab :var filepath="figs/transmissibility_iff_dvf.pdf" :var figsize="full-tall" :post pdf2svg(file=*this*, ext="png")
<>
#+end_src
#+name: fig:transmissibility_iff_dvf
#+caption: Obtained transmissibility for Open-Loop Control (Blue), Integral Force Feedback (Red) and Direct Velocity Feedback (Yellow) ([[./figs/transmissibility_iff_dvf.png][png]], [[./figs/transmissibility_iff_dvf.pdf][pdf]])
[[file:figs/transmissibility_iff_dvf.png]]
#+begin_src matlab :exports none
p_handle = zeros(6*6,1);
fig = figure;
for ix = 1:6
for iy = 1:6
p_handle((ix-1)*6 + iy) = subplot(6, 6, (ix-1)*6 + iy);
hold on;
set(gca,'ColorOrderIndex',1);
plot(freqs, abs(squeeze(freqresp(C_ol(ix, iy), freqs, 'Hz'))));
set(gca,'ColorOrderIndex',2);
plot(freqs, abs(squeeze(freqresp(C_iff(ix, iy), freqs, 'Hz'))));
set(gca,'ColorOrderIndex',3);
plot(freqs, abs(squeeze(freqresp(C_dvf(ix, iy), freqs, 'Hz'))));
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
if ix < 6
xticklabels({});
end
if iy > 1
yticklabels({});
end
end
end
linkaxes(p_handle, 'xy')
xlim([freqs(1), freqs(end)]);
han = axes(fig, 'visible', 'off');
han.XLabel.Visible = 'on';
han.YLabel.Visible = 'on';
xlabel(han, 'Frequency [Hz]');
ylabel(han, 'Compliance');
#+end_src
#+header: :tangle no :exports results :results none :noweb yes
#+begin_src matlab :var filepath="figs/compliance_iff_dvf.pdf" :var figsize="full-tall" :post pdf2svg(file=*this*, ext="png")
<>
#+end_src
#+name: fig:compliance_iff_dvf
#+caption: Obtained compliance for Open-Loop Control (Blue), Integral Force Feedback (Red) and Direct Velocity Feedback (Yellow) ([[./figs/compliance_iff_dvf.png][png]], [[./figs/compliance_iff_dvf.pdf][pdf]])
[[file:figs/compliance_iff_dvf.png]]
#+begin_src matlab :exports none
figure;
subplot(1,2,1);
hold on;
plot(freqs, T_norm_ol)
plot(freqs, T_norm_iff)
plot(freqs, T_norm_dvf)
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]');
ylabel('Transmissibility - Frobenius Norm');
subplot(1,2,2);
hold on;
plot(freqs, C_norm_ol, 'DisplayName', 'OL')
plot(freqs, C_norm_iff, 'DisplayName', 'IFF')
plot(freqs, C_norm_dvf, 'DisplayName', 'DVF')
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]');
ylabel('Compliance - Frobenius Norm');
legend();
#+end_src
#+header: :tangle no :exports results :results none :noweb yes
#+begin_src matlab :var filepath="figs/frobenius_norm_T_C_iff_dvf.pdf" :var figsize="full-tall" :post pdf2svg(file=*this*, ext="png")
<>
#+end_src
#+name: fig:frobenius_norm_T_C_iff_dvf
#+caption: Frobenius norm of the Transmissibility and Compliance Matrices ([[./figs/frobenius_norm_T_C_iff_dvf.png][png]], [[./figs/frobenius_norm_T_C_iff_dvf.pdf][pdf]])
[[file:figs/frobenius_norm_T_C_iff_dvf.png]]