Source code for isaaclab_newton.physics.xpbd_manager
# Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
"""XPBD Newton manager."""
from __future__ import annotations
from newton import Model
from newton.solvers import SolverXPBD
from .newton_manager import NewtonManager
from .xpbd_manager_cfg import XPBDSolverCfg
[docs]
class NewtonXPBDManager(NewtonManager):
""":class:`NewtonManager` specialization for the XPBD solver.
Always uses Newton's :class:`CollisionPipeline` for contact handling.
"""
@classmethod
def _create_solver(cls, model: Model, solver_cfg: XPBDSolverCfg) -> SolverXPBD:
"""Construct the configured XPBD solver."""
return SolverXPBD(model, **cls._filter_solver_kwargs(SolverXPBD, solver_cfg))
@classmethod
def _build_solver(cls, model: Model, solver_cfg: XPBDSolverCfg) -> None:
"""Construct :class:`SolverXPBD` and populate the base-class slots.
XPBD always uses Newton's :class:`CollisionPipeline` and steps with
separate input/output states, so the flags are fixed.
"""
NewtonManager._solver = cls._create_solver(model, solver_cfg)
NewtonManager._use_single_state = False
NewtonManager._needs_collision_pipeline = True