JointDynamics#

class JointDynamics(
inertia__kg_m2: float,
damping__Nm_s_per_rad: float,
stiffness__Nm_per_rad: float = 0.0,
initial_angle__deg: float = 0.0,
initial_velocity__deg_per_s: float = 0.0,
) None[source]#

Bases: object

Joint dynamics integrator for closed-loop neuromechanical control.

This class implements second-order joint dynamics using the equation: I⋅α = τ - B⋅ω - K⋅θ where α = angular acceleration, τ = torque, ω = angular velocity, θ = joint angle, I = inertia, B = damping, K = stiffness.

Parameters:
  • inertia__kg_m2 (float) – Joint rotational inertia in kg⋅m².

  • damping__Nm_s_per_rad (float) – Joint viscous damping coefficient in N⋅m⋅s/rad. Controls velocity-dependent resistance.

  • stiffness__Nm_per_rad (float, default=0.0) – Joint elastic stiffness in N⋅m/rad. Set to 0 for passive joints, >0 for spring-loaded joints.

  • initial_angle__deg (float, default=0.0) – Initial joint angle in degrees.

  • initial_velocity__deg_per_s (float, default=0.0) – Initial angular velocity in degrees per second.

angle__rad#

Current joint angle in radians.

Type:

float

velocity__rad_per_s#

Current angular velocity in rad/s.

Type:

float

angle__deg#

Current joint angle in degrees (computed property).

Type:

float

Methods

__init__

get_state

Get current joint state.

integrate

Integrate joint dynamics for one time step.

reset

Reset joint to initial conditions.

Attributes

angle__deg

Current joint angle in degrees.

property angle__deg: float#

Current joint angle in degrees.

integrate(torque__Nm: float, dt__s: float) Tuple[float, float][source]#

Integrate joint dynamics for one time step.

Parameters:
  • torque__Nm (float) – Applied muscle torque in N⋅m.

  • dt__s (float) – Integration time step in seconds.

Returns:

Updated (angle__deg, velocity__deg_per_s).

Return type:

tuple[float, float]

reset() None[source]#

Reset joint to initial conditions.

Return type:

None

get_state() dict[source]#

Get current joint state.

Returns:

Dictionary containing current angle, velocity, and parameters.

Return type:

dict