newton.actuators.ControllerNeuralMLP#

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

Bases: Controller

MLP-based neural network controller, ONNX-backed.

Uses a pre-trained MLP (loaded from an .onnx file) to compute joint effort from concatenated, scaled position-error and velocity-error 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 the ONNX model’s metadata properties (a single metadata JSON property is preferred), falling back to defaults when absent.

classmethod resolve_arguments(args)#
__init__(model_path)#

Initialize MLP controller from an ONNX checkpoint file.

Configuration is read from the model’s metadata properties:

  • input_order (str): "pos_vel" or "vel_pos" (default "pos_vel").

  • input_idx (list[int]): history timestep indices (default [0]).

  • pos_scale (float): position-error scaling (default 1.0).

  • vel_scale (float): velocity-error scaling (default 1.0).

  • effort_scale (float): output effort scaling (default 1.0).

Parameters:

model_path (str) – Path to the .onnx 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'}#