JointBiomechanics#
- class JointBiomechanics(
- joint_type: Literal['hinge', 'ball_socket'],
- joint_geometry: JointGeometry,
- muscle_geometries: list[MuscleGeometry],
- moment_arm_data__cm: ]] | None = None,
- use_simplified_model: bool = True,
Bases:
objectJoint biomechanics with muscle moment arms and length calculations.
This class computes the relationship between joint angles and muscle lengths, moment arms, and resulting joint torques. It supports both simple geometric models and more complex biomechanical relationships.
- Parameters:
joint_type ({"hinge", "ball_socket"}) – Type of joint for biomechanical calculations. “hinge” = single degree of freedom (e.g., elbow, knee) “ball_socket” = multi-degree of freedom (e.g., shoulder, hip)
joint_geometry (JointGeometry) – Geometric parameters of the joint.
muscle_geometries (list[MuscleGeometry]) – List of muscle geometry parameters for muscles crossing this joint.
moment_arm_data__cm (MOMENT_ARM__MATRIX, optional) – Pre-computed moment arm data as function of joint angle. If None, computed from geometry. Shape: (n_angles, n_muscles).
use_simplified_model (bool, default=True) – Whether to use simplified geometric model or detailed biomechanics.
- joint_angles__deg#
Array of joint angles for moment arm calculations.
- Type:
np.ndarray
- moment_arms__cm#
Moment arms for each muscle at each joint angle.
- Type:
np.ndarray
Methods
Compute net joint torque from muscle forces.
Compute muscle length from joint angle.
Get summary of biomechanical parameters.
Get moment arm for a muscle at a specific joint angle.
Compute muscle length trajectory from joint angle trajectory.
- compute_muscle_length( ) float[source]#
Compute muscle length from joint angle.
- Parameters:
- Returns:
Muscle length in cm.
- Return type:
- Raises:
ValueError – If muscle_index is out of range.
- get_moment_arm(joint_angle__deg: float, muscle_index: int) float[source]#
Get moment arm for a muscle at a specific joint angle.
- compute_joint_torque( ) float[source]#
Compute net joint torque from muscle forces.
- Parameters:
- Returns:
Net joint torque in N⋅cm.
- Return type:
Notes
Positive torque indicates rotation in the positive joint angle direction.
- get_muscle_length_trajectory(
- joint_angle_trajectory__degrees: ]],
- muscle_index: int,
Compute muscle length trajectory from joint angle trajectory.
- Parameters:
joint_angle_trajectory__degrees (JOINT_ANGLE__ARRAY) – Array of joint angles over time.
muscle_index (int) – Index of the muscle.
- Returns:
Muscle length trajectory in cm.
- Return type:
np.ndarray