newton.actuators.ClampingPositionBased#
- class newton.actuators.ClampingPositionBased(lookup_table_path=None, lookup_positions=None, lookup_efforts=None)[source]#
Bases:
ClampingPosition-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 infinalize().Sampling rules:
Inputs strictly between adjacent entries are linearly interpolated.
Inputs at or below
lookup_positions[0]clamp tolookup_efforts[0].Inputs at or above
lookup_positions[-1]clamp tolookup_efforts[-1].For rotational actuators, positions do not wrap periodically.
The lookup table is a shared parameter: all DOFs within one
Actuatorgroup share the same table.- classmethod resolve_arguments(args)#
Resolve user-provided arguments with defaults.
Accepts either
lookup_table_path(file) orlookup_positions+lookup_efforts(direct values).
- __init__(lookup_table_path=None, lookup_positions=None, lookup_efforts=None)#
Initialize position-based clamp.
Provide either
lookup_table_pathor bothlookup_positionsandlookup_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 infinalize().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
Actuatorafter construction.Reads the lookup table from file (if a path was given) and allocates device arrays.
- modify_forces(src_forces, dst_forces, positions, velocities, pos_indices, vel_indices, device=None)#