Tangle Matlab files without comments

This commit is contained in:
Thomas Dehaeze 2025-03-28 16:44:49 +01:00
parent f0d3b25e48
commit 59494b410b
4 changed files with 18 additions and 138 deletions

View File

@ -10,17 +10,6 @@ addpath('./mat/'); % Path for data
%% Colors for the figures
colors = colororder;
% Measurement Results
% The specified flexible beam thickness (gap) is $250\,\mu m$.
% Four gaps are measured for each flexible joints (2 in the $x$ direction and 2 in the $y$ direction).
% The "beam thickness" is then estimated to be the mean between the gaps measured on opposite sides.
% An histogram of the measured beam thicknesses is shown in Figure ref:fig:test_joints_size_hist.
% The measured thickness is less thant the specified value of $250\,\mu m$, but this optical method may not be very accurate as the estimated gap can depend on the lighting of the part and of its proper alignment.
% However, what is more important than the true value of the thickness is the consistency between all the flexible joints.
%% Measured gap for the 16 flexible joints
meas_flex = [[223, 226, 224, 214];
[229, 231, 237, 224];

View File

@ -10,12 +10,6 @@ addpath('./mat/'); % Path for data
%% Colors for the figures
colors = colororder;
% Required external applied force
% The bending stiffness is foreseen to be $k_{R_y} \approx k_{R_x} \approx 5\,\frac{Nm}{rad}$ and its stroke $\theta_{y,\text{max}}\approx \theta_{x,\text{max}}\approx 25\,mrad$.
% The height between the flexible point (center of the joint) and the point where external forces are applied is $h = 22.5\,mm$ (see Figure ref:fig:test_joints_bench_working_principle).
%% Parameters for study
kRx = 5; % Bending Stiffness [Nm/rad]
Rxmax = 25e-3; % Bending Stroke [rad]
@ -24,50 +18,9 @@ h = 22.5e-3; % Height [m]
%% Estimation of the force to test the full stroke
Fxmax = kRx*Rxmax/h; % Force to induce maximum stroke [N]
% Required actuator stroke and sensors range
% The flexible joint is designed to allow a bending motion of $\pm 25\,mrad$.
% The corresponding stroke at the location of the force sensor is given by eqref:eq:test_joints_max_stroke.
% In order to test the full range of the flexible joint, the means of applying a force (explained in the next section) should allow a motion of at least $0.5\,mm$.
% Similarly, the measurement range of the displacement sensor should also be higher than $0.5\,mm$.
% \begin{equation}\label{eq:test_joints_max_stroke}
% d_{x,\text{max}} = h \tan(R_{x,\text{max}}) \approx 0.5\,mm
% \end{equation}
%% Estimated maximum stroke [m]
dxmax = h*tan(Rxmax);
% Introduction :ignore:
% In order to estimate the accuracy of the measured bending stiffness that can be obtained using this measurement bench, an error budget is performed.
% Based on equation eqref:eq:test_joints_stiff_displ_force, several errors can impact the accuracy of the measured bending stiffness:
% - Errors in the measured torque $M_x, M_y$: this is mainly due to inaccuracies of the load cell and of the height estimation $h$
% - Errors in the measured bending motion of the flexible joints $\theta_x, \theta_y$: errors from limited shear stiffness, from the deflection of the load cell itself, and from inaccuracy of the height estimation $h$
% Let's first estimate the displacement induced only by the bending stiffness.
% \begin{equation}\label{eq:test_joints_dbx}
% d_{x,b} = h \tan(\theta_y) = h \tan\left( \frac{F_x \cdot h}{k_{R_y}} \right)
% \end{equation}
% # From equation eqref:eq:test_joints_dbx, we can compute the bending stiffness:
% # \begin{equation}
% # k_{R_y} = \frac{F_x \cdot h}{\tan^{-1}\left( \frac{D_b}{h} \right)}
% # \end{equation}
% # For small displacement, we have
% # \begin{equation}
% # \boxed{k_{R_y} \approx h^2 \frac{F_x}{d_x}}
% # \end{equation}
% # And therefore, to precisely measure $k_{R_y}$, we need to:
% # - precisely measure the motion $d_x$
% # - precisely measure the applied force $F_x$
% # - precisely now the height of the force application point $h$
%% Stiffness
ka = 94e6; % Axial Stiffness [N/m]
ks = 13e6; % Shear Stiffness [N/m]
@ -89,44 +42,9 @@ Xt = Ft/kt; % Torsional Stroke before yield [rad]
%% Height between the joint's center and the force application point
h = 22.5e-3; % [m]
% Effect of Shear
% The applied force $F_x$ will induce some shear $d_{x,s}$ which is described by eqref:eq:test_joints_shear_displ with $k_s$ the shear stiffness of the flexible joint.
% \begin{equation}\label{eq:test_joints_shear_displ}
% d_{x,s} = \frac{F_x}{k_s}
% \end{equation}
% The measured displacement $d_x$ is affected by the shear as shown in equation eqref:eq:test_joints_displ_shear.
% \begin{equation}\label{eq:test_joints_displ_shear}
% d_x = d_{x,b} + d_{x,s} = h \tan\left( \frac{F_x \cdot h}{k_{R_y}} \right) + \frac{F_x}{k_s} \approx F_x \left( \frac{h^2}{k_{R_y}} + \frac{1}{k_s} \right)
% \end{equation}
% The estimated bending stiffness $k_{\text{est}}$ then depends on the shear stiffness eqref:eq:test_joints_error_shear.
% \begin{equation}\label{eq:test_joints_error_shear}
% k_{R_y,\text{est}} = h^2 \frac{F_x}{d_x} \approx k_{R_y} \frac{1}{1 + \frac{k_{R_y}}{k_s h^2}} \approx k_{R_y} \Bigl( 1 - \underbrace{\frac{k_{R_y}}{k_s h^2}}_{\epsilon_{s}} \Bigl)
% \end{equation}
% With an estimated shear stiffness $k_s = 13\,N/\mu m$ from the finite element model and an height $h=25\,mm$, the estimation errors of the bending stiffness due to shear is $\epsilon_s < 0.1\,\%$
%% Estimated error due to shear
epsilon_s = 100*abs(1-1/(1 + kb/(ks*h^2))); % Error in %
% Effect of load cell limited stiffness
% As explained in the previous section, because the measurement of the flexible joint deflection is indirectly made with the encoder, errors will be made if the load cell experiences some compression.
% Suppose the load cell has an internal stiffness $k_f$, the same reasoning that was made for the effect of shear can be applied here.
% The estimation error of the bending stiffness due to the limited stiffness of the load cell is then described by eqref:eq:test_joints_error_load_cell_stiffness.
% \begin{equation}\label{eq:test_joints_error_load_cell_stiffness}
% k_{R_y,\text{est}} = h^2 \frac{F_x}{d_x} \approx k_{R_y} \frac{1}{1 + \frac{k_{R_y}}{k_F h^2}} \approx k_{R_y} \Bigl( 1 - \underbrace{\frac{k_{R_y}}{k_F h^2}}_{\epsilon_f} \Bigl)
% \end{equation}
% With an estimated load cell stiffness of $k_f \approx 1\,N/\mu m$ (from the documentation), the errors due to the load cell limited stiffness is around $\epsilon_f = 1\,\%$.
%% Estimated error due to limited load cell stiffness
kF = 50/0.05e-3; % Estimated load cell stiffness [N/m]
epsilon_f = 100*abs(1-1/(1 + kb/(kF*h^2))); % Error in %

View File

@ -10,16 +10,6 @@ addpath('./mat/'); % Path for data
%% Colors for the figures
colors = colororder;
% Load Cell Calibration
% In order to estimate the measured errors of the load cell "FC2231", it is compared against another load cell[fn:5].
% The two load cells are measured simultaneously while they are pushed against each other (see Figure ref:fig:test_joints_force_sensor_calib_picture).
% The contact between the two load cells is well defined as one has a spherical interface while the other has a flat surface.
% The measured forces are compared in Figure ref:fig:test_joints_force_sensor_calib_fit.
% The gain mismatch between the two load cells is approximately $4\,\%$ which is higher than what was specified in the data-sheets.
% However, the estimated non-linearity is bellow $1\,\%$ for forces between $0.5\,N$ and $5\,N$.
%% Force Sensor Calibration
% Load measurement data
load('calibration_force_sensor.mat', 't', 'F', 'Fc')
@ -29,8 +19,9 @@ F = F - mean(F( t > 0.5 & t < 1.0)); % FC2231 [N]
Fc = Fc - mean(Fc(t > 0.5 & t < 1.0)); % XFL212R [N]
% Only get useful stroke
F = F( t > 1.55 & t < 2.4);
Fc = Fc(t > 1.55 & t < 2.4);
F = F( t > 2 & t < 2.2);
Fc = Fc(t > 2 & t < 2.2);
t = t( t > 2 & t < 2.2);
% Make a line fit
fit_F = polyfit(Fc, F, 1);
@ -39,25 +30,27 @@ fit_F = polyfit(Fc, F, 1);
F_gain_mismatch = 100*(1 - fit_F(1)); % in %
% Estimate non-linearity of the sensors
F_non_linearity = 100*(F - (Fc*fit_F(1) + fit_F(2)))./F; % in %
F_non_linearity = 100*(F - (Fc*fit_F(1) + fit_F(2)))./Fc; % in %
%% Measured two forces and linear fit
figure;
yyaxis left
hold on;
plot(Fc, F, 'k-', 'DisplayName', 'Raw Data');
plot(Fc([1,end]), Fc([1,end])*fit_F(1) + fit_F(2), '--', 'DisplayName', 'Line Fit');
plot(Fc, F, '.', 'DisplayName', 'Raw Data');
plot([0, 6], [0,6]*fit_F(1) + fit_F(2), '-', 'color', [colors(3,:), 0.5], 'DisplayName', 'Line Fit');
hold off;
xlabel('XFL212R [N]'); ylabel('FC2231 [N]');
xlim([0.5,5.5]); ylim([0.5,5.5]);
legend('location', 'southeast', 'FontSize', 8);
xlim([0,6]); ylim([0,6]);
xticks([0:6])
yticks([0:6])
% Load Cell Stiffness
% The objective of this measurement is to estimate the stiffness $k_F$ of the force sensor.
% To do so, a stiff element (much stiffer than the estimated $k_F \approx 1\,N/\mu m$) is fixed in front of the force sensor as shown in Figure ref:fig:test_joints_meas_force_sensor_stiffness_picture.
% Then, the force sensor is pushed again this stiff element while the force and the encoder displacement are measured.
% Measured displacement as a function of the force is shown in Figure ref:fig:test_joints_force_sensor_stiffness_fit.
% The load cell stiffness can then be estimated by computing a linear fit, and is found to be $k_F \approx 0.75\,N/\mu m$.
yyaxis right
plot(Fc, movmean(F_non_linearity, 200), '-', 'DisplayName', 'Non linearity');
ylim([-0.15, 0.15]);
ylabel('Non Linearity [$\%$]')
leg = legend('location', 'southeast', 'FontSize', 8, 'NumColumns', 1);
leg.ItemTokenSize(1) = 15;
%% Estimaetd load cell stiffness
% Load measurement data
@ -72,7 +65,7 @@ d = d( t > 4.55 & t < 7.24); d = d - d(1);
t = t( t > 4.55 & t < 7.24);
% Linear fit
fit_k = polyfit(F, d, 1);
fit_k = polyfit(F(F<10), d(F<10), 1);
%% Displacement as a function of the measured force
figure;
@ -84,17 +77,6 @@ xlabel('Force [$N$]'); ylabel('Displacement [$\mu m$]');
xlim([0,45]); ylim([0,60]);
legend('location', 'southeast', 'FontSize', 8);
% Bending Stiffness estimation
% The actual stiffness measurement in now performed by manually moving the translation stage from a start position where the force sensor is not yet in contact with the flexible joint to a position where flexible joint is on its mechanical stop.
% The measured force and displacement as a function of time are shown in Figure ref:fig:test_joints_meas_bend_time.
% Three regions can be observed: first the force sensor tip is not in contact with the flexible joint and the measured force is zero, then the flexible joint deforms linearly, finally the flexible joint comes in contact with the mechanical stops.
% The angular motion $\theta_{y}$ computed from the displacement $d_x$ is displacement as function of the measured torque $T_{y}$ in displayed in Figure ref:fig:test_joints_meas_F_d_lin_fit.
% The bending stiffness of the flexible joint can be estimated by computing the slope of the curve in the linear regime (red dashed line) and is found to be $k_{R_y} = 4.4\,Nm/\text{rad}$.
% The bending stroke can also be estimated as shown in Figure ref:fig:test_joints_meas_F_d_lin_fit and is found to be $\theta_{y,\text{max}} = 20.9\,\text{mrad}$.
%% Estimate the bending stiffness and stroke from the measurement - First Flexible joint
% Load Measured Data for first flexible joint
load('meas_stiff_flex_1_x.mat', 't', 'F', 'd');
@ -189,15 +171,6 @@ ylim([-5,25]);
leg = legend('location', 'southeast', 'FontSize', 8);
leg.ItemTokenSize(1) = 15;
% Measured flexible joint stiffnesses
% The same measurement is performed for all the 16 flexible joints, both in the $x$ and $y$ directions.
% The measured angular motion as a function of the applied torque are shown in Figure ref:fig:test_joints_meas_bending_all_raw_data for all the 16 flexible joints.
% This gives a first idea of the dispersion of the measured bending stiffnesses (i.e. slope of the linear region) and of the angular stroke.
% An histogram of the measured bending stiffnesses is show in Figure ref:fig:test_joints_bend_stiff_hist.
% Most of the bending stiffnesses are between $4.6\,Nm/rad$ and $5.0\,Nm/rad$.
%% Measure the bending stiffness and Stroke for all the flexible joints
figure;
hold on;

View File

@ -22,7 +22,7 @@
#+BIND: org-latex-bib-compiler "biber"
#+PROPERTY: header-args:matlab :session *MATLAB*
#+PROPERTY: header-args:matlab+ :comments org
#+PROPERTY: header-args:matlab+ :comments no
#+PROPERTY: header-args:matlab+ :exports none
#+PROPERTY: header-args:matlab+ :results none
#+PROPERTY: header-args:matlab+ :eval no-export