GpuSimulationView#

Fully qualified name: isaacsim::physics::newton::tensors::GpuSimulationView

class GpuSimulationView : public isaacsim::physics::newton::tensors::BaseSimulationView#

GPU simulation view. Reports the CUDA device ordinal and creates Gpu* child views.

Public Functions

explicit GpuSimulationView(SimViewInit &&init)#

Constructs a GpuSimulationView.

Parameters:

init[in] Initialization parameters for the simulation view.

~GpuSimulationView() override = default#
int getDeviceOrdinal() const override#

Returns the device ordinal that the view operates on.

Returns:

The requested value.

int getParamDeviceOrdinal() const override#

Returns the device ordinal used for parameter tensors.

Returns:

The requested value.

void *getCudaContext() const override#

Returns the CUDA context associated with the view.

Returns:

Pointer to the requested object, or nullptr if unavailable.

bool getValid() const override#

Returns whether the view is currently valid.

Returns:

True on success; false otherwise.

void invalidate() override#

Marks the view as invalid.

bool check() const override#

Checks whether the view and its backing data are still valid.

Returns:

True on success; false otherwise.

bool setSubspaceRoots(const char *pattern) override#

Sets the subspace roots.

Parameters:

pattern[in] USD path pattern used to match prims.

Returns:

True on success; false otherwise.

void step(float dt) override#

Advances the simulation by the given time step.

Parameters:

dt[in] Time step, in seconds.

bool setGravity(const carb::Float3 &gravity) override#

Sets the gravity.

Parameters:

gravity[in] Gravity vector to apply, in meters per second squared.

Returns:

True on success; false otherwise.

bool getGravity(carb::Float3 &gravity) override#

Gets the gravity.

Parameters:

gravity[out] Receives the current gravity vector, in meters per second squared.

Returns:

True on success; false otherwise.

ObjectType getObjectType(const char *path) override#

Gets the object type.

Parameters:

path[in] USD prim path to query.

Returns:

The requested value.

void clearForces() override#

Clears the accumulated forces on all bodies.

bool flush() override#

Flushes pending changes to the simulation backend.

Returns:

True on success; false otherwise.

void updateArticulationsKinematic() override#

Updates articulation link transforms from the current joint state.

void InitializeKinematicBodies() override#

Initializes the kinematic bodies tracked by the view.

void enableGpuUsageWarnings(bool enable) override#

Sets whether to enable the GPU usage warnings.

Parameters:

enable[in] If true, enables the behavior; otherwise disables it.

void release(bool recursive) override#

Releases the view and frees its associated resources.

Parameters:

recursive[in] If true, also releases child views recursively.

ISdfShapeView *createSdfShapeView(
const char *pattern,
uint32_t numSamplePoints,
) override#

Creates the SDF shape view matching the given pattern.

Parameters:
  • pattern[in] USD path pattern used to match prims.

  • numSamplePoints[in] Number of sample points to use.

Returns:

Pointer to the newly created view, or nullptr on failure.

IDeformableBodyView *createVolumeDeformableBodyView(
const char *pattern,
) override#

Creates the volume deformable body view matching the given pattern.

Parameters:

pattern[in] USD path pattern used to match prims.

Returns:

Pointer to the newly created view, or nullptr on failure.

IDeformableBodyView *createVolumeDeformableBodyView(
const std::vector<std::string> &patterns,
) override#

Creates the volume deformable body view matching the given patterns.

Parameters:

patterns[in] List of USD path patterns used to match prims.

Returns:

Pointer to the newly created view, or nullptr on failure.

IDeformableBodyView *createSurfaceDeformableBodyView(
const char *pattern,
) override#

Creates the surface deformable body view matching the given pattern.

Parameters:

pattern[in] USD path pattern used to match prims.

Returns:

Pointer to the newly created view, or nullptr on failure.

IDeformableBodyView *createSurfaceDeformableBodyView(
const std::vector<std::string> &patterns,
) override#

Creates the surface deformable body view matching the given patterns.

Parameters:

patterns[in] List of USD path patterns used to match prims.

Returns:

Pointer to the newly created view, or nullptr on failure.

IDeformableMaterialView *createDeformableMaterialView(
const char *pattern,
) override#

Creates the deformable material view matching the given pattern.

Parameters:

pattern[in] USD path pattern used to match prims.

Returns:

Pointer to the newly created view, or nullptr on failure.

IDeformableMaterialView *createDeformableMaterialView(
const std::vector<std::string> &patterns,
) override#

Creates the deformable material view matching the given patterns.

Parameters:

patterns[in] List of USD path patterns used to match prims.

Returns:

Pointer to the newly created view, or nullptr on failure.

IArticulationView *createArticulationView(
const char *pattern,
) override#

Creates the articulation view matching the given pattern.

Parameters:

pattern[in] USD path pattern used to match prims.

Returns:

Pointer to the newly created view, or nullptr on failure.

IArticulationView *createArticulationView(
const std::vector<std::string> &patterns,
) override#

Creates the articulation view matching the given patterns.

Parameters:

patterns[in] List of USD path patterns used to match prims.

Returns:

Pointer to the newly created view, or nullptr on failure.

IRigidBodyView *createRigidBodyView(const char *pattern) override#

Creates the rigid body view matching the given pattern.

Parameters:

pattern[in] USD path pattern used to match prims.

Returns:

Pointer to the newly created view, or nullptr on failure.

IRigidBodyView *createRigidBodyView(
const std::vector<std::string> &patterns,
) override#

Creates the rigid body view matching the given patterns.

Parameters:

patterns[in] List of USD path patterns used to match prims.

Returns:

Pointer to the newly created view, or nullptr on failure.

IRigidContactView *createRigidContactView(
const char *pattern,
const char **filterPatterns,
uint32_t numFilterPatterns,
uint32_t maxContactDataCount,
) override#

Creates the rigid contact view matching the given pattern.

Parameters:
  • pattern[in] USD path pattern used to match prims.

  • filterPatterns[in] USD path patterns used to match filter prims.

  • numFilterPatterns[in] Number of filter patterns.

  • maxContactDataCount[in] Maximum number of contact data entries to report.

Returns:

Pointer to the newly created view, or nullptr on failure.

IRigidContactView *createRigidContactView(
std::string pattern,
const std::vector<std::string> &filterPatterns,
uint32_t maxContactDataCount,
) override#

Creates the rigid contact view matching the given pattern.

Parameters:
  • pattern[in] USD path pattern used to match prims.

  • filterPatterns[in] USD path patterns used to match filter prims.

  • maxContactDataCount[in] Maximum number of contact data entries to report.

Returns:

Pointer to the newly created view, or nullptr on failure.

IRigidContactView *createRigidContactView(
const std::vector<std::string> &patterns,
const std::vector<std::vector<std::string>> &filterPatterns,
uint32_t maxContactDataCount,
) override#

Creates the rigid contact view matching the given patterns.

Parameters:
  • patterns[in] List of USD path patterns used to match prims.

  • filterPatterns[in] USD path patterns used to match filter prims.

  • maxContactDataCount[in] Maximum number of contact data entries to report.

Returns:

Pointer to the newly created view, or nullptr on failure.

inline int getSimDeviceOrdinal() const#

Returns the device ordinal of the simulation.

Returns:

The requested value.

inline py::object &getNewtonStage()#

Returns the Newton stage object backing the view.

Returns:

Reference to the requested object.

inline py::object &getModel()#

Returns the Newton model object backing the view.

Returns:

Reference to the requested object.

Public Static Functions

static SimViewInit initNewton(long stageId)#

Acquires the GIL, imports the Newton Python module, obtains the NewtonStage and model, and reads the simulation device ordinal.

Protected Functions

virtual IArticulationView *_makeArticulationView(
py::object newtonStage,
const std::vector<pxr::SdfPath> &paths,
) override#

Device-specific factory methods. Overridden by CpuSimulationView and GpuSimulationView to instantiate the appropriate Cpu* or Gpu* view class.

virtual IRigidBodyView *_makeRigidBodyView(
py::object newtonStage,
const std::vector<pxr::SdfPath> &paths,
) override#

Creates the rigid body view.

Parameters:
  • newtonStage[in] Newton stage object backing the view.

  • paths[in] USD prim paths backing the view.

Returns:

Pointer to the newly created view, or nullptr on failure.

virtual IRigidContactView *_makeRigidContactView(
py::object newtonStage,
const std::vector<std::string> &sensorPaths,
const std::vector<std::vector<std::string>> &filterPaths,
uint32_t maxContactDataCount,
) override#

Creates the rigid contact view.

Parameters:
  • newtonStage[in] Newton stage object backing the view.

  • sensorPaths[in] USD prim paths of the contact sensors.

  • filterPaths[in] Filter paths.

  • maxContactDataCount[in] Maximum number of contact data entries to report.

Returns:

Pointer to the newly created view, or nullptr on failure.

void _findMatchingPaths(
const std::string &pattern,
std::vector<pxr::SdfPath> &pathsRet,
)#

Finds the matching paths.

Parameters:
  • pattern[in] USD path pattern used to match prims.

  • pathsRet[in] Paths ret.

void _findMatchingChildren(
const pxr::UsdPrim &prim,
const std::string &pattern,
std::vector<pxr::UsdPrim> &matchesRet,
)#

Finds the matching children.

Parameters:
  • prim[in] Prim.

  • pattern[in] USD path pattern used to match prims.

  • matchesRet[in] Matches ret.

Protected Attributes

py::object m_usdStage#

Value.

py::object m_newtonStage#

Value.

py::object m_model#

Value.

int m_simDeviceOrdinal#

Value.

bool m_valid#

Value.

carb::Float3 m_gravity = {0.0f, 0.0f, -9.81f}#

Value.