newton.actuators.ControllerPID#

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

Bases: Controller

Stateful PID (Proportional-Integral-Derivative) controller.

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.

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

Initialize PID controller.

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

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

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

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

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

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()#
state(num_actuators, device)#
update_state(current_state, next_state)#