newton.actuators.DrivePID#
- class newton.actuators.DrivePID(kp, ki, kd, integral_max, const_effort=None)[source]#
Bases:
DriveBaseStateful 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 asDrivePD.- evaluate_force(q, qd, target_q, target_qd, feedforward, params, i)#
PD force law over
params[i] = [kp, kd, const_eff], whereconst_eff = const_effort + ki * integralis folded in per step byDrivePID.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,).Noneto 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*integralinto 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)#