forked from KULeuvenNeuromechanics/PredSim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparametricAFO.m
More file actions
51 lines (45 loc) · 1.7 KB
/
parametricAFO.m
File metadata and controls
51 lines (45 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
function [AFO] = parametricAFO(init, settings_orthosis)
% --------------------------------------------------------------------------
% parametricAFO
% Defines an ankle-foot orthosis as a rotational spring on the ankle angle
% and a rotational spring on the MTP angle. Each spring is defined by a
% stiffness constant.
%
%
% INPUT:
% - init -
% * struct with information used to initialise the Orthosis object.
%
% - settings_orthosis -
% * struct with information about this orthosis, containing the fields:
% - function_name = 'parametricAFO' i.e. name of this function
% - ankle_stiffness: ankle stiffness in Nm/rad
% - mtp_stiffness: mtp stiffness in Nm/rad
% - left_right: 'l' for left or 'r' for right
% Values are set via S.orthosis.settings{i} in main.m, with i the index
% of the orthosis.
%
%
% OUTPUT:
% - AFO -
% * an object of the class Orthosis
%
% Original author: Lars D'Hondt
% Original date: 5/January/2024
% --------------------------------------------------------------------------
% create Orthosis object
AFO = Orthosis('AFO',init);
% read settings that were passed from main.m
k_ankle = settings_orthosis.ankle_stiffness; % ankle stiffness in Nm/rad
k_mtp = settings_orthosis.mtp_stiffness; % mtp stiffness in Nm/rad
side = settings_orthosis.left_right; % 'l' for left or 'r' for right
% get joint angles
q_ankle = AFO.var_coord(['ankle_angle_',side]); % ankle angle in rad;
q_mtp = AFO.var_coord(['mtp_angle_',side]); % MTP angle in rad;
% calculate moments
T_ankle = -k_ankle*q_ankle;
T_mtp = -k_mtp*q_mtp;
% add calculated moments to Orthosis
AFO.addCoordForce(T_ankle, ['ankle_angle_',side])
AFO.addCoordForce(T_mtp, ['mtp_angle_',side])
end