newton.actuators.ClampingPositionBased#

class newton.actuators.ClampingPositionBased(lookup_table_path=None, lookup_positions=None, lookup_efforts=None)[source]#

Bases: Clamping

Position-dependent effort clamping via lookup table.

Provides position-dependent effort limits interpolated from a lookup table to model actuators whose maximum output effort varies with joint position.

The lookup table can be provided either as a file path (lookup_table_path) or as direct value lists (lookup_positions + lookup_efforts). When a path is given, the file is read in finalize().

Sampling rules:

  • Inputs strictly between adjacent entries are linearly interpolated.

  • Inputs at or below lookup_positions[0] clamp to lookup_efforts[0].

  • Inputs at or above lookup_positions[-1] clamp to lookup_efforts[-1].

  • For rotational actuators, positions do not wrap periodically.

The lookup table is a shared parameter: all DOFs within one Actuator group share the same table.

classmethod resolve_arguments(args)#

Resolve user-provided arguments with defaults.

Accepts either lookup_table_path (file) or lookup_positions + lookup_efforts (direct values).

Parameters:

args (dict[str, Any]) – User-provided arguments.

Returns:

Complete arguments with defaults filled in.

Return type:

dict[str, Any]

__init__(lookup_table_path=None, lookup_positions=None, lookup_efforts=None)#

Initialize position-based clamp.

Provide either lookup_table_path or both lookup_positions and lookup_efforts.

Parameters:
  • lookup_table_path (str | None) – Path to a whitespace/comma-separated text file with two columns (position, effort). Lines starting with # are comments. The file is read in finalize().

  • lookup_positions (tuple[float, ...] | None) – Sorted joint positions [rad or m] for the effort lookup table. Shape (K,).

  • lookup_efforts (tuple[float, ...] | None) – Max output efforts [N·m or N] corresponding to lookup_positions. Shape (K,).

finalize(device, num_actuators)#

Called by Actuator after construction.

Reads the lookup table from file (if a path was given) and allocates device arrays.

Parameters:
  • device (Device) – Warp device to use.

  • num_actuators (int) – Number of actuators (DOFs).

modify_forces(src_forces, dst_forces, positions, velocities, pos_indices, vel_indices, device=None)#
SHARED_PARAMS: ClassVar[set[str]] = {'lookup_efforts', 'lookup_positions', 'lookup_table_path'}#