DcContext#

Fully qualified name: omni::isaac::dynamic_control::DcContext

class DcContext#

Context for managing dynamic control objects in a physics scene.

Provides functionality for creating, retrieving, and managing physics objects such as rigid bodies, joints, articulations, and attractors. Maintains the mapping between USD paths and physics objects.

Public Functions

explicit DcContext(uint32_t ctxId)#

Constructs a DcContext with the given context ID.

Parameters:

ctxId[in] The unique identifier for this context

uint32_t getId() const#

Gets the ID of this context.

Returns:

The context ID

DcHandle registerRigidBody(const pxr::SdfPath &usdPath)#

Registers a rigid body at the specified USD path.

Parameters:

usdPath[in] The USD path to register

Returns:

Handle to the registered rigid body

DcHandle registerJoint(const pxr::SdfPath &usdPath)#

Registers a joint at the specified USD path.

Parameters:

usdPath[in] The USD path to register

Returns:

Handle to the registered joint

DcHandle registerDof(const pxr::SdfPath &usdPath)#

Registers a degree of freedom at the specified USD path.

Parameters:

usdPath[in] The USD path to register

Returns:

Handle to the registered degree of freedom

DcHandle registerArticulation(const pxr::SdfPath &usdPath)#

Registers an articulation at the specified USD path.

Parameters:

usdPath[in] The USD path to register

Returns:

Handle to the registered articulation

DcHandle registerD6Joint(const pxr::SdfPath &usdPath)#

Registers a D6 joint at the specified USD path.

Parameters:

usdPath[in] The USD path to register

Returns:

Handle to the registered D6 joint

DcHandle addRigidBody(
std::unique_ptr<DcRigidBody> &&rb,
const pxr::SdfPath &usdPath,
)#

Adds a rigid body to the context.

Parameters:
  • rb[in] The rigid body to add

  • usdPath[in] The USD path to associate with the rigid body

Returns:

Handle to the added rigid body

DcHandle addJoint(
std::unique_ptr<DcJoint> &&joint,
const pxr::SdfPath &usdPath,
)#

Adds a joint to the context.

Parameters:
  • joint[in] The joint to add

  • usdPath[in] The USD path to associate with the joint

Returns:

Handle to the added joint

DcHandle addDof(
std::unique_ptr<DcDof> &&dof,
const pxr::SdfPath &usdPath,
)#

Adds a degree of freedom to the context.

Parameters:
  • dof[in] The degree of freedom to add

  • usdPath[in] The USD path to associate with the degree of freedom

Returns:

Handle to the added degree of freedom

DcHandle addArticulation(
std::unique_ptr<DcArticulation> &&art,
const pxr::SdfPath &usdPath,
)#

Adds an articulation to the context.

Parameters:
  • art[in] The articulation to add

  • usdPath[in] The USD path to associate with the articulation

Returns:

Handle to the added articulation

DcHandle addAttractor(
std::unique_ptr<DcAttractor> &&attractor,
const pxr::SdfPath &usdPath,
)#

Adds an attractor to the context.

Parameters:
  • attractor[in] The attractor to add

  • usdPath[in] The USD path to associate with the attractor

Returns:

Handle to the added attractor

DcHandle addD6Joint(
std::unique_ptr<DcD6Joint> &&dc_joint,
const pxr::SdfPath &usdPath,
)#

Adds a D6 joint to the context.

Parameters:
  • dc_joint[in] The D6 joint to add

  • usdPath[in] The USD path to associate with the D6 joint

Returns:

Handle to the added D6 joint

DcHandle getRigidBodyHandle(const pxr::SdfPath &usdPath) const#

Gets the handle of a rigid body at the specified USD path.

Parameters:

usdPath[in] The USD path of the rigid body

Returns:

Handle to the rigid body, or an invalid handle if not found

DcHandle getJointHandle(const pxr::SdfPath &usdPath) const#

Gets the handle of a joint at the specified USD path.

Parameters:

usdPath[in] The USD path of the joint

Returns:

Handle to the joint, or an invalid handle if not found

DcHandle getDofHandle(const pxr::SdfPath &usdPath) const#

Gets the handle of a degree of freedom at the specified USD path.

Parameters:

usdPath[in] The USD path of the degree of freedom

Returns:

Handle to the degree of freedom, or an invalid handle if not found

DcHandle getArticulationHandle(const pxr::SdfPath &usdPath) const#

Gets the handle of an articulation at the specified USD path.

Parameters:

usdPath[in] The USD path of the articulation

Returns:

Handle to the articulation, or an invalid handle if not found

DcHandle getAttractorHandle(const pxr::SdfPath &usdPath) const#

Gets the handle of an attractor at the specified USD path.

Parameters:

usdPath[in] The USD path of the attractor

Returns:

Handle to the attractor, or an invalid handle if not found

DcRigidBody *getRigidBody(DcHandle handle) const#

Gets a rigid body by its handle.

Parameters:

handle[in] The handle of the rigid body

Returns:

Pointer to the rigid body, or nullptr if not found

DcJoint *getJoint(DcHandle handle) const#

Gets a joint by its handle.

Parameters:

handle[in] The handle of the joint

Returns:

Pointer to the joint, or nullptr if not found

DcDof *getDof(DcHandle handle) const#

Gets a degree of freedom by its handle.

Parameters:

handle[in] The handle of the degree of freedom

Returns:

Pointer to the degree of freedom, or nullptr if not found

DcArticulation *getArticulation(DcHandle handle) const#

Gets an articulation by its handle.

Parameters:

handle[in] The handle of the articulation

Returns:

Pointer to the articulation, or nullptr if not found

DcAttractor *getAttractor(DcHandle handle) const#

Gets an attractor by its handle.

Parameters:

handle[in] The handle of the attractor

Returns:

Pointer to the attractor, or nullptr if not found

DcD6Joint *getD6Joint(DcHandle handle) const#

Gets a D6 joint by its handle.

Parameters:

handle[in] The handle of the D6 joint

Returns:

Pointer to the D6 joint, or nullptr if not found

void removeRigidBody(DcHandle handle)#

Removes a rigid body from the context.

Parameters:

handle[in] The handle of the rigid body to remove

void removeJoint(DcHandle handle)#

Removes a joint from the context.

Parameters:

handle[in] The handle of the joint to remove

void removeArticulation(DcHandle handle)#

Removes an articulation from the context.

Parameters:

handle[in] The handle of the articulation to remove

void removeAttractor(DcHandle handle)#

Removes an attractor from the context.

Parameters:

handle[in] The handle of the attractor to remove

void removeD6Joint(DcHandle handle)#

Removes a D6 joint from the context.

Parameters:

handle[in] The handle of the D6 joint to remove

void remove(DcHandle handle)#

Removes an object from the context based on its handle.

Parameters:

handle[in] The handle of the object to remove

void removeUsdPath(const pxr::SdfPath &usdPath)#

Removes all objects associated with the specified USD path.

Parameters:

usdPath[in] The USD path to remove

int numAttractors() const#

Gets the number of attractors in the context.

Returns:

The number of attractors

int numD6Joints() const#

Gets the number of D6 joints in the context.

Returns:

The number of D6 joints

void refreshPhysicsPointers(bool verbose)#

Refreshes the physics pointers after a reset.

Parameters:

verbose[in] Whether to print verbose output

Public Members

omni::physx::IPhysx *physx = nullptr#

Pointer to the PhysX interface.

omni::physx::IPhysxSceneQuery *physxSceneQuery = nullptr#

Pointer to the PhysX scene query interface.

bool isSimulating = false#

Flag indicating whether the simulation is currently running.

pxr::UsdStageWeakPtr mStage = nullptr#

Weak pointer to the USD stage.

bool wasPaused = false#

Flag indicating whether the simulation was paused.