pycapacity.human moduleο
Overviewο
This is a python module which implements different human performance metrics based on their musculoskeletal models
- pycapacity.human.acceleration_ellipsoid(J, M, N, F_max)[source]ο
Human musculoskeletal acceleration ellipsoid calculation (dynamic manipulability ellipsoid)
\[E_a = \{\ddot{x}~ |~ \ddot{x} = JM^{-1}NF, \quad ||W^{-1}F|| \leq 1\}\]where
\[W=diag(F_{max})\]- Parameters:
J β matrix jacobian
M β matrix inertia
N β moment arm matrix
F_max β maximal muscular forces
- Returns:
ellipsoid object with the following attributes
radii,axes- Return type:
ellipsoid(Ellipsoid)
- pycapacity.human.acceleration_polytope(J, N, M, F_min, F_max, tol=1e-05, options=None)[source]ο
A function calculating the polytopes of achievable accelerations based on the jacobian matrix J, moment arm matrix N and mass matrix M
\[P_{a} = \{ \ddot{x} ~ | ~ \ddot{x} = JM^{-1}NF, \quad F_{min} \leq F \leq F_{max}\}\]Based on the
hyper_plane_shifting_methodalgorithm (default) or theiterative_convex_hull_methodalgorithm (options[βalgorithmβ] = βichmβ).- Parameters:
J β jacobian matrix
N β moment arm matrix
M β mass matrix
F_min β minimal muscular forces (passive forces or 0)
F_max β maximal isometric forces
tolerance β tolerance for the polytope calculation
options β dictionary of options for the polytope calculation (currently supported options are
calculate_facesandalgorithm)
- Returns:
polytope object with the following attributes
vertices, half-plane representationH,d, (andface_indicesandfacesif optioncalculate_facesis set toTrue)- Return type:
poly(Polytope)
- pycapacity.human.force_ellipsoid(J, N, F_max)[source]ο
Human musculoskeletal force ellipsoid calculation
\[E_f = \{f~ |~ NF = J^Tf,\quad ||W^{-1}F|| \leq 1\}\]where
\[W=diag(F_{max})\]- Parameters:
J β matrix jacobian
N β moment arm matrix
F_max β maximal muscular forces
- Returns:
ellipsoid object with the following attributes
radii,axes- Return type:
ellipsoid(Ellipsoid)
- pycapacity.human.force_polytope(J, N, F_min, F_max, tol, torque_bias=None, options=None)[source]ο
A function calculating the polytopes of achievable forces based on the jacobian matrix J and moment arm matrix N
\[P_{f} = \{ f ~ | ~ J^Tf = NF, \quad F_{min} \leq F \leq F_{max}\}\]optionally an additional bias \(\tau_{bias}\) can be added
\[P_{f} = \{ f ~ | ~ J^Tf = NF + \tau_{bias}, \quad F_{min} \leq F \leq F_{max}\}\]Based on the
iterative_convex_hull_methodalgorithm.- Parameters:
J β jacobian matrix
N β moment arm matrix
F_min β minimal muscular forces (passive forces or 0)
F_max β maximal isometric forces
tolerance β tolerance for the polytope calculation
torque_bias β torque bias optional (gravity or movement or applied forces β¦.)
options β dictionary of options for the polytope calculation (currently only
calculate_facesis supported)
- Returns:
polytope object with the following attributes
vertices, torque verticestorque_vertices, muscle force verticesmuscle_force_vertices, half-plane representationH,d, (andface_indicesandfacesif optioncalculate_facesis set toTrue)- Return type:
polytope(Polytope)
- pycapacity.human.joint_torques_polytope(N, F_min, F_max, tol=1e-05, options=None)[source]ο
A function calculating the polytopes of achievable joint torques based on the moment arm matrix N :
\[P_{t} = \{ \tau ~ | ~ \tau= NF, \quad F_{min} \leq F \leq F_{max}\}\]Based on the
hyper_plane_shifting_methodalgorithm.- Parameters:
N β moment arm matrix
F_min β minimal muscular forces (passive forces or 0)
F_max β maximal isometric forces
tolerance β tolerance for the polytope calculation
options β dictionary of options for the polytope calculation (currently only
calculate_facesis supported)
- Returns:
polytope object with the following attributes
vertices, half-plane representationH,d, (andface_indicesandfacesif optioncalculate_facesis set toTrue)- Return type:
poly(Polytope)
- pycapacity.human.torque_to_muscle_force(N, F_min, F_max, tau, options='lp')[source]ο
A function calculating muscle forces needed to create the joint torques tau. It uses either the linear programming or quadratic programming, set with the
optionsparameter.The quadratic programming problem is formulated as:
\[F = \text{arg}\min_F ||F||^2 \quad s.t. \quad N^TF = \tau, \quad F_{min} \leq F \leq F_{max}\]The linear programming problem is formulated as:
\[F = \text{arg}\min_F \sum_i \frac{1}{F_{max,i} - F_{min,i}}F_i \quad s.t. \quad N^TF = \tau, \quad F_{min} \leq F \leq F_{max}\]- Parameters:
N β moment arm matrix
F_min β minimal muscular forces (passive forces or 0)
F_max β maximal isometric forces
tau β joint torque
options β dictionary of options (currently supported
solvertype to use:lp- linear programming (default),qp- quadratic programming)
- Returns:
list of muscle forces
- Return type:
F(list)
- pycapacity.human.velocity_ellipsoid(J, N, dl_max)[source]ο
Human musculoskeletal velocity ellipsoid calculation
\[E_f = \{\dot{x}~ |~ J\dot{q} = \dot{x},~ L\dot{q} = \dot{l} \quad ||W^{-1}\dot{l}|| \leq 1\}\]where
\[W=diag(\dot{l}_{max})\]- Parameters:
J β position jacobian
N β moment arm matrix (\(N = -L^T\), where \(L\) is the muscle length jacobian)
dl_max β maximal joint velocities
- Returns:
ellipsoid object with the following attributes
radii,axes- Return type:
ellipsoid(Ellipsoid)
- pycapacity.human.velocity_polytope(J, N=None, dl_min=None, dl_max=None, dq_max=None, dq_min=None, tol=1e-05, options=None)[source]ο
A function calculating the polytopes of achievable velocity based on the jacobian matrix J and moment arm matrix N
If only muscle contraction velocity limits are given
\[P_{v,\dot{l}} = \{ \dot{x} ~ | ~ L\dot{q} = \dot{l},~~ J\dot{q} = \dot{x}, \quad \dot{l}_{min} \leq \dot{l} \leq \dot{l}_{max}\}\]If only joint velocity limits are given
\[P_{v,\dot{q}} = \{ \dot{x} ~ | ~ J\dot{q} = \dot{x}, \quad \dot{q}_{min} \leq \dot{q} \leq \dot{q}_{max}\}\]If both are provided the function will calculate
\[P_{v,\dot{l}} = \{ \dot{x} ~ | ~ J\dot{q} = \dot{x}, \quad \dot{q}_{min} \leq \dot{q} \leq \dot{q}_{max}, ~~ \dot{l}_{max} \leq L\dot{q} \leq \dot{l}_{max}\}\]Based on the
iterative_convex_hull_methodalgorithm.- Parameters:
J β jacobian matrix
N β moment arm matrix \(L = -N^T\)
dl_min β minimal achievable muscle contraction velocity
dl_max β maximal achievable muscle contraction velocity
dq_min β minimal achievable joint velocity
dq_max β maximal achievable joint velocity
tol β tolerance for the polytope calculation
options β dictionary of options for the polytope calculation (currently only
calculate_facesis supported)
- Returns:
polytope object with the following attributes
vertices, joint velocity verticesdq_verticesand muscle elongation verticesdl_vertices, half-plane representationH,d, (andface_indicesandfacesif optioncalculate_facesis set toTrue)- Return type:
polytope(Polytope)