RigidBodyEntity#
Fully qualified name: isaacsim::physics::entities::RigidBodyEntity
-
class RigidBodyEntity : public isaacsim::physics::entities::PhysicsEntity#
Wrapper over a batch of simulated rigid body prims.
Extends PhysicsEntity with rigid body specific state and properties: world poses, linear and angular velocities, external force/torque application, mass and inertia properties, centers of mass, and per-body simulation and gravity toggles.
All methods that accept an
indicesparameter operate only on the prims at those positions; whenindicesis omitted, all wrapped prims are processed. Inputs smaller than the expected shape are broadcast.Public Functions
- RigidBodyEntity( )#
Construct a rigid body entity wrapper for one or more USD prim paths.
- Parameters:
engine – [in] Name of the physics engine that simulates the prims.
paths – [in] Single path string or list of path strings. May include regular expressions.
- Throws:
std::runtime_error – if the entity cannot be created for the given engine and paths.
-
~RigidBodyEntity() = default#
-
size_t numShapes() const#
Return the number of collision shapes per wrapped rigid body.
- Throws:
std::runtime_error – if the shape count cannot be queried from the physics engine.
- Returns:
Count of collision shapes.
- std::tuple<array::Array, array::Array> getWorldPoses( )#
Get the world-frame poses of the selected rigid bodies.
- Parameters:
indices – [in] Indices of prims to process (shape
(N,)). If omitted, all wrapped prims are processed.- Returns:
A pair of (positions, orientations). Positions have shape
(N,3); orientations are quaternionsxyzwwith shape(N,4).
- void setWorldPoses(
- const std::optional<array::Array> &positions = std::nullopt,
- const std::optional<array::Array> &orientations = std::nullopt,
- const std::optional<array::Array> &indices = std::nullopt,
Set the world-frame poses of the selected rigid bodies.
At least one of
positionsororientationsmust be provided. This method teleports the bodies to the specified poses.- Parameters:
positions – [in] World-frame positions (shape
(N,3)). Optional.orientations – [in] Orientations as quaternions
xyzw(shape(N,4)). Optional.indices – [in] Indices of prims to process (shape
(N,)). If omitted, all wrapped prims are processed.
- Throws:
std::invalid_argument – if both
positionsandorientationsare undefined.
- std::tuple<array::Array, array::Array> getVelocities( )#
Get the world-frame velocities of the selected rigid bodies.
- Parameters:
indices – [in] Indices of prims to process (shape
(N,)). If omitted, all wrapped prims are processed.- Returns:
A pair of (linear velocities, angular velocities), both with shape
(N,3), in distance/second and radians/second respectively.
- void setVelocities(
- const std::optional<array::Array> &linearVelocities = std::nullopt,
- const std::optional<array::Array> &angularVelocities = std::nullopt,
- const std::optional<array::Array> &indices = std::nullopt,
Set the world-frame velocities of the selected rigid bodies.
At least one of
linearVelocitiesorangularVelocitiesmust be provided.- Parameters:
linearVelocities – [in] Linear velocities in distance/second (shape
(N,3)). Optional.angularVelocities – [in] Angular velocities in radians/second (shape
(N,3)). Optional.indices – [in] Indices of prims to process (shape
(N,)). If omitted, all wrapped prims are processed.
- Throws:
std::invalid_argument – if both
linearVelocitiesandangularVelocitiesare undefined.
- void applyForces( )#
Apply forces at the centers of mass of the selected rigid bodies.
The applied forces are consumed by the next simulation step.
- Parameters:
forces – [in] Forces to apply (shape
(N,3)).indices – [in] Indices of prims to process (shape
(N,)). If omitted, all wrapped prims are processed.
- void applyForcesAndTorquesAtPositions(
- const std::optional<array::Array> &forces = std::nullopt,
- const std::optional<array::Array> &torques = std::nullopt,
- const std::optional<array::Array> &positions = std::nullopt,
- const std::optional<array::Array> &indices = std::nullopt,
Apply forces and torques at given world-frame positions of the selected rigid bodies.
At least one of
forcesortorquesmust be provided. Undefined components are applied as zero rather than retaining their previous values. The applied wrench is consumed by the next simulation step.- Parameters:
forces – [in] Forces to apply (shape
(N,3)). Optional.torques – [in] Torques to apply (shape
(N,3)). Optional.positions – [in] World-frame positions at which the forces are applied (shape
(N,3)). Optional; defaults to the bodies’ origins.indices – [in] Indices of prims to process (shape
(N,)). If omitted, all wrapped prims are processed.
- Throws:
std::invalid_argument – if both
forcesandtorquesare undefined.
- array::Array getMasses( )#
Get the masses of the selected rigid bodies.
- Parameters:
indices – [in] Indices of prims to process (shape
(N,)). If omitted, all wrapped prims are processed.inverse – [in] Whether to return the inverse masses (
true) or the masses (false).
- Returns:
Masses or inverse masses (shape
(N,1)).
- void setMasses( )#
Set the masses of the selected rigid bodies.
- Parameters:
masses – [in] Masses to apply (shape
(N,1)).indices – [in] Indices of prims to process (shape
(N,)). If omitted, all wrapped prims are processed.
- array::Array getInertias( )#
Get the inertia tensors of the selected rigid bodies.
- Parameters:
indices – [in] Indices of prims to process (shape
(N,)). If omitted, all wrapped prims are processed.inverse – [in] Whether to return the inverse inertia tensors (
true) or the inertia tensors (false).
- Returns:
Flattened row-major 3x3 inertia tensors (shape
(N,9)).
- void setInertias( )#
Set the inertia tensors of the selected rigid bodies.
- Parameters:
inertias – [in] Flattened row-major 3x3 inertia tensors (shape
(N,9)).indices – [in] Indices of prims to process (shape
(N,)). If omitted, all wrapped prims are processed.
- std::tuple<array::Array, array::Array> getComs( )#
Get the centers of mass of the selected rigid bodies, expressed in their local frames.
- Parameters:
indices – [in] Indices of prims to process (shape
(N,)). If omitted, all wrapped prims are processed.- Returns:
A pair of (positions, orientations). Positions have shape
(N,3); orientations are quaternionsxyzwwith shape(N,4).
- void setComs(
- const std::optional<array::Array> &positions = std::nullopt,
- const std::optional<array::Array> &orientations = std::nullopt,
- const std::optional<array::Array> &indices = std::nullopt,
Set the centers of mass of the selected rigid bodies, expressed in their local frames.
At least one of
positionsororientationsmust be provided.- Parameters:
positions – [in] Center of mass positions (shape
(N,3)). Optional.orientations – [in] Center of mass orientations as quaternions
xyzw(shape(N,4)). Optional.indices – [in] Indices of prims to process (shape
(N,)). If omitted, all wrapped prims are processed.
- Throws:
std::invalid_argument – if both
positionsandorientationsare undefined.
- array::Array getEnabledRigidBodies( )#
Get the simulation-enabled state of the selected rigid bodies.
- Parameters:
indices – [in] Indices of prims to process (shape
(N,)). If omitted, all wrapped prims are processed.- Returns:
Boolean flags (shape
(N,1)).trueif the body is simulated,falseotherwise.
- void setEnabledRigidBodies( )#
Enable or disable the simulation of the selected rigid bodies.
- Parameters:
enabled – [in] Boolean flags (shape
(N,1)).truesimulates the body,falseexcludes it.indices – [in] Indices of prims to process (shape
(N,)). If omitted, all wrapped prims are processed.
- array::Array getEnabledGravities( )#
Get the gravity-enabled state of the selected rigid bodies.
- Parameters:
indices – [in] Indices of prims to process (shape
(N,)). If omitted, all wrapped prims are processed.- Returns:
Boolean flags (shape
(N,1)).trueif gravity affects the body,falseotherwise.
- void setEnabledGravities( )#
Enable or disable gravity for the selected rigid bodies.
- Parameters:
enabled – [in] Boolean flags (shape
(N,1)).trueapplies gravity,falseexcludes it.indices – [in] Indices of prims to process (shape
(N,)). If omitted, all wrapped prims are processed.
-
size_t numPrims() const noexcept#
Return the number of wrapped prims.
- Returns:
Count of prims managed by this entity.
- array::Array getData( )#
Read a named data buffer for the selected prims.
- Parameters:
name – [in] Name of the data buffer to read.
indices – [in] Indices of prims to process (shape
(N,)). If omitted, all wrapped prims are processed.
- Throws:
std::runtime_error – if the buffer name is not supported by the entity.
- Returns:
Buffer contents, with the leading dimension matching the number of selected prims.
- void setData(
- const std::string &name,
- const array::Array &data,
- const std::optional<array::Array> &indices = std::nullopt,
Write a named data buffer for the selected prims.
- Parameters:
name – [in] Name of the data buffer to write.
data – [in] New buffer contents, with the leading dimension matching the number of selected prims.
indices – [in] Indices of prims to process (shape
(N,)). If omitted, all wrapped prims are processed.
- Throws:
std::runtime_error – if the buffer name is not supported by the entity.
- std::vector<array::Array> getMultiData( )#
Read a named data buffer that is composed of several arrays for the selected prims.
- Parameters:
name – [in] Name of the data buffer to read.
indices – [in] Indices of prims to process (shape
(N,)). If omitted, all wrapped prims are processed.
- Throws:
std::runtime_error – if the buffer name is not supported by the entity.
- Returns:
Ordered list of buffer components.
- void setMultiData(
- const std::string &name,
- const std::vector<array::Array> &data,
- const std::optional<array::Array> &indices = std::nullopt,
Write a named data buffer that is composed of several arrays for the selected prims.
- Parameters:
name – [in] Name of the data buffer to write.
data – [in] Ordered list of buffer components to write.
indices – [in] Indices of prims to process (shape
(N,)). If omitted, all wrapped prims are processed.
- Throws:
std::runtime_error – if the buffer name is not supported by the entity.