BaseRigidBodyView#

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

class BaseRigidBodyView : public IRigidBodyView#

Base rigid body view implementing IRigidBodyView for Newton.

Resolves USD body paths to Newton model body indices, identifies free-joint bodies for root transform writes, and caches Warp array pointers for body_q, body_qd, mass, inertia, and force arrays. Getter/setter methods are pure virtual and implemented by CpuRigidBodyView and GpuRigidBodyView.

Subclassed by isaacsim::physics::newton::tensors::CpuRigidBodyView, isaacsim::physics::newton::tensors::GpuRigidBodyView

Public Functions

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

Constructs a BaseRigidBodyView.

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

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

~BaseRigidBodyView() override#
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

inline virtual int *_getDeviceIndexScratch() const#

Returns preallocated device storage for mask-to-index conversion, or null for CPU views.

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.

bool _checkBinding() const#

Checks that the cached Warp pointers still address the Newton stage’s current model and state.

The Newton stage rebuilds model, control and state_0 whenever it re-initializes (for example after a USD change). The view is bound to the objects it was created against; once the stage holds different ones the view is invalidated for good and has to be recreated.

Returns:

True while the view is bound to the stage’s current model and state.

void _cacheWarpPointers()#

Caches the warp pointers.

Protected Attributes

py::object m_newtonStage#

Newton stage object backing the view.

mutable py::object m_model#

Newton model object the view is bound to; released once invalidated.

mutable py::object m_boundState#

Newton state_0 object the view is bound to; released once invalidated.

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.

std::vector<uint32_t> m_scratchMaskIndices#

Scratch buffer reused to resolve masks to view indices.

mutable bool m_cacheValid = false#

False until the pointers are cached and once the view is invalidated.

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.