GpuRigidContactView#

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

class GpuRigidContactView : public isaacsim::physics::newton::tensors::BaseRigidContactView#

GPU contact view. Uses CUDA kernels for net force, force matrix, and per-contact data computation. Device-side zero buffers serve as fallbacks for optional contact arrays.

Public Functions

GpuRigidContactView(
py::object newtonStage,
const std::vector<std::string> &sensorPaths,
const std::vector<std::vector<std::string>> &filterPaths,
uint32_t maxContactDataCount,
int deviceOrdinal,
)#

Constructs a GpuRigidContactView.

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.

  • deviceOrdinal[in] Device ordinal.

~GpuRigidContactView() override#
bool getNetContactForces(
const TensorDesc *dstTensor,
float dt,
) const override#

Gets the net contact forces.

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

  • dt[in] Time step, in seconds.

Returns:

True on success; false otherwise.

bool getContactForceMatrix(
const TensorDesc *dstTensor,
float dt,
) const override#

Gets the contact force matrix.

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

  • dt[in] Time step, in seconds.

Returns:

True on success; false otherwise.

bool getContactData(
const TensorDesc *contactForceTensor,
const TensorDesc *contactPointTensor,
const TensorDesc *contactNormalTensor,
const TensorDesc *contactSeparationTensor,
const TensorDesc *contactCountTensor,
const TensorDesc *contactStartIndicesTensor,
float dt,
) const override#

Gets the contact data.

Parameters:
  • contactForceTensor[out] Destination tensor that receives the contact force values.

  • contactPointTensor[out] Destination tensor that receives the contact point values.

  • contactNormalTensor[out] Destination tensor that receives the contact normal values.

  • contactSeparationTensor[out] Destination tensor that receives the contact separation values.

  • contactCountTensor[out] Destination tensor that receives the contact count values.

  • contactStartIndicesTensor[out] Destination tensor that receives the contact start indices values.

  • dt[in] Time step, in seconds.

Returns:

True on success; false otherwise.

bool getRawContactData(
const TensorDesc *contactForceTensor,
const TensorDesc *contactPointTensor,
const TensorDesc *contactNormalTensor,
const TensorDesc *contactSeparationTensor,
const TensorDesc *contactCountTensor,
const TensorDesc *contactStartIndicesTensor,
const TensorDesc *otherActorIdsTensor,
float dt,
) const override#

Gets the raw contact data.

Parameters:
  • contactForceTensor[out] Destination tensor that receives the contact force values.

  • contactPointTensor[out] Destination tensor that receives the contact point values.

  • contactNormalTensor[out] Destination tensor that receives the contact normal values.

  • contactSeparationTensor[out] Destination tensor that receives the contact separation values.

  • contactCountTensor[out] Destination tensor that receives the contact count values.

  • contactStartIndicesTensor[out] Destination tensor that receives the contact start indices values.

  • otherActorIdsTensor[in] Tensor of other-actor identifiers to resolve.

  • dt[in] Time step, in seconds.

Returns:

True on success; false otherwise.

uint32_t getSensorCount() const override#

Gets the sensor count.

Returns:

The requested value.

uint32_t getFilterCount() const override#

Gets the filter count.

Returns:

The requested value.

uint32_t getMaxContactDataCount() const override#

Gets the maximum contact data count.

Returns:

The requested value.

bool getFrictionData(
const TensorDesc *frictionForceTensor,
const TensorDesc *contactPointTensor,
const TensorDesc *contactCountTensor,
const TensorDesc *contactStartIndicesTensor,
float dt,
) const override#

Gets the friction data.

Parameters:
  • frictionForceTensor[out] Destination tensor that receives the friction force values.

  • contactPointTensor[out] Destination tensor that receives the contact point values.

  • contactCountTensor[out] Destination tensor that receives the contact count values.

  • contactStartIndicesTensor[out] Destination tensor that receives the contact start indices values.

  • dt[in] Time step, in seconds.

Returns:

True on success; false otherwise.

void getOtherActorPathsFromIds(
const TensorDesc *otherActorIdsTensor,
std::vector<std::string> &outPaths,
) const override#

Gets the other actor paths from ids.

Parameters:
  • otherActorIdsTensor[in] Tensor of other-actor identifiers to resolve.

  • outPaths[out] Receives the resolved USD prim paths.

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.

const char *getUsdPrimPath(uint32_t sensorIdx) const override#

Gets the USD prim path.

Parameters:

sensorIdx[in] Zero-based sensor index within the view.

Returns:

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

const char *getUsdPrimName(uint32_t sensorIdx) const override#

Gets the USD prim name.

Parameters:

sensorIdx[in] Zero-based sensor index within the view.

Returns:

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

const char *getFilterUsdPrimPath(
uint32_t sensorIdx,
uint32_t filterIdx,
) const override#

Gets the filter USD prim path.

Parameters:
  • sensorIdx[in] Zero-based sensor index within the view.

  • filterIdx[in] Zero-based filter index within the sensor.

Returns:

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

const char *getFilterUsdPrimName(
uint32_t sensorIdx,
uint32_t filterIdx,
) const override#

Gets the filter USD prim name.

Parameters:
  • sensorIdx[in] Zero-based sensor index within the view.

  • filterIdx[in] Zero-based filter index within the sensor.

Returns:

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

Protected Functions

void _cacheStaticPointers()#

Caches shape_body pointer (static across simulation lifetime).

void _refreshContactPointers() const#

Re-reads contact data pointers from Newton if the simulation timestamp has advanced.

float _getPhysicsDtScale(float userDt) const#

Gets the physics dt scale.

Parameters:

userDt[in] User-provided time step, in seconds.

Returns:

The requested value.

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_sensorCount#

Sensor count.

uint32_t m_filterCount#

Filter count.

uint32_t m_maxContactDataCount#

Maximum contact data count.

int m_rigidContactMax#

Rigid contact maximum.

int m_worldBodyIndex#

World body index.

int m_bodyCount#

Body count.

std::vector<std::string> m_sensorPaths#

Sensor paths.

std::vector<std::string> m_sensorNames#

Sensor names.

std::vector<std::vector<std::string>> m_filterPaths#

Filter paths.

std::vector<std::vector<std::string>> m_filterNames#

Filter names.

std::vector<int> m_hostBodySensorMap#

[numBodies] → sensor index, -1 if not a sensor.

std::vector<int> m_hostBodyFilterMap#

[sensorCount * numBodies] → filter index per sensor, -1 if no match.

mutable int *m_cachedContactCount = nullptr#

Cached pointer to the contact count data.

mutable int *m_cachedShape0 = nullptr#

Cached pointer to the shape 0 data.

mutable int *m_cachedShape1 = nullptr#

Cached pointer to the shape 1 data.

mutable float *m_cachedContactNormal = nullptr#

Cached pointer to the contact normal data.

mutable float *m_cachedContactForce = nullptr#

Cached pointer to the contact force data.

mutable float *m_cachedContactPoint0 = nullptr#

Cached pointer to the contact point 0 data.

mutable float *m_cachedContactPoint1 = nullptr#

Cached pointer to the contact point 1 data.

mutable float *m_cachedThickness0 = nullptr#

Cached pointer to the thickness 0 data.

mutable float *m_cachedThickness1 = nullptr#

Cached pointer to the thickness 1 data.

int *m_cachedShapeBody = nullptr#

Cached pointer to the shape body data.

mutable float *m_cachedBodyQ = nullptr#

Cached pointer to the body q data.

mutable float *m_cachedSpatialForce = nullptr#

Cached pointer to the spatial force data.

mutable bool m_hasSpatialForce = false#

Has spatial force.

std::vector<std::string> m_bodyLabels#

Body labels.

mutable uint64_t m_lastRefreshedGeneration = UINT64_MAX#

Last-seen simulation_timestamp.

float m_physicsDt = 0.0f#

Physics dt from SimulationManager for force-to-impulse scaling.

mutable bool m_contactPointsInWorldSpace = false#

True when contact points are MuJoCo world-space positions.

mutable std::vector<uint32_t> m_scratchCounts#

Scratch counts.

mutable std::vector<uint32_t> m_scratchStartIndices#

Scratch start indices.

mutable std::vector<uint32_t> m_scratchFillCounts#

Scratch fill counts.