newton.actuators.DrivePID#

class newton.actuators.DrivePID(kp, ki, kd, integral_max, const_effort=None)[source]#

Bases: DriveBase

Stateful proportional-integral-derivative actuator drive.

Effort law:

effort = const_effort + feedforward + kp * (target_pos - current_pos)
       + ki * integral(target_pos - current_pos) + kd * (target_vel - current_vel)

Maintains an integral term with anti-windup clamping.

Implicit actuation folds the integral term into a per-step constant (see prepare_implicit()); the rest solves as DrivePD.

evaluate_force(q, qd, target_q, target_qd, feedforward, params, i)#

PD force law over params[i] = [kp, kd, const_eff], where const_eff = const_effort + ki * integral is folded in per step by DrivePID.prepare_implicit().

classmethod resolve_arguments(args)#
__init__(kp, ki, kd, integral_max, const_effort=None)#

Initialize the PID drive.

Parameters:
  • kp (wp.array[wp.float32]) – Proportional gains [N/m or N·m/rad]. Shape (N,).

  • ki (wp.array[wp.float32]) – Integral gains [N/(m·s) or N·m/(rad·s)]. Shape (N,).

  • kd (wp.array[wp.float32]) – Derivative gains [N·s/m or N·m·s/rad]. Shape (N,).

  • integral_max (wp.array[wp.float32]) – Anti-windup limits [m·s or rad·s]. Shape (N,).

  • const_effort (wp.array[wp.float32] | None) – Constant bias effort [N or N·m]. Shape (N,). None to skip.

bind_params()#
compute(positions, velocities, target_pos, target_vel, feedforward, pos_indices, vel_indices, target_pos_indices, target_vel_indices, forces, state, dt, device=None)#
finalize(device, num_actuators)#
is_graphable()#
is_stateful()#
prepare_implicit(positions, velocities, target_pos, target_vel, pos_indices, vel_indices, target_pos_indices, target_vel_indices, drive_state, dt, inv_mass=None, device=None)#

Fold ki*integral into the pack’s constant column.

Advances the integral with the current-step error and anti-windup clamping. The implicit solve then holds that contribution constant.

state(num_actuators, device)#
update_state(current_state, next_state)#