Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
d2f28e7
Making STA compensation code more robust
RouvierT Apr 4, 2022
900cad8
Constrained velocities and accelerations
LivetClr Apr 25, 2022
ef82f97
Gaining some computation time
LivetClr May 19, 2022
a270d90
Minor bug fix
LivetClr May 19, 2022
c4589e7
Computational gain for explicit constraints
LivetClr May 19, 2022
408957a
Computation time gain
LivetClr Jun 2, 2022
ad5045f
Still improving computation time
LivetClr Jun 3, 2022
9b77f6b
Making compatible version for R2022a
LivetClr Jun 14, 2022
8356a16
To continue for R2022a
LivetClr Jun 14, 2022
bc3cb8f
Some bug fix
LivetClr Jun 14, 2022
fc37611
Wheelchair forces & Shoulder Node in Thorax in closed loop shoulder m…
RouvierT Jun 20, 2022
149bb4e
bug fix
RouvierT Jun 20, 2022
d859620
Added acromion markers position in thorax anatomical frame for closed…
RouvierT Jun 21, 2022
20b9395
Some improvments in computation time
LivetClr Jun 24, 2022
944ccef
Merge remote-tracking branch 'origin/Dev_ClosedLoop' into Dev_ClosedLoop
LivetClr Jun 24, 2022
61fae00
Correction of bug in Thorax_Shoulder model
RouvierT Jul 26, 2022
92a6588
Update to tangency Shoulder model
RouvierT Jul 26, 2022
6bfa2f4
Correct InverseKinematics file
LivetClr Jul 28, 2022
c91b047
Update to calibration of tangent shoulder model
RouvierT Aug 2, 2022
9e2c50d
Adequate file for InverseKinematicsLM
LivetClr Aug 2, 2022
e0748af
Minor bug fix
LivetClr Aug 2, 2022
44ec0ee
Mini bug fix - still bugged
RouvierT Aug 5, 2022
9a044a4
Minor bug fix again
LivetClr Aug 8, 2022
6d79c48
Minor bug fix continues
LivetClr Aug 8, 2022
6b911db
Cleaning code
LivetClr Aug 8, 2022
1980718
correction to tangent model
RouvierT Aug 8, 2022
24a1017
Merge branch 'Dev_ClosedLoop' of https://github.com/anmuller/CusToM i…
RouvierT Aug 8, 2022
fa916ac
bug fix
RouvierT Aug 8, 2022
a98379d
Shoulder tangency model reworked : now better than seth
RouvierT Aug 10, 2022
2ceb3b1
Bug fixing in kinematic dependancy
RouvierT Aug 17, 2022
f354d9c
small updates to rodrigues
RouvierT Feb 1, 2023
06cfd06
Debugging of rodrigues and uppertrunkclavicle model
RouvierT Mar 21, 2023
20e09ee
bug correction
RouvierT Apr 5, 2023
55bcdce
Correction to ID
RouvierT Apr 11, 2023
2380c72
correction to shoulder model
RouvierT Apr 11, 2023
1e76178
Update to arm model (Holzbaur 2005)
RouvierT Apr 12, 2023
7445157
update to calibration weights
RouvierT Apr 12, 2023
df8ff22
Update to geometrical calibration
RouvierT Apr 13, 2023
3314d6b
update to weights
RouvierT Apr 13, 2023
8349cd1
Update to Calibration method
RouvierT Apr 14, 2023
e346841
update to calibration and ik lm
RouvierT Apr 15, 2023
28a2ab9
post thesis update
RouvierT Jul 27, 2023
3b7a565
added scaploc to both shoulders option
RouvierT Sep 6, 2023
11825ad
Update to scapula gliding plane contraints
RouvierT Sep 7, 2023
3bec041
Bug correction
RouvierT Sep 13, 2023
64e3ce1
Bug correction in Inverse Kinematics
RouvierT Sep 21, 2023
a1755a4
Bug correction
RouvierT Sep 22, 2023
f0013f4
Update README.md
cpontonn Feb 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
3 changes: 1 addition & 2 deletions Functions/AlgoMathsModel/Rodrigues.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
ap=[0 -a(3) a(2);...
a(3) 0 -a(1);...
-a(2) a(1) 0];
R=[1 0 0;0 1 0;0 0 1]+ap*sin(q)+ap*ap*(1-cos(q));
R=[1 0 0;0 1 0;0 0 1]+ap.*sin(q)+pagemtimes(ap,ap).*(1-cos(q));
end

end
8 changes: 4 additions & 4 deletions Functions/Animation/DataExtractionForAnimation.m
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@
q=q_complet(1:end-6);
end
else
if isfield(BiomechanicalModel,'ClosedLoopData')
[~,q] = ForwardKinematicsConstrained(BiomechanicalModel,q);
q = q(1:end-6);
end
% if isfield(BiomechanicalModel,'ClosedLoopData')
% [~,q] = ForwardKinematicsConstrained(BiomechanicalModel,q);
% q = q(1:end-6);
% end
end


Expand Down
6 changes: 3 additions & 3 deletions Functions/Calibration/CalibrateModelGenerationNum.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
%% Symbolic functions
disp('Preliminary Computations ...')
[BiomechanicalModel.OsteoArticularModel] = Add6dof(BiomechanicalModel.OsteoArticularModel);
[BiomechanicalModel.OsteoArticularModel, ...
BiomechanicalModel.Generalized_Coordinates] = SymbolicFunctionGenerationIK(BiomechanicalModel.OsteoArticularModel,BiomechanicalModel.Markers);
[BiomechanicalModel.OsteoArticularModel, BiomechanicalModel.Jacob, ...
BiomechanicalModel.Generalized_Coordinates] = SymbolicFunctionGenerationIK(BiomechanicalModel.OsteoArticularModel,BiomechanicalModel.Markers,BiomechanicalModel.GeometricalCalibration.radius);
disp('... Preliminary Computations done')

%% Inertial calibration
Expand Down Expand Up @@ -121,7 +121,7 @@

%% Closedloop equations
disp('Closed loop equations ...')
BiomechanicalModel = AddClosedLoopEquations(BiomechanicalModel);
BiomechanicalModel = AddClosedLoopEquations(BiomechanicalModel,BiomechanicalModel.GeometricalCalibration.radius);
disp('... Closed loop equations done')

save('BiomechanicalModel','BiomechanicalModel');
Expand Down
7 changes: 3 additions & 4 deletions Functions/Calibration/Geometrical/CostFunctionLMCalib.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@
fonc = hclosedloophandle{k};
constraints = [constraints ; fonc(q)];
end

dX = weights.*ik_function_objective(q);

func = [ dX ; gamma*constraints ; zeta*hbutees(q)];
newweights= repmat(weights,3,1);
dX = newweights(:).*ik_function_objective(q);
func = [ dX ; gamma*constraints(:) ; zeta*hbutees(q)];

end
2 changes: 2 additions & 0 deletions Functions/Calibration/Geometrical/CostFunctionSymbolicCalib.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
(Pelvis_position,Pelvis_rotation,q,k,...
pcut,Rcut) - real_markers(m).position(f,:)') ;
end


W=diag(weights);
error=e'*W*e;

Expand Down
41 changes: 41 additions & 0 deletions Functions/Calibration/Geometrical/ErrorMarkersCalibLM.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
function [error] = ErrorMarkersCalibLM(q,k,real_markers,f,list_markers,Pelvis_position,Pelvis_rotation,Rcut,pcut,nbcut,list_function)

% Computation of reconstruction error for the geometrical calibration
% Computation of the distance between the position of each experimental
% marker and the position of the corresponded model marker
%
% INPUT
% - q: vector of joint coordinates at a given instant
% - k: vector of homothety coefficient
% - Pelvis_position: position of the pelvis at the considered instant
% - Pelvis_rotation: rotation of the pelvis at the considered instant
% - positions : matrix of experimental marker positions
% OUTPUT
% - error: distance between the position of each experimental marker and
% the position of the corresponded model marker
%________________________________________________________
%
% Licence
% Toolbox distributed under GPL 3.0 Licence
%________________________________________________________
%
% Authors : Antoine Muller, Charles Pontonnier, Pierre Puchaud and
% Georges Dumont
%________________________________________________________



for c=1:nbcut
if c==1
[Rcut(:,:,c),pcut(:,:,c)]=list_function{c}(Pelvis_position,Pelvis_rotation,q,k,[],[]);
else
[Rcut(:,:,c),pcut(:,:,c)]=list_function{c}(Pelvis_position,Pelvis_rotation,q,k,pcut,Rcut);
end
end
error=zeros(3*numel(list_markers),1);
for m=1:numel(list_markers)
error(1+3*(m-1):3+3*(m-1),:) = ( list_markers{m}...
(Pelvis_position,Pelvis_rotation,q,k,...
pcut,Rcut) - real_markers(m).position(f,:)');
end
end
40 changes: 19 additions & 21 deletions Functions/Calibration/Geometrical/GeomCalibOptimization.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

nonlcon=@(qvar)ClosedLoopCalib(Base_position{f},Base_rotation{f},qvar,k_init); % testé!

options1 = optimoptions(@fmincon,'Algorithm','interior-point','Display','off','TolFun',1e-2,'MaxFunEvals',2e5,'MaxIter',2e5);
options1 = optimoptions(@fmincon,'Algorithm','interior-point','Display','off','TolFun',1e-4,'MaxFunEvals',2e5,'MaxIter',2e5);
options2 = optimoptions(@fmincon,'Algorithm','interior-point','Display','off','TolFun',1e-6,'MaxFunEvals',2e9,'MaxIter',2e9);
h = waitbar(0,['First iteration of Inverse Kinematics']);

[q_value{1}(:,f)] = fmincon(ik_function_objective,q0,[],[],Aeq_ik,beq_ik,l_inf,l_sup,nonlcon,options1);

Expand All @@ -20,19 +21,21 @@
buteehandle = @(q) Limits(q,l_inf,l_sup);
gamma = 150;
zeta = 20;

q0 = q_value{1}(:,f);

parfor f = 1:nb_frame_calib

ik_function_objective=@(qvar) ErrorMarkersCalib(qvar,k_init,real_markers_calib,f,list_function_markers,Base_position{f},Base_rotation{f},Rcut,pcut,nbcut,list_function);
waitbar(f/nb_frame_calib)
q_inter = zeros(Nb_qred,nb_frame_calib);
ik_function_objective=@(qvar) ErrorMarkersCalibLM(qvar,k_init,real_markers_calib,f,list_function_markers,Base_position{f},Base_rotation{f},Rcut,pcut,nbcut,list_function);
hclosedloophandle = {@(qvar)ClosedLoopCalib(Base_position{f},Base_rotation{f},qvar,k_init); @(x) Aeq_ik*x - beq_ik} ;
fun = @(q) CostFunctionLMCalib(q,ik_function_objective,gamma,hclosedloophandle,zeta,buteehandle,weights);
[q_inter(:,f)] = lsqnonlin(fun,q_inter(:,f),[],[],optionsLM);
for f = 2:nb_frame_calib
ik_function_objective=@(qvar) ErrorMarkersCalibLM(qvar,k_init,real_markers_calib,f,list_function_markers,Base_position{f},Base_rotation{f},Rcut,pcut,nbcut,list_function);
hclosedloophandle = {@(qvar)ClosedLoopCalib(Base_position{f},Base_rotation{f},qvar,k_init); @(x) Aeq_ik*x - beq_ik} ;

fun = @(q) CostFunctionLMCalib(q,ik_function_objective,gamma,hclosedloophandle,zeta,buteehandle,weights);

[q_inter(:,f)] = lsqnonlin(fun,q0,[],[],optionsLM);
[q_inter(:,f)] = lsqnonlin(fun,q_inter(:,f-1),[],[],optionsLM);
waitbar(f/nb_frame_calib)
end
q_value{1}(:,2:nb_frame_calib) = q_inter(:,2:nb_frame_calib);
q_value{1}= q_inter;
close(h)


% Error computation
Expand Down Expand Up @@ -63,30 +66,25 @@
[kp_opt(:,g+1)] = fmincon(pk_function_objective,kp_opt(:,g),[],[],Aeq_calib,beq_calib,limit_inf_calib,limit_sup_calib,[],options2);

q_value{g+1}=zeros(size(q_value{g})); %#ok<AGROW>

q_inter=q_value{g};
% Articular coordinates optimisation

q0=q_value{g}(:,f);
kp_g = kp_opt(:,g+1);
parfor f =1:nb_frame_calib

ik_function_objective=@(qvar) ErrorMarkersCalib(qvar,kp_g,real_markers_calib,f,list_function_markers,Base_position{f},Base_rotation{f},Rcut,pcut,nbcut,list_function);
ik_function_objective=@(qvar) ErrorMarkersCalibLM(qvar,kp_g,real_markers_calib,f,list_function_markers,Base_position{f},Base_rotation{f},Rcut,pcut,nbcut,list_function);

hclosedloophandle = {@(qvar)ClosedLoopCalib(Base_position{f},Base_rotation{f},qvar,kp_g); @(x) Aeq_ik*x - beq_ik} ;

fun = @(q) CostFunctionLMCalib(q,ik_function_objective,gamma,hclosedloophandle,zeta,buteehandle,weights);
[q_inter(:,f)] = lsqnonlin(fun,q0,[],[],optionsLM);


[q_inter(:,f)] = lsqnonlin(fun,q_inter(:,f),[],[],optionsLM);
end
q_value{g+1} = q_inter;

% Error computation
errorm{g+1}=zeros(length(real_markers_calib),nb_frame_calib); %#ok<AGROW>
for f=1:nb_frame_calib

[errorm{g+1}(:,f)] = ErrorMarkersCalib(q_value{g+1}(:,f),kp_opt(:,g+1),real_markers_calib,f,list_function_markers,Base_position{f},Base_rotation{f},Rcut,pcut,nbcut,list_function);

temp = weights.*ErrorMarkersCalib(q_value{g+1}(:,f),kp_opt(:,g+1),real_markers_calib,f,list_function_markers,Base_position{f},Base_rotation{f},Rcut,pcut,nbcut,list_function);
[errorm{g+1}(:,f)] = temp(weights~=0);
end

% Stop criteria
Expand Down
Loading