newton.utils.BasicRecorder#

class newton.utils.BasicRecorder[source]#

Bases: object

A class to record and playback simulation body transforms.

__init__()#

Initializes the Recorder.

load_from_file(file_path, device=None)#

Loads recorded transforms from a file, replacing the current history.

Parameters:
  • file_path (str) – The full path to the file from which to load the transforms.

  • device – The device to load the transforms onto. If None, uses CPU.

playback(frame_id)#

Plays back a recorded frame by returning the stored body transforms and point cloud.

Parameters:

frame_id (int) – The integer index of the frame to be played back.

Returns:

A tuple containing the body transforms and point clouds for the given frame, or (None, None) if the frame_id is out of bounds.

Return type:

tuple[array | None, list[array] | None]

record(body_transforms, point_clouds=None)#

Records a snapshot of body transforms.

Parameters:
  • body_transforms (wp.array) – A warp array representing the body transforms. This is typically retrieved from state.body_q.

  • point_clouds (list[wp.array] | None) – An optional list of warp arrays representing point clouds.

save_to_file(file_path)#

Saves the recorded transforms history to a file.

Parameters:

file_path (str) – The full path to the file where the transforms will be saved.