isaaclab_newton.physics#
Implementation backends for simulation interfaces.
Classes
Abstract Newton physics manager for Isaac Lab. |
|
Configuration for Newton physics manager. |
|
Configuration for Newton solver-related parameters. |
|
Configuration for MuJoCo Warp solver-related parameters. |
|
An implicit integrator using eXtended Position-Based Dynamics (XPBD) for rigid and soft body simulation. |
|
A semi-implicit integrator using symplectic Euler. |
|
Configuration for Kamino solver-related parameters. |
|
Configuration for Newton collision pipeline. |
|
Configuration for SDF-based hydroelastic collision handling. |
|
Default per-shape collision properties applied to all shapes in a Newton scene. |
|
|
|
|
|
|
|
|
Physics Manager#
- class isaaclab_newton.physics.NewtonManager[source]#
Bases:
PhysicsManagerAbstract Newton physics manager for Isaac Lab.
Class-level (singleton-like) manager that owns simulation lifecycle, model state, contacts/collision pipeline, sensors, replication, and CUDA-graph orchestration. Concrete subclasses (one per solver) implement
_build_solver()and may extend_initialize_contacts(),_step_solver(),_solver_specific_clear(), and_log_solver_debug().Subclasses are selected via
NewtonSolverCfg.class_type, whichNewtonCfg.__post_init__()propagates ontoNewtonCfg.class_typeso thatSimulationContextresolves the matching subclass automatically.Lifecycle:
initialize() -> reset() -> step()(repeated)-> close().Note
Shared state lives on
NewtonManager(the base) by design — the framework importsNewtonManagerdirectly and reads attributes such as_model/_state_0/_builderfrom many places. Lifecycle methods therefore assign through the explicit base class (NewtonManager._foo = ...) rather than throughclsso that the canonical state remains discoverable from external readers regardless of which subclass is active.Methods:
initialize(sim_context)Initialize the manager with simulation context.
reset([soft])Reset physics simulation.
forward()Update articulation kinematics without stepping physics.
Flush deferred Fabric writes before cameras/visualizers read the scene.
Write Newton body_q to USD Fabric world matrices for Kit viewport / RTX rendering.
Write Newton particle_q to Fabric mesh point arrays for Kit viewport rendering.
step()Step the physics simulation.
close()Clean up Newton physics resources.
Return the SceneDataBackend for the SceneDataProvider.
register_callback(callback, event[, order, ...])Register a callback.
Get the list of registered views.
Check if fabric interface is enabled (not applicable for Newton).
clear()Clear all Newton-specific state (callbacks cleared by super().close()).
set_builder(builder)Set the Newton model builder.
create_builder([up_axis])Create a
ModelBuilderconfigured with default settings.cl_register_site(body_pattern, xform)Register a site request for injection into prototypes before replication.
Request an extended state attribute (e.g.
"body_qdd").Request an extended contact attribute (e.g.
"force").add_model_change(change)Register a model change to notify the solver.
invalidate_fk([env_mask, env_ids, ...])Mark environments as needing FK recomputation and solver reset.
Start simulation by finalizing model and initializing state.
Create builder from USD stage.
Initialize the solver and collision pipeline.
Get the Newton model.
Get the current state.
get_state([scene_data_provider])Get the current Newton state for visualization.
update_visualization_state([scene_data_provider])Refresh visualization state for the active sim backend.
Get the next state.
Get the control object.
get_dt()Get the physics timestep.
Get the solver substep timestep.
Opt an articulation into the Newton actuator fast path.
register_post_actuator_callback(callback)Append a hook to the list invoked after the actuator step on every iteration.
set_decimation(decimation)Set the decimation count and re-capture the CUDA graph.
Truewhenstep()executes the full decimation loop internally.add_contact_sensor([body_names_expr, ...])Add a contact sensor for reporting contacts between bodies/shapes.
add_frame_transform_sensor(shapes, ...)Add a frame transform sensor for measuring relative transforms.
add_imu_sensor(sites)Add an IMU sensor for measuring acceleration and angular velocity at sites.
Hook after visualizers have stepped during
render().Remove all registered callbacks.
deregister_callback(callback_id)Remove a registered callback.
dispatch_event(event[, payload])Dispatch an event to all registered callbacks.
Get the tensor backend being used ("numpy" or "torch").
Get the physics simulation device.
Get the physics timestep in seconds.
Get the current simulation time in seconds.
pause()Pause physics simulation.
play()Start or resume physics simulation.
safe_callback_invoke(fn, *args[, ...])Invoke a callback, catching exceptions that would be swallowed by external event buses.
stop()Stop physics simulation.
Block until the timeline is playing.
- classmethod initialize(sim_context: SimulationContext) None[source]#
Initialize the manager with simulation context.
- Parameters:
sim_context – Parent simulation context.
- classmethod reset(soft: bool = False) None[source]#
Reset physics simulation.
- Parameters:
soft – If True, skip full reinitialization.
- classmethod forward() None[source]#
Update articulation kinematics without stepping physics.
Runs Newton’s generic forward kinematics (
eval_fk) over all articulations to compute body poses from joint coordinates. This is the full (unmasked) FK path used during initial setup. For incremental per-environment updates after resets, seeinvalidate_fk()which accumulates masks consumed bystep().
- classmethod pre_render() None[source]#
Flush deferred Fabric writes before cameras/visualizers read the scene.
- classmethod sync_transforms_to_usd() None[source]#
Write Newton body_q to USD Fabric world matrices for Kit viewport / RTX rendering.
No-op when
_usdrt_stageis None (i.e. Kit visualizer is not active) or when transforms have not changed since the last sync.Called at render cadence by
pre_render()(viarender()). Physics stepping marks transforms dirty via_mark_transforms_dirty()so that the expensive Fabric hierarchy update only runs once per render frame rather than after every physics step.Uses
wp.fabricarraydirectly (noisaacsim.physics.newtonextension needed). The Warp kernel readsstate_0.body_q[newton_index[i]]and writes the correspondingmat44dtoomni:fabric:worldMatrixfor each prim.When cubric is available the method mirrors PhysX’s
DirectGpuHelperpattern: pause Fabric change tracking, write transforms, resume tracking, then callIAdapter::computeon the GPU to propagate the hierarchy and notify the Fabric Scene Delegate. Otherwise it falls back to the CPUupdate_world_xforms()path.
- classmethod sync_particles_to_usd() None[source]#
Write Newton particle_q to Fabric mesh point arrays for Kit viewport rendering.
For each deformable body whose mesh prim carries a
newton:particleOffsetattribute, this function copies the corresponding slice ofstate_0.particle_qinto the Fabricpointsarray so the Kit viewport reflects the current deformation.No-op when there is no
_usdrt_stage, no simulation state, or no deformable bodies registered.
- classmethod step() None[source]#
Step the physics simulation.
The stepping logic follows one of two paths depending on whether all actuators are CUDA-graph-safe:
All-graphable path (
_simulate_full()):Actuators and solver substeps are captured together in a single CUDA graph containing the full
decimation x (actuators + solver substeps)loop.Eager-actuator path (fallback, some actuators not graph-safe):
Actuators are stepped eagerly on the CPU timeline (outside the graph), then a graph containing only the solver substeps is launched via
_simulate_physics_only().In both paths the sequence within one physics step is:
zero actuated DOFs in control.joint_f -> actuator.step (computes effort, writes to control.joint_f) -> solver.step x num_substeps (integrates, reads control.joint_f) -> sensors.update
- classmethod get_scene_data_backend() SceneDataBackend[source]#
Return the SceneDataBackend for the SceneDataProvider.
- classmethod register_callback(callback: Callable, event: PhysicsEvent, order: int = 0, name: str | None = None, wrap_weak_ref: bool = True) CallbackHandle[source]#
Register a callback. Passes event to parent class.
- classmethod get_physics_sim_view() list[source]#
Get the list of registered views.
Assets can append their views to this list, and sensors can access them. Returns a list that callers can append to.
- Returns:
List of registered views (e.g., NewtonArticulationView instances).
- classmethod is_fabric_enabled() bool[source]#
Check if fabric interface is enabled (not applicable for Newton).
- classmethod clear()[source]#
Clear all Newton-specific state (callbacks cleared by super().close()).
- classmethod create_builder(up_axis: str | None = None, **kwargs) newton.ModelBuilder[source]#
Create a
ModelBuilderconfigured with default settings.Forwards
NewtonShapeCfgdefaults onto Newton’s upstreamModelBuilder.default_shape_cfgviachecked_apply(). Falls back to wrapper defaults when no Newton config is active so rough-terrain margin/gap still apply during early construction.- Parameters:
up_axis – Override for the up-axis. Defaults to
None, which uses the manager’s_up_axis.**kwargs – Forwarded to
ModelBuilder.
- Returns:
New builder with up-axis and per-shape defaults (gap, margin) applied.
- classmethod cl_register_site(body_pattern: str | None, xform: warp.transform) str[source]#
Register a site request for injection into prototypes before replication.
Sensors call this during
__init__. Sites are injected into prototype builders by_cl_inject_sites()(called fromnewton_replicate) beforeadd_builder, so they replicate correctly per-world.Identical
(body_pattern, transform)registrations share sites.The body_pattern is matched against prototype-local body labels (e.g.
"Robot/link.*") when replication is active, or against the flat builder’s body labels in the fallback path. Wildcard patterns that match multiple bodies create one site per matched body.- Parameters:
body_pattern – Regex pattern matched against body labels in the prototype builder (e.g.
"Robot/link0"or"Robot/finger.*"for multi-body wildcards), orNonefor global sites (world-origin reference, etc.).xform – Site transform relative to body.
- Returns:
Assigned site label suffix.
- classmethod request_extended_state_attribute(attr: str) None[source]#
Request an extended state attribute (e.g.
"body_qdd").Sensors call this during
__init__, before model finalization. Attributes are forwarded to the builder instart_simulation()so that subsequentmodel.state()calls allocate them.- Parameters:
attr – State attribute name (must be in
State.EXTENDED_ATTRIBUTES).
- classmethod request_extended_contact_attribute(attr: str) None[source]#
Request an extended contact attribute (e.g.
"force").Sensors call this during
__init__, before model finalization. Attributes are forwarded to the model instart_simulation()so that subsequentContactscreation includes them.- Parameters:
attr – Contact attribute name.
- classmethod add_model_change(change: newton.solvers.SolverNotifyFlags) None[source]#
Register a model change to notify the solver.
- classmethod invalidate_fk(env_mask: wp.array | None = None, env_ids: wp.array | None = None, articulation_ids: wp.array | None = None) None[source]#
Mark environments as needing FK recomputation and solver reset.
Called by asset write methods that modify joint coordinates or root transforms. The masks are consumed in
step()before physics stepping.- Parameters:
env_mask – Boolean mask of dirtied environments. Shape
(num_envs,). Used by_maskwrite methods.env_ids – Integer indices of dirtied environments. Used by
_indexwrite methods.articulation_ids – Mapping from
(world, arti)to model articulation index. Shape(world_count, count_per_world). Obtained fromArticulationView.articulation_ids.
- classmethod start_simulation() None[source]#
Start simulation by finalizing model and initializing state.
This function finalizes the model and initializes the simulation state. Note: Collision pipeline is initialized later in initialize_solver() after we determine whether the solver needs external collision detection.
- classmethod instantiate_builder_from_stage()[source]#
Create builder from USD stage.
Detects env Xforms (e.g.
/World/Env_0,/World/Env_1) and builds each as a separate Newton world viabegin_world/end_world. Falls back to a flatadd_usdwhen no env Xforms are found.
- classmethod initialize_solver() None[source]#
Initialize the solver and collision pipeline.
Thin orchestrator: delegates solver construction to
_build_solver()(overridden by each solver subclass), allocates the collision pipeline (when applicable) via_initialize_contacts(), then sets up cubric bindings and either captures the CUDA graph immediately or defers capture until the firststep()call (RTX-active path).Warning
When using a CUDA-enabled device, the simulation is graphed. This means the function steps the simulation once to capture the graph, so it should only be called after everything else in the simulation is initialized.
- classmethod get_model() newton.Model[source]#
Get the Newton model.
When the active sim backend is Newton this returns the manager’s own authoritative model. When the active sim backend is PhysX a shadow Newton model is built lazily (from the visualizer prebuilt artifact) so renderers/visualizers that operate on Newton
ModelandStatecan still drive a PhysX-simulated scene.
- classmethod get_state(scene_data_provider=None) newton.State[source]#
Get the current Newton state for visualization.
Use this method from visualizers/renderers/video recorders that need a backend-agnostic Newton
State. When the sim backend is PhysX this refreshes the shadow_state_0.body_qfrom the live PhysX scene viaupdate_visualization_state()before returning, so callers never observe stale transforms. Under the Newton sim backendupdate_visualization_state()is a no-op and this is equivalent toget_state_0().
- classmethod update_visualization_state(scene_data_provider=None) None[source]#
Refresh visualization state for the active sim backend.
Newton sim backend: no-op —
_state_0is the live, authoritative state already advanced bystep()/ forward kinematics.PhysX sim backend: pull rigid-body transforms from the
SceneDataProviderand write them into the shadow_state_0.body_qso Newton-native consumers (Newton renderer, Newton/Rerun/Viser visualizers, OVRTX renderer, Newton GL video) see fresh poses.Invoked lazily from
get_state()so consumers do not need to coordinate the sync explicitly.
- classmethod activate_newton_actuator_path() None[source]#
Opt an articulation into the Newton actuator fast path.
Idempotent — called by every Newton-fast-path articulation’s
_process_actuators_cfg:Sets
_use_newton_actuators_active, which_is_all_graphable()checks (adapter presence alone cannot distinguish the fast path from the standard Lab path).On first call, builds the single sim-level
NewtonActuatorAdapterover the full flat DOF layout; later calls reuse it.
- classmethod register_post_actuator_callback(callback: Callable[[], None]) None[source]#
Append a hook to the list invoked after the actuator step on every iteration.
Each callback runs inside the captured CUDA graph (when
_is_all_graphable()isTrue) right afterNewtonActuatorAdapter.step()and before the solver substeps, so kernel writes tostate/controlare visible to the integrator on the same iteration. Multiple articulations register their own implicit-DOF telemetry / FF-routing kernels here; all registered callbacks fire in registration order each step.
- classmethod set_decimation(decimation: int) None[source]#
Set the decimation count and re-capture the CUDA graph.
When all actuators are graphable the entire decimation loop (actuators + solver substeps, repeated decimation times) is captured as a single CUDA graph.
If a CUDA graph was previously captured, it is automatically re-captured with the new decimation count using the same strategy as
start_simulation(): standardwp.ScopedCapturewhen no USDRT stage is active, or deferred relaxed capture when RTX is running.
- classmethod handles_decimation() bool[source]#
Truewhenstep()executes the full decimation loop internally.This is the case when all Newton actuators are CUDA-graph-safe. The full decimation loop (including the trivial
decimation=1case) is folded into a singlestep()call.
- classmethod add_contact_sensor(body_names_expr: str | list[str] | None = None, shape_names_expr: str | list[str] | None = None, contact_partners_body_expr: str | list[str] | None = None, contact_partners_shape_expr: str | list[str] | None = None, verbose: bool = False) tuple[str | list[str] | None, str | list[str] | None, str | list[str] | None, str | list[str] | None][source]#
Add a contact sensor for reporting contacts between bodies/shapes.
Converts Isaac Lab pattern conventions (
.*regex, full USD paths) to fnmatch globs and delegates tonewton.sensors.SensorContact.- Parameters:
body_names_expr – Expression for body names to sense.
shape_names_expr – Expression for shape names to sense.
contact_partners_body_expr – Expression for contact partner body names.
contact_partners_shape_expr – Expression for contact partner shape names.
verbose – Print verbose information.
- classmethod add_frame_transform_sensor(shapes: list[int], reference_sites: list[int]) int[source]#
Add a frame transform sensor for measuring relative transforms.
Creates a
SensorFrameTransformfrom pre-resolved shape and reference site indices, appends it to the internal list, and returns its index.- Parameters:
shapes – Ordered list of shape indices to measure.
reference_sites – 1:1 list of reference site indices (same length as shapes).
- Returns:
Index of the newly created sensor in
_newton_frame_transform_sensors.
- classmethod add_imu_sensor(sites: list[int]) int[source]#
Add an IMU sensor for measuring acceleration and angular velocity at sites.
Creates a
newton.sensors.SensorIMUfrom pre-resolved site indices, appends it to the internal list, and returns its index.- Parameters:
sites – Ordered list of site indices (one per environment).
- Returns:
Index of the newly created sensor in the internal IMU sensor list.
- classmethod after_visualizers_render() None#
Hook after visualizers have stepped during
render().Use for physics-backend sync (e.g. fabric) if needed. Recording pipelines (Kit/RTX, Newton GL video, etc.) run from
isaaclab.envs.utils.recording_hooksso they are not tied to a specific physics manager. Default is a no-op.
- classmethod clear_callbacks() None#
Remove all registered callbacks.
Do NOT reset
_callback_id— handle IDs must remain monotonically unique across the lifetime of the process. Resetting the counter would let a futureregister_callback()hand out an ID that an old, still-aliveCallbackHandle(e.g. on a sensor that has not been garbage-collected yet) holds, so when the old object eventually finalizes its__del__would deregister the new callback. This bit ovphysx’s kitless multi-context tests where twoInteractiveScene``s are created in sequence: the first scene's sensor would post-GC deregister the second scene's ``_initialize_callbackby ID collision, leaving the second sensor forever uninitialized.
- classmethod deregister_callback(callback_id: int | CallbackHandle) None#
Remove a registered callback.
- Parameters:
callback_id – The ID or CallbackHandle returned by register_callback().
- classmethod dispatch_event(event: PhysicsEvent, payload: Any = None) None#
Dispatch an event to all registered callbacks.
This is the default implementation using simple callback lists. Subclasses may override or extend with platform-specific dispatch.
- Parameters:
event – The event to dispatch.
payload – Optional data to pass to callbacks.
- static safe_callback_invoke(fn: Callable, *args, physics_manager: type[PhysicsManager] | None = None) None#
Invoke a callback, catching exceptions that would be swallowed by external event buses.
Ignores
ReferenceError(from garbage-collected weakref proxies). All other exceptions are forwarded to physics_manager.``store_callback_exception`` when available (see note below), or re-raised immediately otherwise.- Note (Octi):
The carb event bus used by PhysX/Omniverse silently swallows exceptions raised inside callbacks.
PhysxManagerworks around this by storing the exception and re-raising it after event dispatch completes (inreset()/step()). Backends that dispatch events directly (e.g. Newton) don’t need this — exceptions propagate normally — sostore_callback_exceptionis not called for them. This is a known wart; a cleaner solution is actively being explored.
Physics Configuration#
- class isaaclab_newton.physics.NewtonCfg[source]#
Bases:
PhysicsCfgConfiguration for Newton physics manager.
This configuration includes Newton-specific simulation settings and solver configuration.
The active
NewtonManagersubclass is determined bysolver_cfg.class_type, which__post_init__()propagates toclass_typeso thatSimulationContextresolves the right manager subclass automatically. User code keeps the existing two-level shapeNewtonCfg(solver_cfg=...)and does not need to setclass_typeexplicitly.Attributes:
The class type of the
NewtonManager.Number of substeps to use for the solver.
Whether to enable debug mode for the solver.
Whether to use CUDA graphing when simulating.
Solver configuration.
Newton collision pipeline configuration.
Default per-shape collision properties applied to every shape in the scene.
- class_type: type[NewtonManager] | str | None#
The class type of the
NewtonManager.Auto-set in
__post_init__()fromsolver_cfg.class_type. Users normally do not set this directly.
- use_cuda_graph: bool#
Whether to use CUDA graphing when simulating.
If set to False, the simulation performance will be severely degraded.
- solver_cfg: NewtonSolverCfg | None#
Solver configuration. If None (default), MJWarpSolverCfg is used by default.
- collision_cfg: NewtonCollisionPipelineCfg | None#
Newton collision pipeline configuration.
Controls how Newton’s
CollisionPipelineis configured when it is active. The pipeline is active when the solver delegates collision detection to Newton:MJWarpSolverCfgwithuse_mujoco_contacts=False,KaminoSolverCfgwithuse_collision_detector=False,XPBDSolverCfg(always),FeatherstoneSolverCfg(always).
If
None(default), a pipeline withbroad_phase="explicit"is created automatically. Set this to aNewtonCollisionPipelineCfgto customize parameters such as broad phase algorithm, contact limits, or hydroelastic mode.Note
Setting this while
MJWarpSolverCfg.use_mujoco_contacts=TrueraisesValueError. WhenKaminoSolverCfg.use_collision_detector=True, the field is ignored because Kamino’s internal detector handles contacts.
- default_shape_cfg: NewtonShapeCfg#
Default per-shape collision properties applied to every shape in the scene.
Forwarded to Newton’s
ModelBuilder.default_shape_cfgat builder construction viachecked_apply(). SeeNewtonShapeCfgfor the declared fields.
- class isaaclab_newton.physics.NewtonSolverCfg[source]#
Bases:
objectConfiguration for Newton solver-related parameters.
These parameters are used to configure the Newton solver. For more information, see the Newton documentation.
Subclasses set
class_typeto their matchingNewtonManagersubclass;NewtonCfgpropagates that to its ownNewtonCfg.class_typeinNewtonCfg.__post_init__()so thatSimulationContextresolves the correct manager via the existing dispatch path.Attributes:
Manager class for this solver.
Solver type metadata (deprecated).
- class_type: type[NewtonManager] | str#
Manager class for this solver.
Default points at the abstract
NewtonManager; concrete subclasses override it.
- solver_type: str#
Solver type metadata (deprecated).
Deprecated since version Manager: dispatch is now driven by
class_type; this field is retained as metadata for logging and debugging only. Do not branch onsolver_typein new code.
- class isaaclab_newton.physics.MJWarpSolverCfg[source]#
Bases:
NewtonSolverCfgConfiguration for MuJoCo Warp solver-related parameters.
These parameters are used to configure the MuJoCo Warp solver. For more information, see the MuJoCo Warp documentation.
Attributes:
Manager class for the MuJoCo Warp solver.
Solver type.
Number of constraints per environment (world).
Number of contact points per environment (world).
Number of solver iterations.
Number of line search iterations for the solver.
Solver type.
Integrator type.
Whether to use the pure MuJoCo backend instead of mujoco_warp.
Whether to disable contact computation in MuJoCo.
Default gear ratio for all actuators.
Dictionary mapping joint names to specific gear ratios, overriding the default_actuator_gear.
Frequency (in simulation steps) at which to update the MuJoCo Data object from the Newton state.
Optional path to save the generated MJCF model file.
Frictional-to-normal constraint impedance ratio.
The type of contact friction cone.
Maximum iterations for convex collision detection (GJK/EPA).
Whether to use parallel line search.
Whether to use MuJoCo's internal contact solver.
Solver convergence tolerance for the constraint residual.
- class_type: type[NewtonManager] | str#
Manager class for the MuJoCo Warp solver.
- integrator: str#
Integrator type. Can be “euler”, “rk4”, or “implicitfast”, or their corresponding MuJoCo integer constants.
- actuator_gears: dict[str, float] | None#
Dictionary mapping joint names to specific gear ratios, overriding the default_actuator_gear.
- update_data_interval: int#
Frequency (in simulation steps) at which to update the MuJoCo Data object from the Newton state.
If 0, Data is never updated after initialization.
- save_to_mjcf: str | None#
Optional path to save the generated MJCF model file.
If None, the MJCF model is not saved.
- ccd_iterations: int#
Maximum iterations for convex collision detection (GJK/EPA).
Increase this if you see warnings about
opt.ccd_iterationsneeding to be increased, which typically occurs with complex collision geometries (e.g. multi-finger hands).
- use_mujoco_contacts: bool#
Whether to use MuJoCo’s internal contact solver.
If
True(default), MuJoCo handles collision detection and contact resolution internally. IfFalse, Newton’sCollisionPipelineis used instead. A default pipeline (broad_phase="explicit") is created automatically whenNewtonCfg.collision_cfgisNone. SetNewtonCfg.collision_cfgto aNewtonCollisionPipelineCfgto customize pipeline parameters (broad phase, contact limits, hydroelastic, etc.).Note
Setting
collision_cfgwhileuse_mujoco_contacts=TrueraisesValueErrorbecause the two collision modes are mutually exclusive.
- tolerance: float#
Solver convergence tolerance for the constraint residual.
The solver iterates until the residual drops below this threshold or
iterationsis reached. Lower values give more precise constraint satisfaction at the cost of more iterations. MuJoCo default is1e-8; Newton default is1e-6.
- class isaaclab_newton.physics.XPBDSolverCfg[source]#
Bases:
NewtonSolverCfgAn implicit integrator using eXtended Position-Based Dynamics (XPBD) for rigid and soft body simulation.
References
Miles Macklin, Matthias Müller, and Nuttapong Chentanez. 2016. XPBD: position-based simulation of compliant constrained dynamics. In Proceedings of the 9th International Conference on Motion in Games (MIG ‘16). Association for Computing Machinery, New York, NY, USA, 49-54. https://doi.org/10.1145/2994258.2994272
Matthias Müller, Miles Macklin, Nuttapong Chentanez, Stefan Jeschke, and Tae-Yong Kim. 2020. Detailed rigid body simulation with extended position based dynamics. In Proceedings of the ACM SIGGRAPH/Eurographics Symposium on Computer Animation (SCA ‘20). Eurographics Association, Goslar, DEU, Article 10, 1-12. https://doi.org/10.1111/cgf.14105
Attributes:
Manager class for the XPBD solver.
Solver type.
Number of solver iterations.
Relaxation parameter for soft body simulation.
Relaxation parameter for soft contact simulation.
Relaxation parameter for joint linear simulation.
Relaxation parameter for joint angular simulation.
Compliance parameter for joint linear simulation.
Compliance parameter for joint angular simulation.
Relaxation parameter for rigid contact simulation.
Whether to use contact constraint weighting for rigid contact simulation.
Angular damping parameter for rigid contact simulation.
Whether to enable restitution for rigid contact simulation.
- class_type: type[NewtonManager] | str#
Manager class for the XPBD solver.
- class isaaclab_newton.physics.FeatherstoneSolverCfg[source]#
Bases:
NewtonSolverCfgA semi-implicit integrator using symplectic Euler.
It operates on reduced (also called generalized) coordinates to simulate articulated rigid body dynamics based on Featherstone’s composite rigid body algorithm (CRBA).
See: Featherstone, Roy. Rigid Body Dynamics Algorithms. Springer US, 2014.
Semi-implicit time integration is a variational integrator that preserves energy, however it is not unconditionally stable, and requires a time-step small enough to support the required stiffness and damping forces.
See: https://en.wikipedia.org/wiki/Semi-implicit_Euler_method
Attributes:
Manager class for the Featherstone solver.
Solver type.
Angular damping parameter for rigid contact simulation.
Frequency (in simulation steps) at which to update the mass matrix.
Friction smoothing parameter.
Whether to use tile-based GEMM for the mass matrix.
Whether to fuse the Cholesky decomposition.
- class_type: type[NewtonManager] | str#
Manager class for the Featherstone solver.
- class isaaclab_newton.physics.KaminoSolverCfg[source]#
Bases:
NewtonSolverCfgConfiguration for Kamino solver-related parameters.
Kamino is a Proximal Alternating Direction Method of Multipliers (P-ADMM) based solver for constrained multi-body dynamics. It operates in maximal coordinates and supports rigid bodies and articulations with hard frictional contacts.
Note
This solver is currently in Beta. Its API and behavior may change in future releases.
For more information, see the Newton Kamino documentation.
Attributes:
Manager class for the Kamino solver.
Solver type.
Integrator type.
Whether to use Kamino's internal collision detector instead of Newton's pipeline.
Whether to enable the forward kinematics solver for state resets.
Whether to use sparse Jacobian computation.
Whether to use sparse dynamics computation.
Rotation correction mode.
Angular velocity damping factor.
Baumgarte stabilization parameter for bilateral joint constraints.
Baumgarte stabilization parameter for unilateral joint-limit constraints.
Baumgarte stabilization parameter for unilateral contact constraints.
Contact penetration margin [m].
Maximum number of P-ADMM solver iterations.
Primal residual convergence tolerance for P-ADMM.
Dual residual convergence tolerance for P-ADMM.
Complementarity residual convergence tolerance for P-ADMM.
Initial penalty parameter for P-ADMM.
Whether to use acceleration in the P-ADMM solver.
Warmstart mode for P-ADMM.
Proximal regularization parameter for P-ADMM.
Contact warm-start method for P-ADMM.
Whether to use CUDA graph conditional nodes in the P-ADMM iterative solver.
Whether to collect solver convergence and performance info at each step.
Whether to compute solution metrics at each step.
Collision detection pipeline type.
Maximum number of contacts to generate per candidate geometry pair.
Whether to use preconditioning in the constrained dynamics solver.
Methods:
Build a
SolverKamino.Configfrom this configuration.- class_type: type[NewtonManager] | str#
Manager class for the Kamino solver.
- use_collision_detector: bool#
Whether to use Kamino’s internal collision detector instead of Newton’s pipeline.
- use_fk_solver: bool#
Whether to enable the forward kinematics solver for state resets.
Required for proper environment resets. The FK solver computes consistent body poses from joint angles after state writes, which is essential for maximal-coordinate solvers.
- constraints_alpha: float#
Baumgarte stabilization parameter for bilateral joint constraints. Valid range is [0, 1].
- constraints_beta: float#
Baumgarte stabilization parameter for unilateral joint-limit constraints. Valid range is [0, 1].
- constraints_gamma: float#
Baumgarte stabilization parameter for unilateral contact constraints. Valid range is [0, 1].
- padmm_contact_warmstart_method: str#
Contact warm-start method for P-ADMM.
Can be “key_and_position”, “geom_pair_net_force”, “geom_pair_net_wrench”, “key_and_position_with_net_force_backup”, or “key_and_position_with_net_wrench_backup”.
- padmm_use_graph_conditionals: bool#
Whether to use CUDA graph conditional nodes in the P-ADMM iterative solver.
When
False, replaceswp.capture_whilewith unrolled for-loops over max iterations.
- collect_solver_info: bool#
Whether to collect solver convergence and performance info at each step.
Warning
Enabling this significantly increases solver runtime and should only be used for debugging.
- compute_solution_metrics: bool#
Whether to compute solution metrics at each step.
Warning
Enabling this significantly increases solver runtime and should only be used for debugging.
- collision_detector_pipeline: str | None#
Collision detection pipeline type. Can be “primitive” or “unified”.
Only used when
use_collision_detectorisTrue. IfNone, Newton’s default ("unified") is used.
- collision_detector_max_contacts_per_pair: int | None#
Maximum number of contacts to generate per candidate geometry pair.
Only used when
use_collision_detectorisTrue. IfNone, Newton’s default is used.
- dynamics_preconditioning: bool#
Whether to use preconditioning in the constrained dynamics solver.
Preconditioning improves convergence of the PADMM solver by rescaling the problem. Disabling may be useful for debugging or profiling solver behavior.
- to_solver_config() SolverKamino.Config[source]#
Build a
SolverKamino.Configfrom this configuration.Converts the flat field layout of
KaminoSolverCfginto the nested dataclass hierarchy expected bySolverKamino.- Returns:
A
SolverKamino.Configinstance ready for solver construction.
- class isaaclab_newton.physics.NewtonCollisionPipelineCfg[source]#
Bases:
objectConfiguration for Newton collision pipeline.
Full-featured collision pipeline with GJK/MPR narrow phase and pluggable broad phase. When this config is set on
NewtonCfg.collision_cfg:MJWarpSolverCfg: Newton’s collision pipeline replaces MuJoCo’s internal contact solver.
Other solvers (XPBD, Featherstone, etc.): Configures the collision pipeline parameters (these solvers always use Newton’s collision pipeline).
Key features:
GJK/MPR algorithms for convex-convex collision detection
Multiple broad phase options: NXN (all-pairs), SAP (sweep-and-prune), EXPLICIT (precomputed pairs)
Mesh-mesh collision via SDF with contact reduction
Optional hydroelastic contact model for compliant surfaces
For more details, see the Newton collision pipeline guide and CollisionPipeline API.
Attributes:
Broad phase algorithm for collision detection.
Whether to reduce contacts for mesh-mesh collisions.
Maximum number of rigid contacts to allocate.
Maximum number of triangle pairs allocated by narrow phase for mesh and heightfield collisions.
Maximum number of soft contacts to allocate.
Margin [m] for soft contact generation.
Whether to enable gradient computation for collision.
Configuration for SDF-based hydroelastic collision handling.
Methods:
Build keyword arguments for
newton.CollisionPipeline.- broad_phase: Literal['explicit', 'nxn', 'sap']#
Broad phase algorithm for collision detection.
Options:
"explicit": Use precomputed shape pairs frommodel.shape_contact_pairs."nxn": All-pairs brute force. Simple but O(n^2) complexity."sap": Sweep-and-prune. Good for scenes with many dynamic objects.
Defaults to
"explicit"(same as Newton’s default whenbroad_phase=None).
- reduce_contacts: bool#
Whether to reduce contacts for mesh-mesh collisions.
When True, uses shared memory contact reduction to select representative contacts. Improves performance and stability for meshes with many vertices.
Defaults to
True(same as Newton’s default).
- rigid_contact_max: int | None#
Maximum number of rigid contacts to allocate.
Resolution order:
If provided, use this value.
Else if
model.rigid_contact_max > 0, use the model value.Else estimate automatically from model shape and pair metadata.
Defaults to
None(auto-estimate, same as Newton’s default).
- max_triangle_pairs: int#
Maximum number of triangle pairs allocated by narrow phase for mesh and heightfield collisions.
Increase this when scenes with large/complex meshes or heightfields report triangle-pair overflow warnings.
Defaults to
1_000_000(same as Newton’s default).
- soft_contact_max: int | None#
Maximum number of soft contacts to allocate.
If None, computed as
shape_count * particle_count.Defaults to
None(auto-compute, same as Newton’s default).
- soft_contact_margin: float#
Margin [m] for soft contact generation.
Defaults to
0.01(same as Newton’s default).
- requires_grad: bool | None#
Whether to enable gradient computation for collision.
If
None, usesmodel.requires_grad.Defaults to
None(same as Newton’s default).
- sdf_hydroelastic_config: HydroelasticSDFCfg | None#
Configuration for SDF-based hydroelastic collision handling.
If
None, hydroelastic contacts are disabled. If set, enables hydroelastic contacts with the specified parameters.Defaults to
None(hydroelastic disabled, same as Newton’s default).
- to_pipeline_args() dict[str, Any][source]#
Build keyword arguments for
newton.CollisionPipeline.Converts this configuration into the dict expected by
CollisionPipeline.__init__, handling nested config conversion (e.g.HydroelasticSDFCfg→HydroelasticSDF.Config).- Returns:
Keyword arguments suitable for
CollisionPipeline(model, **args).
- class isaaclab_newton.physics.HydroelasticSDFCfg[source]#
Bases:
objectConfiguration for SDF-based hydroelastic collision handling.
Hydroelastic contacts generate distributed contact areas instead of point contacts, providing more realistic force distribution for manipulation and compliant surfaces.
For more details, see the Newton hydroelastic contacts guide.
Attributes:
Whether to reduce contacts to a smaller representative set per shape pair.
(0, 1].
Whether to rotate reduced contact normals to align with aggregate force direction.
Whether to add an anchor contact at the center of pressure for each normal bin.
Contact area [m^2] used for non-penetrating contacts at the margin.
Whether to output hydroelastic contact surface vertices for visualization.
- reduce_contacts: bool#
Whether to reduce contacts to a smaller representative set per shape pair.
When False, all generated contacts are passed through without reduction.
Defaults to
True(same as Newton’s default).
- buffer_fraction: float#
(0, 1].
Lower values reduce memory usage but may cause overflows in dense scenes. Overflows are bounds-safe and emit warnings; increase this value when warnings appear.
Defaults to
1.0(same as Newton’s default).- Type:
Fraction of worst-case hydroelastic buffer allocations. Range
- normal_matching: bool#
Whether to rotate reduced contact normals to align with aggregate force direction.
Only active when
reduce_contactsis True.Defaults to
True(same as Newton’s default).
- anchor_contact: bool#
Whether to add an anchor contact at the center of pressure for each normal bin.
The anchor contact helps preserve moment balance. Only active when
reduce_contactsis True.Defaults to
False(same as Newton’s default).
- class isaaclab_newton.physics.NewtonShapeCfg[source]#
Bases:
objectDefault per-shape collision properties applied to all shapes in a Newton scene.
Mirrors Newton’s
ModelBuilder.default_shape_cfg. Only fields Isaac Lab actually overrides are declared here; unspecified fields keep Newton’s upstream default. The struct is forwarded onto Newton’s upstreamShapeConfigviachecked_apply()at builder construction.Attributes:
Solver Managers#
- class isaaclab_newton.physics.NewtonMJWarpManager[source]#
Bases:
NewtonManagerNewtonManagerspecialization for the MuJoCo Warp solver.Owns construction of
SolverMuJoCo, contact-buffer allocation in both internal-MuJoCo and Newton-pipeline contact modes, and the debug convergence logging emitted from_log_solver_debug()whenNewtonCfg.debug_modeis enabled.Methods:
Opt an articulation into the Newton actuator fast path.
add_contact_sensor([body_names_expr, ...])Add a contact sensor for reporting contacts between bodies/shapes.
add_frame_transform_sensor(shapes, ...)Add a frame transform sensor for measuring relative transforms.
add_imu_sensor(sites)Add an IMU sensor for measuring acceleration and angular velocity at sites.
add_model_change(change)Register a model change to notify the solver.
Hook after visualizers have stepped during
render().cl_register_site(body_pattern, xform)Register a site request for injection into prototypes before replication.
clear()Clear all Newton-specific state (callbacks cleared by super().close()).
Remove all registered callbacks.
close()Clean up Newton physics resources.
create_builder([up_axis])Create a
ModelBuilderconfigured with default settings.deregister_callback(callback_id)Remove a registered callback.
dispatch_event(event[, payload])Dispatch an event to all registered callbacks.
forward()Update articulation kinematics without stepping physics.
Get the tensor backend being used ("numpy" or "torch").
Get the control object.
Get the physics simulation device.
get_dt()Get the physics timestep.
Get the Newton model.
Get the physics timestep in seconds.
Get the list of registered views.
Return the SceneDataBackend for the SceneDataProvider.
Get the current simulation time in seconds.
Get the solver substep timestep.
get_state([scene_data_provider])Get the current Newton state for visualization.
Get the current state.
Get the next state.
Truewhenstep()executes the full decimation loop internally.initialize(sim_context)Initialize the manager with simulation context.
Initialize the solver and collision pipeline.
Create builder from USD stage.
invalidate_fk([env_mask, env_ids, ...])Mark environments as needing FK recomputation and solver reset.
Check if fabric interface is enabled (not applicable for Newton).
pause()Pause physics simulation.
play()Start or resume physics simulation.
Flush deferred Fabric writes before cameras/visualizers read the scene.
register_callback(callback, event[, order, ...])Register a callback.
register_post_actuator_callback(callback)Append a hook to the list invoked after the actuator step on every iteration.
Request an extended contact attribute (e.g.
"force").Request an extended state attribute (e.g.
"body_qdd").reset([soft])Reset physics simulation.
safe_callback_invoke(fn, *args[, ...])Invoke a callback, catching exceptions that would be swallowed by external event buses.
set_builder(builder)Set the Newton model builder.
set_decimation(decimation)Set the decimation count and re-capture the CUDA graph.
Start simulation by finalizing model and initializing state.
step()Step the physics simulation.
stop()Stop physics simulation.
Write Newton particle_q to Fabric mesh point arrays for Kit viewport rendering.
Write Newton body_q to USD Fabric world matrices for Kit viewport / RTX rendering.
update_visualization_state([scene_data_provider])Refresh visualization state for the active sim backend.
Block until the timeline is playing.
- classmethod activate_newton_actuator_path() None#
Opt an articulation into the Newton actuator fast path.
Idempotent — called by every Newton-fast-path articulation’s
_process_actuators_cfg:Sets
_use_newton_actuators_active, which_is_all_graphable()checks (adapter presence alone cannot distinguish the fast path from the standard Lab path).On first call, builds the single sim-level
NewtonActuatorAdapterover the full flat DOF layout; later calls reuse it.
- classmethod add_contact_sensor(body_names_expr: str | list[str] | None = None, shape_names_expr: str | list[str] | None = None, contact_partners_body_expr: str | list[str] | None = None, contact_partners_shape_expr: str | list[str] | None = None, verbose: bool = False) tuple[str | list[str] | None, str | list[str] | None, str | list[str] | None, str | list[str] | None]#
Add a contact sensor for reporting contacts between bodies/shapes.
Converts Isaac Lab pattern conventions (
.*regex, full USD paths) to fnmatch globs and delegates tonewton.sensors.SensorContact.- Parameters:
body_names_expr – Expression for body names to sense.
shape_names_expr – Expression for shape names to sense.
contact_partners_body_expr – Expression for contact partner body names.
contact_partners_shape_expr – Expression for contact partner shape names.
verbose – Print verbose information.
- classmethod add_frame_transform_sensor(shapes: list[int], reference_sites: list[int]) int#
Add a frame transform sensor for measuring relative transforms.
Creates a
SensorFrameTransformfrom pre-resolved shape and reference site indices, appends it to the internal list, and returns its index.- Parameters:
shapes – Ordered list of shape indices to measure.
reference_sites – 1:1 list of reference site indices (same length as shapes).
- Returns:
Index of the newly created sensor in
_newton_frame_transform_sensors.
- classmethod add_imu_sensor(sites: list[int]) int#
Add an IMU sensor for measuring acceleration and angular velocity at sites.
Creates a
newton.sensors.SensorIMUfrom pre-resolved site indices, appends it to the internal list, and returns its index.- Parameters:
sites – Ordered list of site indices (one per environment).
- Returns:
Index of the newly created sensor in the internal IMU sensor list.
- classmethod add_model_change(change: newton.solvers.SolverNotifyFlags) None#
Register a model change to notify the solver.
- classmethod after_visualizers_render() None#
Hook after visualizers have stepped during
render().Use for physics-backend sync (e.g. fabric) if needed. Recording pipelines (Kit/RTX, Newton GL video, etc.) run from
isaaclab.envs.utils.recording_hooksso they are not tied to a specific physics manager. Default is a no-op.
- classmethod cl_register_site(body_pattern: str | None, xform: warp.transform) str#
Register a site request for injection into prototypes before replication.
Sensors call this during
__init__. Sites are injected into prototype builders by_cl_inject_sites()(called fromnewton_replicate) beforeadd_builder, so they replicate correctly per-world.Identical
(body_pattern, transform)registrations share sites.The body_pattern is matched against prototype-local body labels (e.g.
"Robot/link.*") when replication is active, or against the flat builder’s body labels in the fallback path. Wildcard patterns that match multiple bodies create one site per matched body.- Parameters:
body_pattern – Regex pattern matched against body labels in the prototype builder (e.g.
"Robot/link0"or"Robot/finger.*"for multi-body wildcards), orNonefor global sites (world-origin reference, etc.).xform – Site transform relative to body.
- Returns:
Assigned site label suffix.
- classmethod clear()#
Clear all Newton-specific state (callbacks cleared by super().close()).
- classmethod clear_callbacks() None#
Remove all registered callbacks.
Do NOT reset
_callback_id— handle IDs must remain monotonically unique across the lifetime of the process. Resetting the counter would let a futureregister_callback()hand out an ID that an old, still-aliveCallbackHandle(e.g. on a sensor that has not been garbage-collected yet) holds, so when the old object eventually finalizes its__del__would deregister the new callback. This bit ovphysx’s kitless multi-context tests where twoInteractiveScene``s are created in sequence: the first scene's sensor would post-GC deregister the second scene's ``_initialize_callbackby ID collision, leaving the second sensor forever uninitialized.
- classmethod create_builder(up_axis: str | None = None, **kwargs) newton.ModelBuilder#
Create a
ModelBuilderconfigured with default settings.Forwards
NewtonShapeCfgdefaults onto Newton’s upstreamModelBuilder.default_shape_cfgviachecked_apply(). Falls back to wrapper defaults when no Newton config is active so rough-terrain margin/gap still apply during early construction.- Parameters:
up_axis – Override for the up-axis. Defaults to
None, which uses the manager’s_up_axis.**kwargs – Forwarded to
ModelBuilder.
- Returns:
New builder with up-axis and per-shape defaults (gap, margin) applied.
- classmethod deregister_callback(callback_id: int | CallbackHandle) None#
Remove a registered callback.
- Parameters:
callback_id – The ID or CallbackHandle returned by register_callback().
- classmethod dispatch_event(event: PhysicsEvent, payload: Any = None) None#
Dispatch an event to all registered callbacks.
This is the default implementation using simple callback lists. Subclasses may override or extend with platform-specific dispatch.
- Parameters:
event – The event to dispatch.
payload – Optional data to pass to callbacks.
- classmethod forward() None#
Update articulation kinematics without stepping physics.
Runs Newton’s generic forward kinematics (
eval_fk) over all articulations to compute body poses from joint coordinates. This is the full (unmasked) FK path used during initial setup. For incremental per-environment updates after resets, seeinvalidate_fk()which accumulates masks consumed bystep().
- classmethod get_control() newton.Control#
Get the control object.
- classmethod get_model() newton.Model#
Get the Newton model.
When the active sim backend is Newton this returns the manager’s own authoritative model. When the active sim backend is PhysX a shadow Newton model is built lazily (from the visualizer prebuilt artifact) so renderers/visualizers that operate on Newton
ModelandStatecan still drive a PhysX-simulated scene.
- classmethod get_physics_sim_view() list#
Get the list of registered views.
Assets can append their views to this list, and sensors can access them. Returns a list that callers can append to.
- Returns:
List of registered views (e.g., NewtonArticulationView instances).
- classmethod get_scene_data_backend() SceneDataBackend#
Return the SceneDataBackend for the SceneDataProvider.
- classmethod get_state(scene_data_provider=None) newton.State#
Get the current Newton state for visualization.
Use this method from visualizers/renderers/video recorders that need a backend-agnostic Newton
State. When the sim backend is PhysX this refreshes the shadow_state_0.body_qfrom the live PhysX scene viaupdate_visualization_state()before returning, so callers never observe stale transforms. Under the Newton sim backendupdate_visualization_state()is a no-op and this is equivalent toget_state_0().
- classmethod get_state_0() newton.State#
Get the current state.
- classmethod get_state_1() newton.State#
Get the next state.
- classmethod handles_decimation() bool#
Truewhenstep()executes the full decimation loop internally.This is the case when all Newton actuators are CUDA-graph-safe. The full decimation loop (including the trivial
decimation=1case) is folded into a singlestep()call.
- classmethod initialize(sim_context: SimulationContext) None#
Initialize the manager with simulation context.
- Parameters:
sim_context – Parent simulation context.
- classmethod initialize_solver() None#
Initialize the solver and collision pipeline.
Thin orchestrator: delegates solver construction to
_build_solver()(overridden by each solver subclass), allocates the collision pipeline (when applicable) via_initialize_contacts(), then sets up cubric bindings and either captures the CUDA graph immediately or defers capture until the firststep()call (RTX-active path).Warning
When using a CUDA-enabled device, the simulation is graphed. This means the function steps the simulation once to capture the graph, so it should only be called after everything else in the simulation is initialized.
- classmethod instantiate_builder_from_stage()#
Create builder from USD stage.
Detects env Xforms (e.g.
/World/Env_0,/World/Env_1) and builds each as a separate Newton world viabegin_world/end_world. Falls back to a flatadd_usdwhen no env Xforms are found.
- classmethod invalidate_fk(env_mask: wp.array | None = None, env_ids: wp.array | None = None, articulation_ids: wp.array | None = None) None#
Mark environments as needing FK recomputation and solver reset.
Called by asset write methods that modify joint coordinates or root transforms. The masks are consumed in
step()before physics stepping.- Parameters:
env_mask – Boolean mask of dirtied environments. Shape
(num_envs,). Used by_maskwrite methods.env_ids – Integer indices of dirtied environments. Used by
_indexwrite methods.articulation_ids – Mapping from
(world, arti)to model articulation index. Shape(world_count, count_per_world). Obtained fromArticulationView.articulation_ids.
- classmethod is_fabric_enabled() bool#
Check if fabric interface is enabled (not applicable for Newton).
- classmethod pre_render() None#
Flush deferred Fabric writes before cameras/visualizers read the scene.
- classmethod register_callback(callback: Callable, event: PhysicsEvent, order: int = 0, name: str | None = None, wrap_weak_ref: bool = True) CallbackHandle#
Register a callback. Passes event to parent class.
- classmethod register_post_actuator_callback(callback: Callable[[], None]) None#
Append a hook to the list invoked after the actuator step on every iteration.
Each callback runs inside the captured CUDA graph (when
_is_all_graphable()isTrue) right afterNewtonActuatorAdapter.step()and before the solver substeps, so kernel writes tostate/controlare visible to the integrator on the same iteration. Multiple articulations register their own implicit-DOF telemetry / FF-routing kernels here; all registered callbacks fire in registration order each step.
- classmethod request_extended_contact_attribute(attr: str) None#
Request an extended contact attribute (e.g.
"force").Sensors call this during
__init__, before model finalization. Attributes are forwarded to the model instart_simulation()so that subsequentContactscreation includes them.- Parameters:
attr – Contact attribute name.
- classmethod request_extended_state_attribute(attr: str) None#
Request an extended state attribute (e.g.
"body_qdd").Sensors call this during
__init__, before model finalization. Attributes are forwarded to the builder instart_simulation()so that subsequentmodel.state()calls allocate them.- Parameters:
attr – State attribute name (must be in
State.EXTENDED_ATTRIBUTES).
- classmethod reset(soft: bool = False) None#
Reset physics simulation.
- Parameters:
soft – If True, skip full reinitialization.
- static safe_callback_invoke(fn: Callable, *args, physics_manager: type[PhysicsManager] | None = None) None#
Invoke a callback, catching exceptions that would be swallowed by external event buses.
Ignores
ReferenceError(from garbage-collected weakref proxies). All other exceptions are forwarded to physics_manager.``store_callback_exception`` when available (see note below), or re-raised immediately otherwise.- Note (Octi):
The carb event bus used by PhysX/Omniverse silently swallows exceptions raised inside callbacks.
PhysxManagerworks around this by storing the exception and re-raising it after event dispatch completes (inreset()/step()). Backends that dispatch events directly (e.g. Newton) don’t need this — exceptions propagate normally — sostore_callback_exceptionis not called for them. This is a known wart; a cleaner solution is actively being explored.
- classmethod set_decimation(decimation: int) None#
Set the decimation count and re-capture the CUDA graph.
When all actuators are graphable the entire decimation loop (actuators + solver substeps, repeated decimation times) is captured as a single CUDA graph.
If a CUDA graph was previously captured, it is automatically re-captured with the new decimation count using the same strategy as
start_simulation(): standardwp.ScopedCapturewhen no USDRT stage is active, or deferred relaxed capture when RTX is running.
- classmethod start_simulation() None#
Start simulation by finalizing model and initializing state.
This function finalizes the model and initializes the simulation state. Note: Collision pipeline is initialized later in initialize_solver() after we determine whether the solver needs external collision detection.
- classmethod step() None#
Step the physics simulation.
The stepping logic follows one of two paths depending on whether all actuators are CUDA-graph-safe:
All-graphable path (
_simulate_full()):Actuators and solver substeps are captured together in a single CUDA graph containing the full
decimation x (actuators + solver substeps)loop.Eager-actuator path (fallback, some actuators not graph-safe):
Actuators are stepped eagerly on the CPU timeline (outside the graph), then a graph containing only the solver substeps is launched via
_simulate_physics_only().In both paths the sequence within one physics step is:
zero actuated DOFs in control.joint_f -> actuator.step (computes effort, writes to control.joint_f) -> solver.step x num_substeps (integrates, reads control.joint_f) -> sensors.update
- classmethod sync_particles_to_usd() None#
Write Newton particle_q to Fabric mesh point arrays for Kit viewport rendering.
For each deformable body whose mesh prim carries a
newton:particleOffsetattribute, this function copies the corresponding slice ofstate_0.particle_qinto the Fabricpointsarray so the Kit viewport reflects the current deformation.No-op when there is no
_usdrt_stage, no simulation state, or no deformable bodies registered.
- classmethod sync_transforms_to_usd() None#
Write Newton body_q to USD Fabric world matrices for Kit viewport / RTX rendering.
No-op when
_usdrt_stageis None (i.e. Kit visualizer is not active) or when transforms have not changed since the last sync.Called at render cadence by
pre_render()(viarender()). Physics stepping marks transforms dirty via_mark_transforms_dirty()so that the expensive Fabric hierarchy update only runs once per render frame rather than after every physics step.Uses
wp.fabricarraydirectly (noisaacsim.physics.newtonextension needed). The Warp kernel readsstate_0.body_q[newton_index[i]]and writes the correspondingmat44dtoomni:fabric:worldMatrixfor each prim.When cubric is available the method mirrors PhysX’s
DirectGpuHelperpattern: pause Fabric change tracking, write transforms, resume tracking, then callIAdapter::computeon the GPU to propagate the hierarchy and notify the Fabric Scene Delegate. Otherwise it falls back to the CPUupdate_world_xforms()path.
- classmethod update_visualization_state(scene_data_provider=None) None#
Refresh visualization state for the active sim backend.
Newton sim backend: no-op —
_state_0is the live, authoritative state already advanced bystep()/ forward kinematics.PhysX sim backend: pull rigid-body transforms from the
SceneDataProviderand write them into the shadow_state_0.body_qso Newton-native consumers (Newton renderer, Newton/Rerun/Viser visualizers, OVRTX renderer, Newton GL video) see fresh poses.Invoked lazily from
get_state()so consumers do not need to coordinate the sync explicitly.
- class isaaclab_newton.physics.NewtonXPBDManager[source]#
Bases:
NewtonManagerNewtonManagerspecialization for the XPBD solver.Always uses Newton’s
CollisionPipelinefor contact handling.Methods:
Opt an articulation into the Newton actuator fast path.
add_contact_sensor([body_names_expr, ...])Add a contact sensor for reporting contacts between bodies/shapes.
add_frame_transform_sensor(shapes, ...)Add a frame transform sensor for measuring relative transforms.
add_imu_sensor(sites)Add an IMU sensor for measuring acceleration and angular velocity at sites.
add_model_change(change)Register a model change to notify the solver.
Hook after visualizers have stepped during
render().cl_register_site(body_pattern, xform)Register a site request for injection into prototypes before replication.
clear()Clear all Newton-specific state (callbacks cleared by super().close()).
Remove all registered callbacks.
close()Clean up Newton physics resources.
create_builder([up_axis])Create a
ModelBuilderconfigured with default settings.deregister_callback(callback_id)Remove a registered callback.
dispatch_event(event[, payload])Dispatch an event to all registered callbacks.
forward()Update articulation kinematics without stepping physics.
Get the tensor backend being used ("numpy" or "torch").
Get the control object.
Get the physics simulation device.
get_dt()Get the physics timestep.
Get the Newton model.
Get the physics timestep in seconds.
Get the list of registered views.
Return the SceneDataBackend for the SceneDataProvider.
Get the current simulation time in seconds.
Get the solver substep timestep.
get_state([scene_data_provider])Get the current Newton state for visualization.
Get the current state.
Get the next state.
Truewhenstep()executes the full decimation loop internally.initialize(sim_context)Initialize the manager with simulation context.
Initialize the solver and collision pipeline.
Create builder from USD stage.
invalidate_fk([env_mask, env_ids, ...])Mark environments as needing FK recomputation and solver reset.
Check if fabric interface is enabled (not applicable for Newton).
pause()Pause physics simulation.
play()Start or resume physics simulation.
Flush deferred Fabric writes before cameras/visualizers read the scene.
register_callback(callback, event[, order, ...])Register a callback.
register_post_actuator_callback(callback)Append a hook to the list invoked after the actuator step on every iteration.
Request an extended contact attribute (e.g.
"force").Request an extended state attribute (e.g.
"body_qdd").reset([soft])Reset physics simulation.
safe_callback_invoke(fn, *args[, ...])Invoke a callback, catching exceptions that would be swallowed by external event buses.
set_builder(builder)Set the Newton model builder.
set_decimation(decimation)Set the decimation count and re-capture the CUDA graph.
Start simulation by finalizing model and initializing state.
step()Step the physics simulation.
stop()Stop physics simulation.
Write Newton particle_q to Fabric mesh point arrays for Kit viewport rendering.
Write Newton body_q to USD Fabric world matrices for Kit viewport / RTX rendering.
update_visualization_state([scene_data_provider])Refresh visualization state for the active sim backend.
Block until the timeline is playing.
- classmethod activate_newton_actuator_path() None#
Opt an articulation into the Newton actuator fast path.
Idempotent — called by every Newton-fast-path articulation’s
_process_actuators_cfg:Sets
_use_newton_actuators_active, which_is_all_graphable()checks (adapter presence alone cannot distinguish the fast path from the standard Lab path).On first call, builds the single sim-level
NewtonActuatorAdapterover the full flat DOF layout; later calls reuse it.
- classmethod add_contact_sensor(body_names_expr: str | list[str] | None = None, shape_names_expr: str | list[str] | None = None, contact_partners_body_expr: str | list[str] | None = None, contact_partners_shape_expr: str | list[str] | None = None, verbose: bool = False) tuple[str | list[str] | None, str | list[str] | None, str | list[str] | None, str | list[str] | None]#
Add a contact sensor for reporting contacts between bodies/shapes.
Converts Isaac Lab pattern conventions (
.*regex, full USD paths) to fnmatch globs and delegates tonewton.sensors.SensorContact.- Parameters:
body_names_expr – Expression for body names to sense.
shape_names_expr – Expression for shape names to sense.
contact_partners_body_expr – Expression for contact partner body names.
contact_partners_shape_expr – Expression for contact partner shape names.
verbose – Print verbose information.
- classmethod add_frame_transform_sensor(shapes: list[int], reference_sites: list[int]) int#
Add a frame transform sensor for measuring relative transforms.
Creates a
SensorFrameTransformfrom pre-resolved shape and reference site indices, appends it to the internal list, and returns its index.- Parameters:
shapes – Ordered list of shape indices to measure.
reference_sites – 1:1 list of reference site indices (same length as shapes).
- Returns:
Index of the newly created sensor in
_newton_frame_transform_sensors.
- classmethod add_imu_sensor(sites: list[int]) int#
Add an IMU sensor for measuring acceleration and angular velocity at sites.
Creates a
newton.sensors.SensorIMUfrom pre-resolved site indices, appends it to the internal list, and returns its index.- Parameters:
sites – Ordered list of site indices (one per environment).
- Returns:
Index of the newly created sensor in the internal IMU sensor list.
- classmethod add_model_change(change: newton.solvers.SolverNotifyFlags) None#
Register a model change to notify the solver.
- classmethod after_visualizers_render() None#
Hook after visualizers have stepped during
render().Use for physics-backend sync (e.g. fabric) if needed. Recording pipelines (Kit/RTX, Newton GL video, etc.) run from
isaaclab.envs.utils.recording_hooksso they are not tied to a specific physics manager. Default is a no-op.
- classmethod cl_register_site(body_pattern: str | None, xform: warp.transform) str#
Register a site request for injection into prototypes before replication.
Sensors call this during
__init__. Sites are injected into prototype builders by_cl_inject_sites()(called fromnewton_replicate) beforeadd_builder, so they replicate correctly per-world.Identical
(body_pattern, transform)registrations share sites.The body_pattern is matched against prototype-local body labels (e.g.
"Robot/link.*") when replication is active, or against the flat builder’s body labels in the fallback path. Wildcard patterns that match multiple bodies create one site per matched body.- Parameters:
body_pattern – Regex pattern matched against body labels in the prototype builder (e.g.
"Robot/link0"or"Robot/finger.*"for multi-body wildcards), orNonefor global sites (world-origin reference, etc.).xform – Site transform relative to body.
- Returns:
Assigned site label suffix.
- classmethod clear()#
Clear all Newton-specific state (callbacks cleared by super().close()).
- classmethod clear_callbacks() None#
Remove all registered callbacks.
Do NOT reset
_callback_id— handle IDs must remain monotonically unique across the lifetime of the process. Resetting the counter would let a futureregister_callback()hand out an ID that an old, still-aliveCallbackHandle(e.g. on a sensor that has not been garbage-collected yet) holds, so when the old object eventually finalizes its__del__would deregister the new callback. This bit ovphysx’s kitless multi-context tests where twoInteractiveScene``s are created in sequence: the first scene's sensor would post-GC deregister the second scene's ``_initialize_callbackby ID collision, leaving the second sensor forever uninitialized.
- classmethod create_builder(up_axis: str | None = None, **kwargs) newton.ModelBuilder#
Create a
ModelBuilderconfigured with default settings.Forwards
NewtonShapeCfgdefaults onto Newton’s upstreamModelBuilder.default_shape_cfgviachecked_apply(). Falls back to wrapper defaults when no Newton config is active so rough-terrain margin/gap still apply during early construction.- Parameters:
up_axis – Override for the up-axis. Defaults to
None, which uses the manager’s_up_axis.**kwargs – Forwarded to
ModelBuilder.
- Returns:
New builder with up-axis and per-shape defaults (gap, margin) applied.
- classmethod deregister_callback(callback_id: int | CallbackHandle) None#
Remove a registered callback.
- Parameters:
callback_id – The ID or CallbackHandle returned by register_callback().
- classmethod dispatch_event(event: PhysicsEvent, payload: Any = None) None#
Dispatch an event to all registered callbacks.
This is the default implementation using simple callback lists. Subclasses may override or extend with platform-specific dispatch.
- Parameters:
event – The event to dispatch.
payload – Optional data to pass to callbacks.
- classmethod forward() None#
Update articulation kinematics without stepping physics.
Runs Newton’s generic forward kinematics (
eval_fk) over all articulations to compute body poses from joint coordinates. This is the full (unmasked) FK path used during initial setup. For incremental per-environment updates after resets, seeinvalidate_fk()which accumulates masks consumed bystep().
- classmethod get_control() newton.Control#
Get the control object.
- classmethod get_model() newton.Model#
Get the Newton model.
When the active sim backend is Newton this returns the manager’s own authoritative model. When the active sim backend is PhysX a shadow Newton model is built lazily (from the visualizer prebuilt artifact) so renderers/visualizers that operate on Newton
ModelandStatecan still drive a PhysX-simulated scene.
- classmethod get_physics_sim_view() list#
Get the list of registered views.
Assets can append their views to this list, and sensors can access them. Returns a list that callers can append to.
- Returns:
List of registered views (e.g., NewtonArticulationView instances).
- classmethod get_scene_data_backend() SceneDataBackend#
Return the SceneDataBackend for the SceneDataProvider.
- classmethod get_state(scene_data_provider=None) newton.State#
Get the current Newton state for visualization.
Use this method from visualizers/renderers/video recorders that need a backend-agnostic Newton
State. When the sim backend is PhysX this refreshes the shadow_state_0.body_qfrom the live PhysX scene viaupdate_visualization_state()before returning, so callers never observe stale transforms. Under the Newton sim backendupdate_visualization_state()is a no-op and this is equivalent toget_state_0().
- classmethod get_state_0() newton.State#
Get the current state.
- classmethod get_state_1() newton.State#
Get the next state.
- classmethod handles_decimation() bool#
Truewhenstep()executes the full decimation loop internally.This is the case when all Newton actuators are CUDA-graph-safe. The full decimation loop (including the trivial
decimation=1case) is folded into a singlestep()call.
- classmethod initialize(sim_context: SimulationContext) None#
Initialize the manager with simulation context.
- Parameters:
sim_context – Parent simulation context.
- classmethod initialize_solver() None#
Initialize the solver and collision pipeline.
Thin orchestrator: delegates solver construction to
_build_solver()(overridden by each solver subclass), allocates the collision pipeline (when applicable) via_initialize_contacts(), then sets up cubric bindings and either captures the CUDA graph immediately or defers capture until the firststep()call (RTX-active path).Warning
When using a CUDA-enabled device, the simulation is graphed. This means the function steps the simulation once to capture the graph, so it should only be called after everything else in the simulation is initialized.
- classmethod instantiate_builder_from_stage()#
Create builder from USD stage.
Detects env Xforms (e.g.
/World/Env_0,/World/Env_1) and builds each as a separate Newton world viabegin_world/end_world. Falls back to a flatadd_usdwhen no env Xforms are found.
- classmethod invalidate_fk(env_mask: wp.array | None = None, env_ids: wp.array | None = None, articulation_ids: wp.array | None = None) None#
Mark environments as needing FK recomputation and solver reset.
Called by asset write methods that modify joint coordinates or root transforms. The masks are consumed in
step()before physics stepping.- Parameters:
env_mask – Boolean mask of dirtied environments. Shape
(num_envs,). Used by_maskwrite methods.env_ids – Integer indices of dirtied environments. Used by
_indexwrite methods.articulation_ids – Mapping from
(world, arti)to model articulation index. Shape(world_count, count_per_world). Obtained fromArticulationView.articulation_ids.
- classmethod is_fabric_enabled() bool#
Check if fabric interface is enabled (not applicable for Newton).
- classmethod pre_render() None#
Flush deferred Fabric writes before cameras/visualizers read the scene.
- classmethod register_callback(callback: Callable, event: PhysicsEvent, order: int = 0, name: str | None = None, wrap_weak_ref: bool = True) CallbackHandle#
Register a callback. Passes event to parent class.
- classmethod register_post_actuator_callback(callback: Callable[[], None]) None#
Append a hook to the list invoked after the actuator step on every iteration.
Each callback runs inside the captured CUDA graph (when
_is_all_graphable()isTrue) right afterNewtonActuatorAdapter.step()and before the solver substeps, so kernel writes tostate/controlare visible to the integrator on the same iteration. Multiple articulations register their own implicit-DOF telemetry / FF-routing kernels here; all registered callbacks fire in registration order each step.
- classmethod request_extended_contact_attribute(attr: str) None#
Request an extended contact attribute (e.g.
"force").Sensors call this during
__init__, before model finalization. Attributes are forwarded to the model instart_simulation()so that subsequentContactscreation includes them.- Parameters:
attr – Contact attribute name.
- classmethod request_extended_state_attribute(attr: str) None#
Request an extended state attribute (e.g.
"body_qdd").Sensors call this during
__init__, before model finalization. Attributes are forwarded to the builder instart_simulation()so that subsequentmodel.state()calls allocate them.- Parameters:
attr – State attribute name (must be in
State.EXTENDED_ATTRIBUTES).
- classmethod reset(soft: bool = False) None#
Reset physics simulation.
- Parameters:
soft – If True, skip full reinitialization.
- static safe_callback_invoke(fn: Callable, *args, physics_manager: type[PhysicsManager] | None = None) None#
Invoke a callback, catching exceptions that would be swallowed by external event buses.
Ignores
ReferenceError(from garbage-collected weakref proxies). All other exceptions are forwarded to physics_manager.``store_callback_exception`` when available (see note below), or re-raised immediately otherwise.- Note (Octi):
The carb event bus used by PhysX/Omniverse silently swallows exceptions raised inside callbacks.
PhysxManagerworks around this by storing the exception and re-raising it after event dispatch completes (inreset()/step()). Backends that dispatch events directly (e.g. Newton) don’t need this — exceptions propagate normally — sostore_callback_exceptionis not called for them. This is a known wart; a cleaner solution is actively being explored.
- classmethod set_decimation(decimation: int) None#
Set the decimation count and re-capture the CUDA graph.
When all actuators are graphable the entire decimation loop (actuators + solver substeps, repeated decimation times) is captured as a single CUDA graph.
If a CUDA graph was previously captured, it is automatically re-captured with the new decimation count using the same strategy as
start_simulation(): standardwp.ScopedCapturewhen no USDRT stage is active, or deferred relaxed capture when RTX is running.
- classmethod start_simulation() None#
Start simulation by finalizing model and initializing state.
This function finalizes the model and initializes the simulation state. Note: Collision pipeline is initialized later in initialize_solver() after we determine whether the solver needs external collision detection.
- classmethod step() None#
Step the physics simulation.
The stepping logic follows one of two paths depending on whether all actuators are CUDA-graph-safe:
All-graphable path (
_simulate_full()):Actuators and solver substeps are captured together in a single CUDA graph containing the full
decimation x (actuators + solver substeps)loop.Eager-actuator path (fallback, some actuators not graph-safe):
Actuators are stepped eagerly on the CPU timeline (outside the graph), then a graph containing only the solver substeps is launched via
_simulate_physics_only().In both paths the sequence within one physics step is:
zero actuated DOFs in control.joint_f -> actuator.step (computes effort, writes to control.joint_f) -> solver.step x num_substeps (integrates, reads control.joint_f) -> sensors.update
- classmethod sync_particles_to_usd() None#
Write Newton particle_q to Fabric mesh point arrays for Kit viewport rendering.
For each deformable body whose mesh prim carries a
newton:particleOffsetattribute, this function copies the corresponding slice ofstate_0.particle_qinto the Fabricpointsarray so the Kit viewport reflects the current deformation.No-op when there is no
_usdrt_stage, no simulation state, or no deformable bodies registered.
- classmethod sync_transforms_to_usd() None#
Write Newton body_q to USD Fabric world matrices for Kit viewport / RTX rendering.
No-op when
_usdrt_stageis None (i.e. Kit visualizer is not active) or when transforms have not changed since the last sync.Called at render cadence by
pre_render()(viarender()). Physics stepping marks transforms dirty via_mark_transforms_dirty()so that the expensive Fabric hierarchy update only runs once per render frame rather than after every physics step.Uses
wp.fabricarraydirectly (noisaacsim.physics.newtonextension needed). The Warp kernel readsstate_0.body_q[newton_index[i]]and writes the correspondingmat44dtoomni:fabric:worldMatrixfor each prim.When cubric is available the method mirrors PhysX’s
DirectGpuHelperpattern: pause Fabric change tracking, write transforms, resume tracking, then callIAdapter::computeon the GPU to propagate the hierarchy and notify the Fabric Scene Delegate. Otherwise it falls back to the CPUupdate_world_xforms()path.
- classmethod update_visualization_state(scene_data_provider=None) None#
Refresh visualization state for the active sim backend.
Newton sim backend: no-op —
_state_0is the live, authoritative state already advanced bystep()/ forward kinematics.PhysX sim backend: pull rigid-body transforms from the
SceneDataProviderand write them into the shadow_state_0.body_qso Newton-native consumers (Newton renderer, Newton/Rerun/Viser visualizers, OVRTX renderer, Newton GL video) see fresh poses.Invoked lazily from
get_state()so consumers do not need to coordinate the sync explicitly.
- class isaaclab_newton.physics.NewtonFeatherstoneManager[source]#
Bases:
NewtonManagerNewtonManagerspecialization for the Featherstone solver.Always uses Newton’s
CollisionPipelinefor contact handling.Methods:
Opt an articulation into the Newton actuator fast path.
add_contact_sensor([body_names_expr, ...])Add a contact sensor for reporting contacts between bodies/shapes.
add_frame_transform_sensor(shapes, ...)Add a frame transform sensor for measuring relative transforms.
add_imu_sensor(sites)Add an IMU sensor for measuring acceleration and angular velocity at sites.
add_model_change(change)Register a model change to notify the solver.
Hook after visualizers have stepped during
render().cl_register_site(body_pattern, xform)Register a site request for injection into prototypes before replication.
clear()Clear all Newton-specific state (callbacks cleared by super().close()).
Remove all registered callbacks.
close()Clean up Newton physics resources.
create_builder([up_axis])Create a
ModelBuilderconfigured with default settings.deregister_callback(callback_id)Remove a registered callback.
dispatch_event(event[, payload])Dispatch an event to all registered callbacks.
forward()Update articulation kinematics without stepping physics.
Get the tensor backend being used ("numpy" or "torch").
Get the control object.
Get the physics simulation device.
get_dt()Get the physics timestep.
Get the Newton model.
Get the physics timestep in seconds.
Get the list of registered views.
Return the SceneDataBackend for the SceneDataProvider.
Get the current simulation time in seconds.
Get the solver substep timestep.
get_state([scene_data_provider])Get the current Newton state for visualization.
Get the current state.
Get the next state.
Truewhenstep()executes the full decimation loop internally.initialize(sim_context)Initialize the manager with simulation context.
Initialize the solver and collision pipeline.
Create builder from USD stage.
invalidate_fk([env_mask, env_ids, ...])Mark environments as needing FK recomputation and solver reset.
Check if fabric interface is enabled (not applicable for Newton).
pause()Pause physics simulation.
play()Start or resume physics simulation.
Flush deferred Fabric writes before cameras/visualizers read the scene.
register_callback(callback, event[, order, ...])Register a callback.
register_post_actuator_callback(callback)Append a hook to the list invoked after the actuator step on every iteration.
Request an extended contact attribute (e.g.
"force").Request an extended state attribute (e.g.
"body_qdd").reset([soft])Reset physics simulation.
safe_callback_invoke(fn, *args[, ...])Invoke a callback, catching exceptions that would be swallowed by external event buses.
set_builder(builder)Set the Newton model builder.
set_decimation(decimation)Set the decimation count and re-capture the CUDA graph.
Start simulation by finalizing model and initializing state.
step()Step the physics simulation.
stop()Stop physics simulation.
Write Newton particle_q to Fabric mesh point arrays for Kit viewport rendering.
Write Newton body_q to USD Fabric world matrices for Kit viewport / RTX rendering.
update_visualization_state([scene_data_provider])Refresh visualization state for the active sim backend.
Block until the timeline is playing.
- classmethod activate_newton_actuator_path() None#
Opt an articulation into the Newton actuator fast path.
Idempotent — called by every Newton-fast-path articulation’s
_process_actuators_cfg:Sets
_use_newton_actuators_active, which_is_all_graphable()checks (adapter presence alone cannot distinguish the fast path from the standard Lab path).On first call, builds the single sim-level
NewtonActuatorAdapterover the full flat DOF layout; later calls reuse it.
- classmethod add_contact_sensor(body_names_expr: str | list[str] | None = None, shape_names_expr: str | list[str] | None = None, contact_partners_body_expr: str | list[str] | None = None, contact_partners_shape_expr: str | list[str] | None = None, verbose: bool = False) tuple[str | list[str] | None, str | list[str] | None, str | list[str] | None, str | list[str] | None]#
Add a contact sensor for reporting contacts between bodies/shapes.
Converts Isaac Lab pattern conventions (
.*regex, full USD paths) to fnmatch globs and delegates tonewton.sensors.SensorContact.- Parameters:
body_names_expr – Expression for body names to sense.
shape_names_expr – Expression for shape names to sense.
contact_partners_body_expr – Expression for contact partner body names.
contact_partners_shape_expr – Expression for contact partner shape names.
verbose – Print verbose information.
- classmethod add_frame_transform_sensor(shapes: list[int], reference_sites: list[int]) int#
Add a frame transform sensor for measuring relative transforms.
Creates a
SensorFrameTransformfrom pre-resolved shape and reference site indices, appends it to the internal list, and returns its index.- Parameters:
shapes – Ordered list of shape indices to measure.
reference_sites – 1:1 list of reference site indices (same length as shapes).
- Returns:
Index of the newly created sensor in
_newton_frame_transform_sensors.
- classmethod add_imu_sensor(sites: list[int]) int#
Add an IMU sensor for measuring acceleration and angular velocity at sites.
Creates a
newton.sensors.SensorIMUfrom pre-resolved site indices, appends it to the internal list, and returns its index.- Parameters:
sites – Ordered list of site indices (one per environment).
- Returns:
Index of the newly created sensor in the internal IMU sensor list.
- classmethod add_model_change(change: newton.solvers.SolverNotifyFlags) None#
Register a model change to notify the solver.
- classmethod after_visualizers_render() None#
Hook after visualizers have stepped during
render().Use for physics-backend sync (e.g. fabric) if needed. Recording pipelines (Kit/RTX, Newton GL video, etc.) run from
isaaclab.envs.utils.recording_hooksso they are not tied to a specific physics manager. Default is a no-op.
- classmethod cl_register_site(body_pattern: str | None, xform: warp.transform) str#
Register a site request for injection into prototypes before replication.
Sensors call this during
__init__. Sites are injected into prototype builders by_cl_inject_sites()(called fromnewton_replicate) beforeadd_builder, so they replicate correctly per-world.Identical
(body_pattern, transform)registrations share sites.The body_pattern is matched against prototype-local body labels (e.g.
"Robot/link.*") when replication is active, or against the flat builder’s body labels in the fallback path. Wildcard patterns that match multiple bodies create one site per matched body.- Parameters:
body_pattern – Regex pattern matched against body labels in the prototype builder (e.g.
"Robot/link0"or"Robot/finger.*"for multi-body wildcards), orNonefor global sites (world-origin reference, etc.).xform – Site transform relative to body.
- Returns:
Assigned site label suffix.
- classmethod clear()#
Clear all Newton-specific state (callbacks cleared by super().close()).
- classmethod clear_callbacks() None#
Remove all registered callbacks.
Do NOT reset
_callback_id— handle IDs must remain monotonically unique across the lifetime of the process. Resetting the counter would let a futureregister_callback()hand out an ID that an old, still-aliveCallbackHandle(e.g. on a sensor that has not been garbage-collected yet) holds, so when the old object eventually finalizes its__del__would deregister the new callback. This bit ovphysx’s kitless multi-context tests where twoInteractiveScene``s are created in sequence: the first scene's sensor would post-GC deregister the second scene's ``_initialize_callbackby ID collision, leaving the second sensor forever uninitialized.
- classmethod create_builder(up_axis: str | None = None, **kwargs) newton.ModelBuilder#
Create a
ModelBuilderconfigured with default settings.Forwards
NewtonShapeCfgdefaults onto Newton’s upstreamModelBuilder.default_shape_cfgviachecked_apply(). Falls back to wrapper defaults when no Newton config is active so rough-terrain margin/gap still apply during early construction.- Parameters:
up_axis – Override for the up-axis. Defaults to
None, which uses the manager’s_up_axis.**kwargs – Forwarded to
ModelBuilder.
- Returns:
New builder with up-axis and per-shape defaults (gap, margin) applied.
- classmethod deregister_callback(callback_id: int | CallbackHandle) None#
Remove a registered callback.
- Parameters:
callback_id – The ID or CallbackHandle returned by register_callback().
- classmethod dispatch_event(event: PhysicsEvent, payload: Any = None) None#
Dispatch an event to all registered callbacks.
This is the default implementation using simple callback lists. Subclasses may override or extend with platform-specific dispatch.
- Parameters:
event – The event to dispatch.
payload – Optional data to pass to callbacks.
- classmethod forward() None#
Update articulation kinematics without stepping physics.
Runs Newton’s generic forward kinematics (
eval_fk) over all articulations to compute body poses from joint coordinates. This is the full (unmasked) FK path used during initial setup. For incremental per-environment updates after resets, seeinvalidate_fk()which accumulates masks consumed bystep().
- classmethod get_control() newton.Control#
Get the control object.
- classmethod get_model() newton.Model#
Get the Newton model.
When the active sim backend is Newton this returns the manager’s own authoritative model. When the active sim backend is PhysX a shadow Newton model is built lazily (from the visualizer prebuilt artifact) so renderers/visualizers that operate on Newton
ModelandStatecan still drive a PhysX-simulated scene.
- classmethod get_physics_sim_view() list#
Get the list of registered views.
Assets can append their views to this list, and sensors can access them. Returns a list that callers can append to.
- Returns:
List of registered views (e.g., NewtonArticulationView instances).
- classmethod get_scene_data_backend() SceneDataBackend#
Return the SceneDataBackend for the SceneDataProvider.
- classmethod get_state(scene_data_provider=None) newton.State#
Get the current Newton state for visualization.
Use this method from visualizers/renderers/video recorders that need a backend-agnostic Newton
State. When the sim backend is PhysX this refreshes the shadow_state_0.body_qfrom the live PhysX scene viaupdate_visualization_state()before returning, so callers never observe stale transforms. Under the Newton sim backendupdate_visualization_state()is a no-op and this is equivalent toget_state_0().
- classmethod get_state_0() newton.State#
Get the current state.
- classmethod get_state_1() newton.State#
Get the next state.
- classmethod handles_decimation() bool#
Truewhenstep()executes the full decimation loop internally.This is the case when all Newton actuators are CUDA-graph-safe. The full decimation loop (including the trivial
decimation=1case) is folded into a singlestep()call.
- classmethod initialize(sim_context: SimulationContext) None#
Initialize the manager with simulation context.
- Parameters:
sim_context – Parent simulation context.
- classmethod initialize_solver() None#
Initialize the solver and collision pipeline.
Thin orchestrator: delegates solver construction to
_build_solver()(overridden by each solver subclass), allocates the collision pipeline (when applicable) via_initialize_contacts(), then sets up cubric bindings and either captures the CUDA graph immediately or defers capture until the firststep()call (RTX-active path).Warning
When using a CUDA-enabled device, the simulation is graphed. This means the function steps the simulation once to capture the graph, so it should only be called after everything else in the simulation is initialized.
- classmethod instantiate_builder_from_stage()#
Create builder from USD stage.
Detects env Xforms (e.g.
/World/Env_0,/World/Env_1) and builds each as a separate Newton world viabegin_world/end_world. Falls back to a flatadd_usdwhen no env Xforms are found.
- classmethod invalidate_fk(env_mask: wp.array | None = None, env_ids: wp.array | None = None, articulation_ids: wp.array | None = None) None#
Mark environments as needing FK recomputation and solver reset.
Called by asset write methods that modify joint coordinates or root transforms. The masks are consumed in
step()before physics stepping.- Parameters:
env_mask – Boolean mask of dirtied environments. Shape
(num_envs,). Used by_maskwrite methods.env_ids – Integer indices of dirtied environments. Used by
_indexwrite methods.articulation_ids – Mapping from
(world, arti)to model articulation index. Shape(world_count, count_per_world). Obtained fromArticulationView.articulation_ids.
- classmethod is_fabric_enabled() bool#
Check if fabric interface is enabled (not applicable for Newton).
- classmethod pre_render() None#
Flush deferred Fabric writes before cameras/visualizers read the scene.
- classmethod register_callback(callback: Callable, event: PhysicsEvent, order: int = 0, name: str | None = None, wrap_weak_ref: bool = True) CallbackHandle#
Register a callback. Passes event to parent class.
- classmethod register_post_actuator_callback(callback: Callable[[], None]) None#
Append a hook to the list invoked after the actuator step on every iteration.
Each callback runs inside the captured CUDA graph (when
_is_all_graphable()isTrue) right afterNewtonActuatorAdapter.step()and before the solver substeps, so kernel writes tostate/controlare visible to the integrator on the same iteration. Multiple articulations register their own implicit-DOF telemetry / FF-routing kernels here; all registered callbacks fire in registration order each step.
- classmethod request_extended_contact_attribute(attr: str) None#
Request an extended contact attribute (e.g.
"force").Sensors call this during
__init__, before model finalization. Attributes are forwarded to the model instart_simulation()so that subsequentContactscreation includes them.- Parameters:
attr – Contact attribute name.
- classmethod request_extended_state_attribute(attr: str) None#
Request an extended state attribute (e.g.
"body_qdd").Sensors call this during
__init__, before model finalization. Attributes are forwarded to the builder instart_simulation()so that subsequentmodel.state()calls allocate them.- Parameters:
attr – State attribute name (must be in
State.EXTENDED_ATTRIBUTES).
- classmethod reset(soft: bool = False) None#
Reset physics simulation.
- Parameters:
soft – If True, skip full reinitialization.
- static safe_callback_invoke(fn: Callable, *args, physics_manager: type[PhysicsManager] | None = None) None#
Invoke a callback, catching exceptions that would be swallowed by external event buses.
Ignores
ReferenceError(from garbage-collected weakref proxies). All other exceptions are forwarded to physics_manager.``store_callback_exception`` when available (see note below), or re-raised immediately otherwise.- Note (Octi):
The carb event bus used by PhysX/Omniverse silently swallows exceptions raised inside callbacks.
PhysxManagerworks around this by storing the exception and re-raising it after event dispatch completes (inreset()/step()). Backends that dispatch events directly (e.g. Newton) don’t need this — exceptions propagate normally — sostore_callback_exceptionis not called for them. This is a known wart; a cleaner solution is actively being explored.
- classmethod set_decimation(decimation: int) None#
Set the decimation count and re-capture the CUDA graph.
When all actuators are graphable the entire decimation loop (actuators + solver substeps, repeated decimation times) is captured as a single CUDA graph.
If a CUDA graph was previously captured, it is automatically re-captured with the new decimation count using the same strategy as
start_simulation(): standardwp.ScopedCapturewhen no USDRT stage is active, or deferred relaxed capture when RTX is running.
- classmethod start_simulation() None#
Start simulation by finalizing model and initializing state.
This function finalizes the model and initializes the simulation state. Note: Collision pipeline is initialized later in initialize_solver() after we determine whether the solver needs external collision detection.
- classmethod step() None#
Step the physics simulation.
The stepping logic follows one of two paths depending on whether all actuators are CUDA-graph-safe:
All-graphable path (
_simulate_full()):Actuators and solver substeps are captured together in a single CUDA graph containing the full
decimation x (actuators + solver substeps)loop.Eager-actuator path (fallback, some actuators not graph-safe):
Actuators are stepped eagerly on the CPU timeline (outside the graph), then a graph containing only the solver substeps is launched via
_simulate_physics_only().In both paths the sequence within one physics step is:
zero actuated DOFs in control.joint_f -> actuator.step (computes effort, writes to control.joint_f) -> solver.step x num_substeps (integrates, reads control.joint_f) -> sensors.update
- classmethod sync_particles_to_usd() None#
Write Newton particle_q to Fabric mesh point arrays for Kit viewport rendering.
For each deformable body whose mesh prim carries a
newton:particleOffsetattribute, this function copies the corresponding slice ofstate_0.particle_qinto the Fabricpointsarray so the Kit viewport reflects the current deformation.No-op when there is no
_usdrt_stage, no simulation state, or no deformable bodies registered.
- classmethod sync_transforms_to_usd() None#
Write Newton body_q to USD Fabric world matrices for Kit viewport / RTX rendering.
No-op when
_usdrt_stageis None (i.e. Kit visualizer is not active) or when transforms have not changed since the last sync.Called at render cadence by
pre_render()(viarender()). Physics stepping marks transforms dirty via_mark_transforms_dirty()so that the expensive Fabric hierarchy update only runs once per render frame rather than after every physics step.Uses
wp.fabricarraydirectly (noisaacsim.physics.newtonextension needed). The Warp kernel readsstate_0.body_q[newton_index[i]]and writes the correspondingmat44dtoomni:fabric:worldMatrixfor each prim.When cubric is available the method mirrors PhysX’s
DirectGpuHelperpattern: pause Fabric change tracking, write transforms, resume tracking, then callIAdapter::computeon the GPU to propagate the hierarchy and notify the Fabric Scene Delegate. Otherwise it falls back to the CPUupdate_world_xforms()path.
- classmethod update_visualization_state(scene_data_provider=None) None#
Refresh visualization state for the active sim backend.
Newton sim backend: no-op —
_state_0is the live, authoritative state already advanced bystep()/ forward kinematics.PhysX sim backend: pull rigid-body transforms from the
SceneDataProviderand write them into the shadow_state_0.body_qso Newton-native consumers (Newton renderer, Newton/Rerun/Viser visualizers, OVRTX renderer, Newton GL video) see fresh poses.Invoked lazily from
get_state()so consumers do not need to coordinate the sync explicitly.
- class isaaclab_newton.physics.NewtonKaminoManager[source]#
Bases:
NewtonManagerNewtonManagerspecialization for the Kamino solver.Uses Newton’s
CollisionPipelineunlessKaminoSolverCfg.use_collision_detectorisTrue, in which case Kamino’s internal collision detector handles contact generation.Methods:
step()Step the physics simulation.
Opt an articulation into the Newton actuator fast path.
add_contact_sensor([body_names_expr, ...])Add a contact sensor for reporting contacts between bodies/shapes.
add_frame_transform_sensor(shapes, ...)Add a frame transform sensor for measuring relative transforms.
add_imu_sensor(sites)Add an IMU sensor for measuring acceleration and angular velocity at sites.
add_model_change(change)Register a model change to notify the solver.
Hook after visualizers have stepped during
render().cl_register_site(body_pattern, xform)Register a site request for injection into prototypes before replication.
clear()Clear all Newton-specific state (callbacks cleared by super().close()).
Remove all registered callbacks.
close()Clean up Newton physics resources.
create_builder([up_axis])Create a
ModelBuilderconfigured with default settings.deregister_callback(callback_id)Remove a registered callback.
dispatch_event(event[, payload])Dispatch an event to all registered callbacks.
forward()Update articulation kinematics without stepping physics.
Get the tensor backend being used ("numpy" or "torch").
Get the control object.
Get the physics simulation device.
get_dt()Get the physics timestep.
Get the Newton model.
Get the physics timestep in seconds.
Get the list of registered views.
Return the SceneDataBackend for the SceneDataProvider.
Get the current simulation time in seconds.
Get the solver substep timestep.
get_state([scene_data_provider])Get the current Newton state for visualization.
Get the current state.
Get the next state.
Truewhenstep()executes the full decimation loop internally.initialize(sim_context)Initialize the manager with simulation context.
Initialize the solver and collision pipeline.
Create builder from USD stage.
invalidate_fk([env_mask, env_ids, ...])Mark environments as needing FK recomputation and solver reset.
Check if fabric interface is enabled (not applicable for Newton).
pause()Pause physics simulation.
play()Start or resume physics simulation.
Flush deferred Fabric writes before cameras/visualizers read the scene.
register_callback(callback, event[, order, ...])Register a callback.
register_post_actuator_callback(callback)Append a hook to the list invoked after the actuator step on every iteration.
Request an extended contact attribute (e.g.
"force").Request an extended state attribute (e.g.
"body_qdd").reset([soft])Reset physics simulation.
safe_callback_invoke(fn, *args[, ...])Invoke a callback, catching exceptions that would be swallowed by external event buses.
set_builder(builder)Set the Newton model builder.
set_decimation(decimation)Set the decimation count and re-capture the CUDA graph.
Start simulation by finalizing model and initializing state.
stop()Stop physics simulation.
Write Newton particle_q to Fabric mesh point arrays for Kit viewport rendering.
Write Newton body_q to USD Fabric world matrices for Kit viewport / RTX rendering.
update_visualization_state([scene_data_provider])Refresh visualization state for the active sim backend.
Block until the timeline is playing.
- classmethod activate_newton_actuator_path() None#
Opt an articulation into the Newton actuator fast path.
Idempotent — called by every Newton-fast-path articulation’s
_process_actuators_cfg:Sets
_use_newton_actuators_active, which_is_all_graphable()checks (adapter presence alone cannot distinguish the fast path from the standard Lab path).On first call, builds the single sim-level
NewtonActuatorAdapterover the full flat DOF layout; later calls reuse it.
- classmethod add_contact_sensor(body_names_expr: str | list[str] | None = None, shape_names_expr: str | list[str] | None = None, contact_partners_body_expr: str | list[str] | None = None, contact_partners_shape_expr: str | list[str] | None = None, verbose: bool = False) tuple[str | list[str] | None, str | list[str] | None, str | list[str] | None, str | list[str] | None]#
Add a contact sensor for reporting contacts between bodies/shapes.
Converts Isaac Lab pattern conventions (
.*regex, full USD paths) to fnmatch globs and delegates tonewton.sensors.SensorContact.- Parameters:
body_names_expr – Expression for body names to sense.
shape_names_expr – Expression for shape names to sense.
contact_partners_body_expr – Expression for contact partner body names.
contact_partners_shape_expr – Expression for contact partner shape names.
verbose – Print verbose information.
- classmethod add_frame_transform_sensor(shapes: list[int], reference_sites: list[int]) int#
Add a frame transform sensor for measuring relative transforms.
Creates a
SensorFrameTransformfrom pre-resolved shape and reference site indices, appends it to the internal list, and returns its index.- Parameters:
shapes – Ordered list of shape indices to measure.
reference_sites – 1:1 list of reference site indices (same length as shapes).
- Returns:
Index of the newly created sensor in
_newton_frame_transform_sensors.
- classmethod add_imu_sensor(sites: list[int]) int#
Add an IMU sensor for measuring acceleration and angular velocity at sites.
Creates a
newton.sensors.SensorIMUfrom pre-resolved site indices, appends it to the internal list, and returns its index.- Parameters:
sites – Ordered list of site indices (one per environment).
- Returns:
Index of the newly created sensor in the internal IMU sensor list.
- classmethod add_model_change(change: newton.solvers.SolverNotifyFlags) None#
Register a model change to notify the solver.
- classmethod after_visualizers_render() None#
Hook after visualizers have stepped during
render().Use for physics-backend sync (e.g. fabric) if needed. Recording pipelines (Kit/RTX, Newton GL video, etc.) run from
isaaclab.envs.utils.recording_hooksso they are not tied to a specific physics manager. Default is a no-op.
- classmethod cl_register_site(body_pattern: str | None, xform: warp.transform) str#
Register a site request for injection into prototypes before replication.
Sensors call this during
__init__. Sites are injected into prototype builders by_cl_inject_sites()(called fromnewton_replicate) beforeadd_builder, so they replicate correctly per-world.Identical
(body_pattern, transform)registrations share sites.The body_pattern is matched against prototype-local body labels (e.g.
"Robot/link.*") when replication is active, or against the flat builder’s body labels in the fallback path. Wildcard patterns that match multiple bodies create one site per matched body.- Parameters:
body_pattern – Regex pattern matched against body labels in the prototype builder (e.g.
"Robot/link0"or"Robot/finger.*"for multi-body wildcards), orNonefor global sites (world-origin reference, etc.).xform – Site transform relative to body.
- Returns:
Assigned site label suffix.
- classmethod clear()#
Clear all Newton-specific state (callbacks cleared by super().close()).
- classmethod clear_callbacks() None#
Remove all registered callbacks.
Do NOT reset
_callback_id— handle IDs must remain monotonically unique across the lifetime of the process. Resetting the counter would let a futureregister_callback()hand out an ID that an old, still-aliveCallbackHandle(e.g. on a sensor that has not been garbage-collected yet) holds, so when the old object eventually finalizes its__del__would deregister the new callback. This bit ovphysx’s kitless multi-context tests where twoInteractiveScene``s are created in sequence: the first scene's sensor would post-GC deregister the second scene's ``_initialize_callbackby ID collision, leaving the second sensor forever uninitialized.
- classmethod create_builder(up_axis: str | None = None, **kwargs) newton.ModelBuilder#
Create a
ModelBuilderconfigured with default settings.Forwards
NewtonShapeCfgdefaults onto Newton’s upstreamModelBuilder.default_shape_cfgviachecked_apply(). Falls back to wrapper defaults when no Newton config is active so rough-terrain margin/gap still apply during early construction.- Parameters:
up_axis – Override for the up-axis. Defaults to
None, which uses the manager’s_up_axis.**kwargs – Forwarded to
ModelBuilder.
- Returns:
New builder with up-axis and per-shape defaults (gap, margin) applied.
- classmethod deregister_callback(callback_id: int | CallbackHandle) None#
Remove a registered callback.
- Parameters:
callback_id – The ID or CallbackHandle returned by register_callback().
- classmethod dispatch_event(event: PhysicsEvent, payload: Any = None) None#
Dispatch an event to all registered callbacks.
This is the default implementation using simple callback lists. Subclasses may override or extend with platform-specific dispatch.
- Parameters:
event – The event to dispatch.
payload – Optional data to pass to callbacks.
- classmethod forward() None#
Update articulation kinematics without stepping physics.
Runs Newton’s generic forward kinematics (
eval_fk) over all articulations to compute body poses from joint coordinates. This is the full (unmasked) FK path used during initial setup. For incremental per-environment updates after resets, seeinvalidate_fk()which accumulates masks consumed bystep().
- classmethod get_control() newton.Control#
Get the control object.
- classmethod get_model() newton.Model#
Get the Newton model.
When the active sim backend is Newton this returns the manager’s own authoritative model. When the active sim backend is PhysX a shadow Newton model is built lazily (from the visualizer prebuilt artifact) so renderers/visualizers that operate on Newton
ModelandStatecan still drive a PhysX-simulated scene.
- classmethod get_physics_sim_view() list#
Get the list of registered views.
Assets can append their views to this list, and sensors can access them. Returns a list that callers can append to.
- Returns:
List of registered views (e.g., NewtonArticulationView instances).
- classmethod get_scene_data_backend() SceneDataBackend#
Return the SceneDataBackend for the SceneDataProvider.
- classmethod get_state(scene_data_provider=None) newton.State#
Get the current Newton state for visualization.
Use this method from visualizers/renderers/video recorders that need a backend-agnostic Newton
State. When the sim backend is PhysX this refreshes the shadow_state_0.body_qfrom the live PhysX scene viaupdate_visualization_state()before returning, so callers never observe stale transforms. Under the Newton sim backendupdate_visualization_state()is a no-op and this is equivalent toget_state_0().
- classmethod get_state_0() newton.State#
Get the current state.
- classmethod get_state_1() newton.State#
Get the next state.
- classmethod handles_decimation() bool#
Truewhenstep()executes the full decimation loop internally.This is the case when all Newton actuators are CUDA-graph-safe. The full decimation loop (including the trivial
decimation=1case) is folded into a singlestep()call.
- classmethod initialize(sim_context: SimulationContext) None#
Initialize the manager with simulation context.
- Parameters:
sim_context – Parent simulation context.
- classmethod initialize_solver() None#
Initialize the solver and collision pipeline.
Thin orchestrator: delegates solver construction to
_build_solver()(overridden by each solver subclass), allocates the collision pipeline (when applicable) via_initialize_contacts(), then sets up cubric bindings and either captures the CUDA graph immediately or defers capture until the firststep()call (RTX-active path).Warning
When using a CUDA-enabled device, the simulation is graphed. This means the function steps the simulation once to capture the graph, so it should only be called after everything else in the simulation is initialized.
- classmethod instantiate_builder_from_stage()#
Create builder from USD stage.
Detects env Xforms (e.g.
/World/Env_0,/World/Env_1) and builds each as a separate Newton world viabegin_world/end_world. Falls back to a flatadd_usdwhen no env Xforms are found.
- classmethod invalidate_fk(env_mask: wp.array | None = None, env_ids: wp.array | None = None, articulation_ids: wp.array | None = None) None#
Mark environments as needing FK recomputation and solver reset.
Called by asset write methods that modify joint coordinates or root transforms. The masks are consumed in
step()before physics stepping.- Parameters:
env_mask – Boolean mask of dirtied environments. Shape
(num_envs,). Used by_maskwrite methods.env_ids – Integer indices of dirtied environments. Used by
_indexwrite methods.articulation_ids – Mapping from
(world, arti)to model articulation index. Shape(world_count, count_per_world). Obtained fromArticulationView.articulation_ids.
- classmethod is_fabric_enabled() bool#
Check if fabric interface is enabled (not applicable for Newton).
- classmethod pre_render() None#
Flush deferred Fabric writes before cameras/visualizers read the scene.
- classmethod register_callback(callback: Callable, event: PhysicsEvent, order: int = 0, name: str | None = None, wrap_weak_ref: bool = True) CallbackHandle#
Register a callback. Passes event to parent class.
- classmethod register_post_actuator_callback(callback: Callable[[], None]) None#
Append a hook to the list invoked after the actuator step on every iteration.
Each callback runs inside the captured CUDA graph (when
_is_all_graphable()isTrue) right afterNewtonActuatorAdapter.step()and before the solver substeps, so kernel writes tostate/controlare visible to the integrator on the same iteration. Multiple articulations register their own implicit-DOF telemetry / FF-routing kernels here; all registered callbacks fire in registration order each step.
- classmethod request_extended_contact_attribute(attr: str) None#
Request an extended contact attribute (e.g.
"force").Sensors call this during
__init__, before model finalization. Attributes are forwarded to the model instart_simulation()so that subsequentContactscreation includes them.- Parameters:
attr – Contact attribute name.
- classmethod request_extended_state_attribute(attr: str) None#
Request an extended state attribute (e.g.
"body_qdd").Sensors call this during
__init__, before model finalization. Attributes are forwarded to the builder instart_simulation()so that subsequentmodel.state()calls allocate them.- Parameters:
attr – State attribute name (must be in
State.EXTENDED_ATTRIBUTES).
- classmethod reset(soft: bool = False) None#
Reset physics simulation.
- Parameters:
soft – If True, skip full reinitialization.
- static safe_callback_invoke(fn: Callable, *args, physics_manager: type[PhysicsManager] | None = None) None#
Invoke a callback, catching exceptions that would be swallowed by external event buses.
Ignores
ReferenceError(from garbage-collected weakref proxies). All other exceptions are forwarded to physics_manager.``store_callback_exception`` when available (see note below), or re-raised immediately otherwise.- Note (Octi):
The carb event bus used by PhysX/Omniverse silently swallows exceptions raised inside callbacks.
PhysxManagerworks around this by storing the exception and re-raising it after event dispatch completes (inreset()/step()). Backends that dispatch events directly (e.g. Newton) don’t need this — exceptions propagate normally — sostore_callback_exceptionis not called for them. This is a known wart; a cleaner solution is actively being explored.
- classmethod set_decimation(decimation: int) None#
Set the decimation count and re-capture the CUDA graph.
When all actuators are graphable the entire decimation loop (actuators + solver substeps, repeated decimation times) is captured as a single CUDA graph.
If a CUDA graph was previously captured, it is automatically re-captured with the new decimation count using the same strategy as
start_simulation(): standardwp.ScopedCapturewhen no USDRT stage is active, or deferred relaxed capture when RTX is running.
- classmethod start_simulation() None#
Start simulation by finalizing model and initializing state.
This function finalizes the model and initializes the simulation state. Note: Collision pipeline is initialized later in initialize_solver() after we determine whether the solver needs external collision detection.
- classmethod sync_particles_to_usd() None#
Write Newton particle_q to Fabric mesh point arrays for Kit viewport rendering.
For each deformable body whose mesh prim carries a
newton:particleOffsetattribute, this function copies the corresponding slice ofstate_0.particle_qinto the Fabricpointsarray so the Kit viewport reflects the current deformation.No-op when there is no
_usdrt_stage, no simulation state, or no deformable bodies registered.
- classmethod sync_transforms_to_usd() None#
Write Newton body_q to USD Fabric world matrices for Kit viewport / RTX rendering.
No-op when
_usdrt_stageis None (i.e. Kit visualizer is not active) or when transforms have not changed since the last sync.Called at render cadence by
pre_render()(viarender()). Physics stepping marks transforms dirty via_mark_transforms_dirty()so that the expensive Fabric hierarchy update only runs once per render frame rather than after every physics step.Uses
wp.fabricarraydirectly (noisaacsim.physics.newtonextension needed). The Warp kernel readsstate_0.body_q[newton_index[i]]and writes the correspondingmat44dtoomni:fabric:worldMatrixfor each prim.When cubric is available the method mirrors PhysX’s
DirectGpuHelperpattern: pause Fabric change tracking, write transforms, resume tracking, then callIAdapter::computeon the GPU to propagate the hierarchy and notify the Fabric Scene Delegate. Otherwise it falls back to the CPUupdate_world_xforms()path.
- classmethod update_visualization_state(scene_data_provider=None) None#
Refresh visualization state for the active sim backend.
Newton sim backend: no-op —
_state_0is the live, authoritative state already advanced bystep()/ forward kinematics.PhysX sim backend: pull rigid-body transforms from the
SceneDataProviderand write them into the shadow_state_0.body_qso Newton-native consumers (Newton renderer, Newton/Rerun/Viser visualizers, OVRTX renderer, Newton GL video) see fresh poses.Invoked lazily from
get_state()so consumers do not need to coordinate the sync explicitly.