newton.actuators.ControllerNeuralMLP#

class newton.actuators.ControllerNeuralMLP(model_path)[source]#

Bases: Controller

MLP-based neural network controller.

Uses a pre-trained MLP to compute joint effort from concatenated, scaled position-error and joint-velocity history. The output is multiplied by effort_scale to convert from network units to physical effort [N or N·m].

Configuration parameters (input_order, input_idx, pos_scale, vel_scale, effort_scale) are read from checkpoint metadata, falling back to defaults when absent. .onnx checkpoints run through Warp-NN. Torch checkpoints keep the Torch backend and accept pt2 archives (.pt2 saved with torch.export.save; preferred) and the deprecated TorchScript (.pt saved with torch.jit.save) and module-bundle ({"model": <network module>, "metadata": {...}} saved with torch.save) formats.

classmethod resolve_arguments(args)#
__init__(model_path)#

Initialize MLP controller from a checkpoint file.

Parameters:

model_path (str) – Path to the .onnx, .pt2, .pt, or .pth checkpoint.

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)#
SHARED_PARAMS: ClassVar[set[str]] = {'model_path'}#