File tree 1 file changed +16
-9
lines changed
1 file changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -105,22 +105,29 @@ def dx_dt(
105
105
terrain = terrain ,
106
106
)
107
107
108
+ # ==============
109
+ # Joint friction
110
+ # ==============
111
+
112
+ # Static and viscous joint friction parameters
113
+ kc = physics_model ._joint_friction_static .values ()
114
+ kv = physics_model ._joint_friction_viscous .values ()
115
+
116
+ # Compute the joint friction torque
117
+ tau_friction = - (
118
+ jnp .diag (kc ) @ jnp .sign (ode_state .physics_model .joint_positions )
119
+ + jnp .diag (kv ) @ ode_state .physics_model .joint_velocities
120
+ )
121
+
108
122
# ========================
109
123
# Compute forward dynamics
110
124
# ========================
111
125
112
126
# Compute the total forces applied to the bodies
113
127
total_forces = ode_input .physics_model .f_ext + contact_forces_links
114
128
115
- # Compute the mechanical joint torques (real torque sent to the joint) by
116
- # subtracting the optional joint friction
117
- # TODO: add support of coulomb/viscous parameters in parsers and PhysicsModel
118
- kp_friction = jnp .array ([0.0 ] * physics_model .dofs ())
119
- kd_friction = jnp .array ([0.0 ] * physics_model .dofs ())
120
- tau = ode_input .physics_model .tau - (
121
- jnp .diag (kp_friction ) @ jnp .sign (ode_state .physics_model .joint_positions )
122
- + jnp .diag (kd_friction ) @ ode_state .physics_model .joint_velocities
123
- )
129
+ # Compute the joint torques to actuate
130
+ tau = ode_input .physics_model .tau + tau_friction
124
131
125
132
W_a_WB , qdd = algos .aba .aba (
126
133
model = physics_model ,
You can’t perform that action at this time.
0 commit comments