GpuRigidBodyView#

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

class GpuRigidBodyView : public isaacsim::physics::newton::tensors::BaseRigidBodyView#

GPU rigid body view. Implements getters via CUDA gather kernels with D2H staging, and setters via fused CUDA scatter kernels. Supports GC configuration.

Public Functions

GpuRigidBodyView(
py::object newtonStage,
const std::vector<pxr::SdfPath> &bodyPaths,
int deviceOrdinal,
)#

Constructs a GpuRigidBodyView.

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

  • bodyPaths[in] USD prim paths of the rigid bodies.

  • deviceOrdinal[in] Device ordinal.

~GpuRigidBodyView() override#
bool getTransforms(const TensorDesc *dstTensor) const override#

Gets the transforms.

Parameters:

dstTensor[out] Destination tensor that receives the requested values.

Returns:

True on success; false otherwise.

bool getVelocities(const TensorDesc *dstTensor) const override#

Gets the velocities.

Parameters:

dstTensor[out] Destination tensor that receives the requested values.

Returns:

True on success; false otherwise.

bool getAccelerations(const TensorDesc *dstTensor) const override#

Gets the accelerations.

Parameters:

dstTensor[out] Destination tensor that receives the requested values.

Returns:

True on success; false otherwise.

bool getMasses(const TensorDesc *dstTensor) const override#

Gets the masses.

Parameters:

dstTensor[out] Destination tensor that receives the requested values.

Returns:

True on success; false otherwise.

bool getInvMasses(const TensorDesc *dstTensor) const override#

Gets the inverse masses.

Parameters:

dstTensor[out] Destination tensor that receives the requested values.

Returns:

True on success; false otherwise.

bool getCOMs(const TensorDesc *dstTensor) const override#

Gets the COMs.

Parameters:

dstTensor[out] Destination tensor that receives the requested values.

Returns:

True on success; false otherwise.

bool getInertias(const TensorDesc *dstTensor) const override#

Gets the inertias.

Parameters:

dstTensor[out] Destination tensor that receives the requested values.

Returns:

True on success; false otherwise.

bool getInvInertias(const TensorDesc *dstTensor) const override#

Gets the inverse inertias.

Parameters:

dstTensor[out] Destination tensor that receives the requested values.

Returns:

True on success; false otherwise.

bool setTransforms(
const TensorDesc *srcTensor,
const TensorDesc *indexTensor,
) override#

Sets the transforms.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • indexTensor[in] Tensor of view indices selecting which elements to write.

Returns:

True on success; false otherwise.

bool setVelocities(
const TensorDesc *srcTensor,
const TensorDesc *indexTensor,
) override#

Sets the velocities.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • indexTensor[in] Tensor of view indices selecting which elements to write.

Returns:

True on success; false otherwise.

bool setMasses(
const TensorDesc *srcTensor,
const TensorDesc *indexTensor,
) override#

Sets the masses.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • indexTensor[in] Tensor of view indices selecting which elements to write.

Returns:

True on success; false otherwise.

bool setCOMs(
const TensorDesc *srcTensor,
const TensorDesc *indexTensor,
) override#

Sets the COMs.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • indexTensor[in] Tensor of view indices selecting which elements to write.

Returns:

True on success; false otherwise.

bool setInertias(
const TensorDesc *srcTensor,
const TensorDesc *indexTensor,
) override#

Sets the inertias.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • indexTensor[in] Tensor of view indices selecting which elements to write.

Returns:

True on success; false otherwise.

bool applyForces(
const TensorDesc *srcTensor,
const TensorDesc *indexTensor,
) override#

Applies the forces.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • indexTensor[in] Tensor of view indices selecting which elements to write.

Returns:

True on success; false otherwise.

bool applyForcesAndTorquesAtPosition(
const TensorDesc *srcForceTensor,
const TensorDesc *srcTorqueTensor,
const TensorDesc *srcPositionTensor,
const TensorDesc *indexTensor,
bool isGlobal,
) override#

Applies the forces and torques at position.

Parameters:
  • srcForceTensor[in] Source tensor of forces to apply.

  • srcTorqueTensor[in] Source tensor of torques to apply.

  • srcPositionTensor[in] Source tensor of positions at which the forces are applied.

  • indexTensor[in] Tensor of view indices selecting which elements to write.

  • isGlobal[in] If true, the inputs are expressed in the world frame; otherwise in the local frame.

Returns:

True on success; false otherwise.

uint32_t getCount() const override#

Returns the number of elements in the view.

Returns:

The requested value.

uint32_t getMaxShapes() const override#

Returns the maximum shape count across all elements in the view.

Returns:

The requested value.

const char *getUsdPrimPath(uint32_t rbIdx) const override#

Gets the USD prim path.

Parameters:

rbIdx[in] Zero-based rigid body index within the view.

Returns:

Pointer to the requested null-terminated string, or nullptr if unavailable.

bool setKinematicTargets(
const TensorDesc *srcTensor,
const TensorDesc *indexTensor,
) override#

Sets the kinematic targets.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • indexTensor[in] Tensor of view indices selecting which elements to write.

Returns:

True on success; false otherwise.

bool setKinematicTargetsMasked(
const TensorDesc *srcTensor,
const TensorDesc *maskTensor,
) override#

Sets the kinematic targets for the elements selected by a boolean mask.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • maskTensor[in] Boolean mask tensor selecting which elements to write.

Returns:

True on success; false otherwise.

bool getDisableGravities(const TensorDesc *dstTensor) const override#

Gets the disable gravities.

Parameters:

dstTensor[out] Destination tensor that receives the requested values.

Returns:

True on success; false otherwise.

bool getDisableSimulations(
const TensorDesc *dstTensor,
) const override#

Gets the disable simulations.

Parameters:

dstTensor[out] Destination tensor that receives the requested values.

Returns:

True on success; false otherwise.

bool setDisableGravities(
const TensorDesc *srcTensor,
const TensorDesc *indexTensor,
) override#

Sets the disable gravities.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • indexTensor[in] Tensor of view indices selecting which elements to write.

Returns:

True on success; false otherwise.

bool setDisableSimulations(
const TensorDesc *srcTensor,
const TensorDesc *indexTensor,
) override#

Sets the disable simulations.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • indexTensor[in] Tensor of view indices selecting which elements to write.

Returns:

True on success; false otherwise.

bool setDisableGravitiesMasked(
const TensorDesc *srcTensor,
const TensorDesc *maskTensor,
) override#

Sets the disable gravities for the elements selected by a boolean mask.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • maskTensor[in] Boolean mask tensor selecting which elements to write.

Returns:

True on success; false otherwise.

bool setDisableSimulationsMasked(
const TensorDesc *srcTensor,
const TensorDesc *maskTensor,
) override#

Sets the disable simulations for the elements selected by a boolean mask.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • maskTensor[in] Boolean mask tensor selecting which elements to write.

Returns:

True on success; false otherwise.

bool wakeUp(const TensorDesc *indexTensor) override#

Wakes up the up.

Parameters:

indexTensor[in] Tensor of view indices selecting which elements to write.

Returns:

True on success; false otherwise.

bool setTransformsMasked(
const TensorDesc *srcTensor,
const TensorDesc *maskTensor,
) override#

Sets the transforms for the elements selected by a boolean mask.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • maskTensor[in] Boolean mask tensor selecting which elements to write.

Returns:

True on success; false otherwise.

bool setVelocitiesMasked(
const TensorDesc *srcTensor,
const TensorDesc *maskTensor,
) override#

Sets the velocities for the elements selected by a boolean mask.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • maskTensor[in] Boolean mask tensor selecting which elements to write.

Returns:

True on success; false otherwise.

bool applyForcesMasked(
const TensorDesc *srcTensor,
const TensorDesc *maskTensor,
) override#

Applies the forces for the elements selected by a boolean mask.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • maskTensor[in] Boolean mask tensor selecting which elements to write.

Returns:

True on success; false otherwise.

bool applyForcesAndTorquesAtPositionMasked(
const TensorDesc *srcForceTensor,
const TensorDesc *srcTorqueTensor,
const TensorDesc *srcPositionTensor,
const TensorDesc *maskTensor,
bool isGlobal,
) override#

Applies the forces and torques at position for the elements selected by a boolean mask.

Parameters:
  • srcForceTensor[in] Source tensor of forces to apply.

  • srcTorqueTensor[in] Source tensor of torques to apply.

  • srcPositionTensor[in] Source tensor of positions at which the forces are applied.

  • maskTensor[in] Boolean mask tensor selecting which elements to write.

  • isGlobal[in] If true, the inputs are expressed in the world frame; otherwise in the local frame.

Returns:

True on success; false otherwise.

bool setMassesMasked(
const TensorDesc *srcTensor,
const TensorDesc *maskTensor,
) override#

Sets the masses for the elements selected by a boolean mask.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • maskTensor[in] Boolean mask tensor selecting which elements to write.

Returns:

True on success; false otherwise.

bool setCOMsMasked(
const TensorDesc *srcTensor,
const TensorDesc *maskTensor,
) override#

Sets the COMs for the elements selected by a boolean mask.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • maskTensor[in] Boolean mask tensor selecting which elements to write.

Returns:

True on success; false otherwise.

bool setInertiasMasked(
const TensorDesc *srcTensor,
const TensorDesc *maskTensor,
) override#

Sets the inertias for the elements selected by a boolean mask.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • maskTensor[in] Boolean mask tensor selecting which elements to write.

Returns:

True on success; false otherwise.

bool getMaterialProperties(
const TensorDesc *dstTensor,
) const override#

Gets the material properties.

Parameters:

dstTensor[out] Destination tensor that receives the requested values.

Returns:

True on success; false otherwise.

bool getCompliantMaterialProperties(
const TensorDesc *dstTensor,
const TensorDesc *dstCombineModeTensor,
) const override#

Gets the compliant material properties.

Parameters:
  • dstTensor[out] Destination tensor that receives the requested values.

  • dstCombineModeTensor[out] Destination tensor that receives the material combine modes.

Returns:

True on success; false otherwise.

bool getRestOffsets(const TensorDesc *dstTensor) const override#

Gets the rest offsets.

Parameters:

dstTensor[out] Destination tensor that receives the requested values.

Returns:

True on success; false otherwise.

bool getContactOffsets(const TensorDesc *dstTensor) const override#

Gets the contact offsets.

Parameters:

dstTensor[out] Destination tensor that receives the requested values.

Returns:

True on success; false otherwise.

bool setMaterialProperties(
const TensorDesc *srcTensor,
const TensorDesc *indexTensor,
) const override#

Sets the material properties.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • indexTensor[in] Tensor of view indices selecting which elements to write.

Returns:

True on success; false otherwise.

bool setCompliantMaterialProperties(
const TensorDesc *srcTensor,
const TensorDesc *srcCombineTensor,
const TensorDesc *indexTensor,
) const override#

Sets the compliant material properties.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • srcCombineTensor[in] Source tensor of material combine modes.

  • indexTensor[in] Tensor of view indices selecting which elements to write.

Returns:

True on success; false otherwise.

bool setRestOffsets(
const TensorDesc *srcTensor,
const TensorDesc *indexTensor,
) const override#

Sets the rest offsets.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • indexTensor[in] Tensor of view indices selecting which elements to write.

Returns:

True on success; false otherwise.

bool setContactOffsets(
const TensorDesc *srcTensor,
const TensorDesc *indexTensor,
) const override#

Sets the contact offsets.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • indexTensor[in] Tensor of view indices selecting which elements to write.

Returns:

True on success; false otherwise.

bool setMaterialPropertiesMasked(
const TensorDesc *srcTensor,
const TensorDesc *maskTensor,
) const override#

Sets the material properties for the elements selected by a boolean mask.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • maskTensor[in] Boolean mask tensor selecting which elements to write.

Returns:

True on success; false otherwise.

bool setCompliantMaterialPropertiesMasked(
const TensorDesc *srcTensor,
const TensorDesc *srcCombineTensor,
const TensorDesc *maskTensor,
) const override#

Sets the compliant material properties for the elements selected by a boolean mask.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • srcCombineTensor[in] Source tensor of material combine modes.

  • maskTensor[in] Boolean mask tensor selecting which elements to write.

Returns:

True on success; false otherwise.

bool setRestOffsetsMasked(
const TensorDesc *srcTensor,
const TensorDesc *maskTensor,
) const override#

Sets the rest offsets for the elements selected by a boolean mask.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • maskTensor[in] Boolean mask tensor selecting which elements to write.

Returns:

True on success; false otherwise.

bool setContactOffsetsMasked(
const TensorDesc *srcTensor,
const TensorDesc *maskTensor,
) const override#

Sets the contact offsets for the elements selected by a boolean mask.

Parameters:
  • srcTensor[in] Source tensor providing the values to write.

  • maskTensor[in] Boolean mask tensor selecting which elements to write.

Returns:

True on success; false otherwise.

bool check() const override#

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

Returns:

True on success; false otherwise.

void release() override#

Releases the view and frees its associated resources.

Protected Functions

void _evalForwardKinematics()#

Evaluates the forward kinematics.

void _evalInverseKinematics()#

Evaluates the inverse kinematics.

void _updateInverseMasses()#

Updates the inverse masses.

void _updateInverseInertias()#

Updates the inverse inertias.

inline const std::vector<uint32_t> &_resolveIndices(
const TensorDesc *indexTensor,
) const#

Resolves the indices.

Parameters:

indexTensor[in] Tensor of view indices selecting which elements to write.

Returns:

Reference to the requested object.

inline isaacsim::physics::newton::tensors::GpuIndexGuard _resolveGpuIndices(
const TensorDesc *indexTensor,
int *devScratch = nullptr,
) const#

Resolves the GPU indices.

Parameters:
  • indexTensor[in] Tensor of view indices selecting which elements to write.

  • devScratch[in] Optional device scratch buffer; allocated internally when null.

Returns:

The requested value.

void _buildScatterMappings(
const std::vector<uint32_t> &viewIndices,
int elemSize,
std::vector<int> &srcOffsets,
std::vector<int> &dstIndices,
) const#

Builds the scatter mappings.

Parameters:
  • viewIndices[in] View indices selected by the operation.

  • elemSize[in] Number of floats per element.

  • srcOffsets[out] Receives the source offset for each scattered element.

  • dstIndices[out] Receives the destination index for each scattered element.

void _cacheWarpPointers()#

Caches the warp pointers.

Protected Attributes

py::object m_newtonStage#

Newton stage object backing the view.

py::object m_model#

Newton model object backing the view.

uint32_t m_count#

Number of elements in the view.

uint32_t m_maxShapes#

Maximum shape count across all elements in the view.

std::vector<int> m_bodyIndices#

[count] → model body index for each view body.

std::vector<std::string> m_primPaths#

Prim paths.

std::vector<int> m_freeJointQStartIndices#

[count] → joint_q offset for free joints, -1 if fixed.

mutable std::vector<uint32_t> m_scratchViewIndices#

Scratch buffer reused to resolve view indices without per-call allocation.

bool m_cacheValid = false#

Cache valid.

int m_modelDeviceOrdinal = -1#

Model device ordinal.

size_t m_totalBodyCount = 0#

Total body count.

mutable float *m_cachedJointQ = nullptr#

Cached pointer to the joint q data.

mutable float *m_cachedBodyQ = nullptr#

Cached pointer to the body q data.

mutable float *m_cachedBodyQd = nullptr#

Cached pointer to the body qd data.

mutable float *m_cachedBodyQdd = nullptr#

Nullable; only available when body_qdd is requested.

mutable float *m_cachedBodyF = nullptr#

Cached pointer to the body f data.

float *m_cachedBodyMass = nullptr#

Cached pointer to the body mass data.

float *m_cachedBodyInverseMass = nullptr#

Cached pointer to the body inverse mass data.

float *m_cachedBodyInertia = nullptr#

Cached pointer to the body inertia data.

float *m_cachedBodyInverseInertia = nullptr#

Cached pointer to the body inverse inertia data.

float *m_cachedBodyCenterOfMass = nullptr#

Cached pointer to the body center of mass data.

std::vector<float> m_cachedComOrientation#

[count * 4] cached COM quaternion (xyzw), write-through from setCOMs.