RigidEntity#
- class genesis.engine.entities.rigid_entity.rigid_entity.RigidEntity(scene: Scene, solver: RigidSolver, material: Material, morph: Morph, surface: Surface, idx: int, idx_in_solver, link_start: int = 0, joint_start: int = 0, q_start=0, dof_start=0, geom_start=0, cell_start=0, vert_start=0, free_verts_state_start=0, fixed_verts_state_start=0, face_start=0, edge_start=0, vgeom_start=0, vvert_start=0, vface_start=0, custom_vvert_start=0, custom_vface_start=0, equality_start=0, visualize_contact: bool = False, morph_heterogeneous: list[genesis.options.morphs.Morph] | None = None, name: str | None = None)[source]#
Bases:
KinematicEntityPhysics-enabled rigid entity (collision, constraints, dynamics).
Inherits morphology, FK, IK, and DOF position get/set from KinematicEntity. Adds physics simulation methods: forces, velocities, contacts, etc.
- plan_path(qpos_goal, qpos_start=None, max_nodes=2000, resolution=0.05, timeout=None, max_retry=1, smooth_path=True, num_waypoints=300, ignore_collision=False, planner='RRTConnect', envs_idx=None, return_valid_mask=False, *, ee_link_name=None, with_entity=None, **kwargs)[source]#
Plan a path from
qpos_starttoqpos_goal.- Parameters:
qpos_goal (array_like) – The goal state. [B, Nq] or [1, Nq]
qpos_start (None | array_like, optional) – The start state. If None, the current state of the rigid entity will be used. Defaults to None. [B, Nq] or [1, Nq]
resolution (float, optiona) – Joint-space resolution. It corresponds to the maximum distance between states to be checked for validity along a path segment.
timeout (float, optional) – The max time to spend for each planning in seconds. Note that the timeout is not exact.
max_retry (float, optional) – Maximum number of retry in case of timeout or convergence failure. Default to 1.
smooth_path (bool, optional) – Whether to smooth the path after finding a solution. Defaults to True.
num_waypoints (int, optional) – The number of waypoints to interpolate the path. If None, no interpolation will be performed. Defaults to 100.
ignore_collision (bool, optional) – Whether to ignore collision checking during motion planning. Defaults to False.
ignore_joint_limit (bool, optional) – This option has been deprecated and is not longer doing anything.
planner (str, optional) – The name of the motion planning algorithm to use. Supported planners: ‘RRT’, ‘RRTConnect’. Defaults to ‘RRTConnect’.
envs_idx (None | array_like, optional) – The indices of the environments to set. If None, all environments will be set. Defaults to None.
return_valid_mask (bool) – Obtain valid mask of the succesful planed path over batch.
ee_link_name (str) – The name of the link, which we “attach” the object during the planning
with_entity (RigidEntity) – The (non-articulated) object to “attach” during the planning
- Returns:
path (torch.Tensor) – A tensor of waypoints representing the planned path. Each waypoint is an array storing the entity’s qpos of a single time step.
is_invalid (torch.Tensor) – A tensor of boolean mask indicating the batch indices with failed plan.
- get_AABB(envs_idx=None, *, allow_fast_approx: bool = False)[source]#
Get the axis-aligned bounding box (AABB) of the entity in world frame by aggregating all the collision geometries associated with this entity.
- Parameters:
envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
allow_fast_approx (bool) – Whether to allow fast approximation for efficiency if supported, i.e. ‘LegacyCoupler’ is enabled. In this case, each collision geometry is approximated by their pre-computed AABB in geometry-local frame, which is more efficiency but inaccurate.
- Returns:
aabb – The AABB of the entity, where
[:, 0] = min_corner (x_min, y_min, z_min)and[:, 1] = max_corner (x_max, y_max, z_max).- Return type:
torch.Tensor, shape (2, 3) or (n_envs, 2, 3)
- get_links_pos(links_idx_local=None, envs_idx=None, *, ref: link_ref_frame = link_ref_frame.link_origin, relative=True)[source]#
Returns the position of a given reference point for all the entity’s links.
- Parameters:
links_idx_local (None | array_like) – The indices of the links. Defaults to None.
envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
ref (gs.link_ref_frame, optional) – The reference point used to express the position of each link: its origin (‘link_origin’), its center of mass (‘link_COM’), or the center of mass of the sub-entity it belongs to (‘root_COM’). A single ‘RigidEntity’ may comprise several physical sub-entities, each a kinematic sub-tree with at most one free joint at its root. Defaults to ‘link_origin’.
relative (bool, optional) – If True, strip the morph pose offset to return the user-frame position; this only affects ref=gs.link_ref_frame.link_origin, since the offset is defined on the link origin. If False, return the world frame. Defaults to True.
- Returns:
pos – The position of all the entity’s links.
- Return type:
torch.Tensor, shape (n_links, 3) or (n_envs, n_links, 3)
- get_links_vel(links_idx_local=None, envs_idx=None, *, ref: link_ref_frame = link_ref_frame.link_origin)[source]#
Returns linear velocity of all the entity’s links expressed at a given reference position in world coordinates.
- Parameters:
links_idx_local (None | array_like) – The indices of the links. Defaults to None.
envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
ref (gs.link_ref_frame, optional) – The reference point used to express the velocity of each link: its origin (‘link_origin’) or its center of mass (‘link_COM’). Defaults to ‘link_origin’.
- Returns:
vel – The linear velocity of all the entity’s links.
- Return type:
torch.Tensor, shape (n_links, 3) or (n_envs, n_links, 3)
- apply_links_external_wrench(force=None, torque=None, links_idx_local=None, envs_idx=None, *, pos=None, ref: link_ref_frame = link_ref_frame.link_origin, local: bool = False)[source]#
Apply an external wrench over one simulation step on a set of the entity’s links.
- Parameters:
force (None | array_like, optional) – The linear force to apply. None for a pure torque. Defaults to None.
torque (None | array_like, optional) – The torque to apply, on top of the moment induced by the linear force. Defaults to None.
links_idx_local (None | array_like, optional) – The indices of the links. None to specify all the entity’s links. Defaults to None.
envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
pos (None | array_like, optional) – Where the linear force is applied, which sets the moment arm of the induced torque. With
local=True, an offset from the origin of therefframe, so the point follows each link as it moves; otherwise a world position. None applies the force at the origin of therefframe. Defaults to None.ref (gs.link_ref_frame, optional) – The reference frame: the origin of each link (‘link_origin’), or its center of mass (‘link_COM’). It fixes where the linear force acts when
posis None, and the axes of the input coordinates whenlocal=True. Defaults to ‘link_origin’.local (bool, optional) – Whether
force,torqueandposare expressed in the coordinates of therefframe rather than the world frame. Defaults to False.
- set_pos(pos, envs_idx=None, *, zero_velocity=True, relative=True, skip_forward=False)[source]#
Set position of the entity’s base link.
- Parameters:
pos (array_like) – The position to set.
envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
zero_velocity (bool, optional) – Whether to zero the velocity of all the entity’s dofs. Defaults to True. This is a safety measure after a sudden change in entity pose.
relative (bool, optional) – Whether ‘pos’ is expressed in the user frame, with the morph pose offset and inertial alignment applied on top to reach the world frame used by the solver, rather than directly in the world frame. Defaults to True.
skip_forward (bool, optional) – Whether to skip forward kinematics after setting position. Defaults to False.
- set_quat(quat, envs_idx=None, *, zero_velocity=True, relative=True, skip_forward=False)[source]#
Set quaternion of the entity’s base link.
- Parameters:
quat (array_like) – The quaternion to set.
envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
zero_velocity (bool, optional) – Whether to zero the velocity of all the entity’s dofs. Defaults to True. This is a safety measure after a sudden change in entity pose.
relative (bool, optional) – Whether ‘quat’ is expressed in the user frame, with the morph pose offset and inertial alignment applied on top to reach the world frame used by the solver, rather than directly in the world frame. Defaults to True.
skip_forward (bool, optional) – Whether to skip forward kinematics after setting quaternion. Defaults to False.
- get_verts()[source]#
Get the all vertices of the entity based on collision geometries.
- Returns:
verts – The vertices of the entity.
- Return type:
torch.Tensor, shape (n_envs, n_verts, 3)
- set_qpos(qpos, qs_idx_local=None, envs_idx=None, *, zero_velocity=True, skip_forward=False)[source]#
Set the entity’s qpos.
- Parameters:
qpos (array_like) – The qpos to set.
qs_idx_local (None | array_like, optional) – The indices of the qpos to set. If None, all qpos will be set. Note that here this uses the local
q_idx, not the scene-level one. Defaults to None.envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
zero_velocity (bool, optional) – Whether to zero the velocity of all the entity’s dofs. Defaults to True. This is a safety measure after a sudden change in entity pose.
- set_dofs_kp(kp, dofs_idx_local=None, envs_idx=None)[source]#
Set the entity’s dofs’ positional gains for the PD controller.
- Parameters:
kp (array_like) – The positional gains to set.
dofs_idx_local (None | array_like, optional) – The indices of the dofs to set. If None, all dofs will be set. Note that here this uses the local
q_idx, not the scene-level one. Defaults to None.envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
- set_dofs_kv(kv, dofs_idx_local=None, envs_idx=None)[source]#
Set the entity’s dofs’ velocity gains for the PD controller.
- Parameters:
kv (array_like) – The velocity gains to set.
dofs_idx_local (None | array_like, optional) – The indices of the dofs to set. If None, all dofs will be set. Note that here this uses the local
q_idx, not the scene-level one. Defaults to None.envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
- set_dofs_act_gain(act_gain, dofs_idx_local=None, envs_idx=None)[source]#
Set the actuator gain for the entity’s dofs. Invalidates PD-reducibility.
- Parameters:
act_gain (array_like) – The actuator gain values.
dofs_idx_local (None | array_like, optional) – The indices of the dofs. Defaults to None.
envs_idx (None | array_like, optional) – The indices of the environments. Defaults to None.
- set_dofs_act_bias(bias0, bias1, bias2, dofs_idx_local=None, envs_idx=None)[source]#
Set the actuator bias for the entity’s dofs.
- Parameters:
bias0 (array_like) – Constant bias term.
bias1 (array_like) – Position coefficient.
bias2 (array_like) – Velocity coefficient.
dofs_idx_local (None | array_like, optional) – The indices of the dofs. Defaults to None.
envs_idx (None | array_like, optional) – The indices of the environments. Defaults to None.
- set_dofs_force_range(lower, upper, dofs_idx_local=None, envs_idx=None)[source]#
Set the entity’s dofs’ force range.
- Parameters:
lower (array_like) – The lower bounds of the force range.
upper (array_like) – The upper bounds of the force range.
dofs_idx_local (None | array_like, optional) – The indices of the dofs to set. If None, all dofs will be set. Note that here this uses the local
q_idx, not the scene-level one. Defaults to None.envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
- set_dofs_frictionloss(frictionloss, dofs_idx_local=None, envs_idx=None)[source]#
Set the entity’s dofs’ friction loss. :param frictionloss: The friction loss values to set. :type frictionloss: array_like :param dofs_idx_local: The indices of the dofs to set. If None, all dofs will be set. Note that here this uses the local
q_idx, not the scene-level one. Defaults to None. :type dofs_idx_local: None | array_like, optional :param envs_idx: The indices of the environments. If None, all environments will be considered. Defaults to None. :type envs_idx: None | array_like, optional
- set_dofs_position(position, dofs_idx_local=None, envs_idx=None, *, zero_velocity=True)[source]#
Set the entity’s dofs’ position.
- Parameters:
position (array_like) – The position to set.
dofs_idx_local (None | array_like, optional) – The indices of the dofs to set. If None, all dofs will be set. Note that here this uses the local
q_idx, not the scene-level one. Defaults to None.envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
zero_velocity (bool, optional) – Whether to zero the velocity of all the entity’s dofs. Defaults to True. This is a safety measure after a sudden change in entity pose.
- control_dofs_force(force, dofs_idx_local=None, envs_idx=None)[source]#
Control the entity’s dofs’ motor force. This is used for force/torque control.
- Parameters:
force (array_like) – The force to apply.
dofs_idx_local (None | array_like, optional) – The indices of the dofs to control. If None, all dofs will be controlled. Note that here this uses the local
q_idx, not the scene-level one. Defaults to None.envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
- control_dofs_velocity(velocity, dofs_idx_local=None, envs_idx=None)[source]#
Set the PD controller’s target velocity for the entity’s dofs. This is used for velocity control.
- Parameters:
velocity (array_like) – The target velocity to set.
dofs_idx_local (None | array_like, optional) – The indices of the dofs to control. If None, all dofs will be controlled. Note that here this uses the local
q_idx, not the scene-level one. Defaults to None.envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
- control_dofs_position(position, dofs_idx_local=None, envs_idx=None)[source]#
Set the position controller’s target position for the entity’s dofs. The controller is a proportional term plus a velocity damping term (virtual friction).
- Parameters:
position (array_like) – The target position to set.
dofs_idx_local (array_like, optional) – The indices of the dofs to control. If None, all dofs will be controlled. Note that here this uses the local
q_idx, not the scene-level one. Defaults to None.envs_idx (array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
- control_dofs_position_velocity(position, velocity, dofs_idx_local=None, envs_idx=None)[source]#
Set a PD controller’s target position and velocity for the entity’s dofs. This is used for position control.
- Parameters:
position (array_like) – The target position to set.
velocity (array_like) – The target velocity
dofs_idx_local (None | array_like, optional) – The indices of the dofs to control. If None, all dofs will be controlled. Note that here this uses the local
q_idx, not the scene-level one. Defaults to None.envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
- get_dofs_control_force(dofs_idx_local=None, envs_idx=None)[source]#
Get the entity’s dofs’ internal control force, computed based on the position/velocity control command.
- Parameters:
dofs_idx_local (None | array_like, optional) – The indices of the dofs to get. If None, all dofs will be returned. Note that here this uses the local
q_idx, not the scene-level one. Defaults to None.envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
- Returns:
control_force – The entity’s dofs’ internal control force.
- Return type:
torch.Tensor, shape (n_dofs,) or (n_envs, n_dofs)
- get_dofs_force(dofs_idx_local=None, envs_idx=None)[source]#
Get the entity’s dofs’ internal force at the current time step.
Note
Different from
get_dofs_control_force, this function returns the actual internal force experienced by all the dofs at the current time step.- Parameters:
dofs_idx_local (None | array_like, optional) – The indices of the dofs to get. If None, all dofs will be returned. Note that here this uses the local
q_idx, not the scene-level one. Defaults to None.envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
- Returns:
force – The entity’s dofs’ force.
- Return type:
torch.Tensor, shape (n_dofs,) or (n_envs, n_dofs)
- get_dofs_kp(dofs_idx_local=None, envs_idx=None)[source]#
Get the positional gain (kp) for the entity’s dofs used by the PD controller.
- Parameters:
dofs_idx_local (None | array_like, optional) – The indices of the dofs to get. If None, all dofs will be returned. Note that here this uses the local
q_idx, not the scene-level one. Defaults to None.envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
- Returns:
kp – The positional gain (kp) for the entity’s dofs.
- Return type:
torch.Tensor, shape (n_dofs,) or (n_envs, n_dofs)
- get_dofs_kv(dofs_idx_local=None, envs_idx=None)[source]#
Get the velocity gain (kv) for the entity’s dofs used by the PD controller.
- Parameters:
dofs_idx_local (None | array_like, optional) – The indices of the dofs to get. If None, all dofs will be returned. Note that here this uses the local
q_idx, not the scene-level one. Defaults to None.envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
- Returns:
kv – The velocity gain (kv) for the entity’s dofs.
- Return type:
torch.Tensor, shape (n_dofs,) or (n_envs, n_dofs)
- get_dofs_act_gain(dofs_idx_local=None, envs_idx=None)[source]#
Get the actuator gain for the entity’s dofs.
- Returns:
act_gain
- Return type:
torch.Tensor, shape (n_dofs,) or (n_envs, n_dofs)
- get_dofs_act_bias(dofs_idx_local=None, envs_idx=None)[source]#
Get the actuator bias [constant, pos_coeff, vel_coeff] for the entity’s dofs.
- Returns:
bias0, bias1, bias2
- Return type:
tuple of torch.Tensor
- get_dofs_force_range(dofs_idx_local=None, envs_idx=None)[source]#
Get the force range (min and max limits) for the entity’s dofs.
- Parameters:
dofs_idx_local (None | array_like, optional) – The indices of the dofs to get. If None, all dofs will be returned. Note that here this uses the local
q_idx, not the scene-level one. Defaults to None.envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
- Returns:
lower_limit (torch.Tensor, shape (n_dofs,) or (n_envs, n_dofs)) – The lower limit of the force range for the entity’s dofs.
upper_limit (torch.Tensor, shape (n_dofs,) or (n_envs, n_dofs)) – The upper limit of the force range for the entity’s dofs.
- get_dofs_frictionloss(dofs_idx_local=None, envs_idx=None)[source]#
Get the friction loss for the entity’s dofs.
- Parameters:
dofs_idx_local (None | array_like, optional) – The indices of the dofs to get. If None, all dofs will be returned. Note that here this uses the local
q_idx, not the scene-level one. Defaults to None.envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
- Returns:
frictionloss – The friction loss for the entity’s dofs.
- Return type:
torch.Tensor, shape (n_dofs,) or (n_envs, n_dofs)
- get_kinetic_energy(envs_idx=None) Tensor[source]#
Get the total kinetic energy of the entity in Joules [J] (translational + rotational).
Summed over the entity’s links, each contributing
0.5 * V^T * I * Vfor its spatial velocityVand spatial inertiaIabout the center of mass (COM) of its kinematic tree, plus the motor armature contribution0.5 * sum_d(armature_d * dq_d^2)of its DOFs.- Parameters:
envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
- Returns:
kinetic_energy
- Return type:
torch.Tensor, shape () or (n_envs,)
- get_potential_energy(envs_idx=None) Tensor[source]#
Get the total potential energy of the entity in Joules [J] (gravitational + joint springs).
Gravity contributes
-sum_i(m_i * g^T * p_i)over the entity’s links, wherep_iis the center-of-mass position of link i andgis the gravity vector obtained from the solver. Its joint springs contribute0.5 * sum_d(stiffness_d * (q_d - q0_d)^2), the elastic energy stored by holding each DOF away from its neutral position.- Parameters:
envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
- Returns:
potential_energy
- Return type:
torch.Tensor, shape () or (n_envs,)
- get_total_energy(envs_idx=None) Tensor[source]#
Get the total mechanical energy of the entity in Joules [J] (kinetic + potential).
- Parameters:
envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
- Returns:
total_energy
- Return type:
torch.Tensor, shape () or (n_envs,)
- detect_collision(env_idx=0)[source]#
Detects collision for the entity. This only supports a single environment.
Note
This function re-detects real-time collision for the entity, so it doesn’t rely on scene.step() and can be used for applications like motion planning, which doesn’t require physical simulation during state sampling.
- Parameters:
env_idx (int, optional) – The index of the environment. Defaults to 0.
- get_contacts(with_entity=None, exclude_self_contact=False, is_padded=False)[source]#
Returns contact information computed during the most recent
scene.step(). Ifwith_entityis provided, only returns contact information involving the caller and the specified entity. Otherwise, returns all contact information involving the caller entity. Whenwith_entityisself, it will return the self-collision only.The returned dict contains the following keys (a contact pair consists of two geoms: A and B):
- ‘geom_a’The global geom index of geom A in the contact pair.
(actual geom object can be obtained by scene.rigid_solver.geoms[geom_a])
- ‘geom_b’The global geom index of geom B in the contact pair.
(actual geom object can be obtained by scene.rigid_solver.geoms[geom_b])
- ‘link_a’The global link index of link A (that contains geom A) in the contact pair.
(actual link object can be obtained by scene.rigid_solver.links[link_a])
- ‘link_b’The global link index of link B (that contains geom B) in the contact pair.
(actual link object can be obtained by scene.rigid_solver.links[link_b])
‘position’ : The contact position in world frame.
‘force_a’ : The contact force applied to geom A.
‘force_b’ : The contact force applied to geom B.
- ‘valid_mask’A boolean mask indicating whether the contact information is valid.
(Only when scene is parallelized)
- The shape of each entry is (n_envs, n_contacts, …) for scene with parallel envs
and (n_contacts, …) for non-parallelized scene.
- Parameters:
with_entity (RigidEntity, optional) – The entity to check contact with. Defaults to None.
exclude_self_contact (bool) – Exclude the self collision from the returning contacts. Defaults to False.
is_padded (bool) – Return tensors padded to a fixed capacity along the contact axis instead of trimmed to the live contact count, with ‘valid_mask’ flagging the real contacts. This avoids a per-step device-to-host synchronization; the values are otherwise identical on every backend. Defaults to False.
- Returns:
contact_info – The contact information.
- Return type:
dict
- get_links_net_contact_force(envs_idx=None)[source]#
Returns net force applied on each links due to direct external contacts.
- Returns:
entity_links_force – The net force applied on each links due to direct external contacts.
- Return type:
torch.Tensor, shape (n_links, 3) or (n_envs, n_links, 3)
- set_friction_ratio(friction_ratio, links_idx_local=None, envs_idx=None)[source]#
Set the friction ratio of the geoms of the specified links.
- Parameters:
friction_ratio (torch.Tensor, shape (n_envs, n_links)) – The friction ratio
links_idx_local (array_like) – The indices of the links to set friction ratio.
envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
- set_friction(friction)[source]#
Set the friction coefficient of all the links (and in turn, geometries) of the rigid entity.
Note
The friction coefficient associated with a pair of geometries in contact is defined as the maximum between their respective values, so one must be careful the set the friction coefficient properly for both of them.
Warning
The friction coefficient must be in range [1e-2, 5.0] for simulation stability.
- Parameters:
friction (float) – The friction coefficient to set.
- set_friction_torsional(friction_torsional)[source]#
Set the torsional friction coefficient of all the links (and in turn, geometries) of the rigid entity.
Note
The torsional friction coefficient associated with a pair of geometries in contact is defined as the maximum between their respective values (see ‘gs.materials.Rigid’). Only effective when torsional friction is enabled at the scene level (see ‘RigidOptions.enable_torsional_friction’).
- Parameters:
friction_torsional (float) – The torsional friction coefficient to set.
- set_friction_rolling(friction_rolling)[source]#
Set the rolling friction coefficient of all the links (and in turn, geometries) of the rigid entity.
Note
The rolling friction coefficient associated with a pair of geometries in contact is defined as the maximum between their respective values (see ‘gs.materials.Rigid’). Only effective when rolling friction is enabled at the scene level (see ‘RigidOptions.enable_rolling_friction’).
- Parameters:
friction_rolling (float) – The rolling friction coefficient to set.
- set_mass_shift(mass_shift, links_idx_local=None, envs_idx=None)[source]#
Set the mass shift of specified links.
- Parameters:
mass (torch.Tensor, shape (n_envs, n_links)) – The mass shift
links_idx_local (array_like) – The indices of the links to set mass shift.
envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
- set_COM_shift(com_shift, links_idx_local=None, envs_idx=None)[source]#
Set the center of mass (COM) shift of specified links.
- Parameters:
com (torch.Tensor, shape (n_envs, n_links, 3)) – The COM shift
links_idx_local (array_like) – The indices of the links to set COM shift.
envs_idx (None | array_like, optional) – The indices of the environments. If None, all environments will be considered. Defaults to None.
- get_mass()[source]#
Get the total mass of the entity in kg.
For heterogeneous entities, returns an array of masses for each environment. For non-heterogeneous entities, returns a scalar mass.
- Returns:
mass – The total mass of the entity in kg. For heterogeneous entities, returns an array of shape (n_envs,) with per-environment masses.
- Return type:
float | np.ndarray
- property visualize_contact#
Whether to visualize contact force.
- property n_geoms#
The number of collision geom
RigidGeomin the entity.
- property n_cells#
The number of sdf cells in the entity.
- property n_verts#
The number of vertices (from collision geom
RigidGeom) in the entity.
- property n_faces#
The number of faces (from collision geom
RigidGeom) in the entity.
- property n_edges#
The number of edges (from collision geom
RigidGeom) in the entity.
- property geom_start#
The index of the entity’s first RigidGeom in the scene.
- property geom_end#
The index of the entity’s last RigidGeom in the scene plus one.
- property cell_start#
The start index the entity’s sdf cells in the scene.
- property cell_end#
The end index the entity’s sdf cells in the scene plus one.
- property gravity_compensation#
Apply a force to compensate gravity. A value of 1 will make a zero-gravity behavior. Default to 0
- property vert_start#
The index of the entity’s first
vert(collision vertex) in the scene.
- property face_start#
The index of the entity’s first
face(collision face) in the scene.
- property edge_start#
The index of the entity’s first
edge(collision edge) in the scene.
- property geoms: list[genesis.engine.entities.rigid_entity.rigid_geom.RigidGeom]#
The list of collision geoms (
RigidGeom) in the entity.
- property n_equalities#
The number of equality constraints in the entity.
- property equality_start#
The index of the entity’s first RigidEquality in the scene.
- property equality_end#
The index of the entity’s last RigidEquality in the scene plus one.
- property equalities#
The list of equality constraints (
RigidEquality) in the entity.
- property is_free: bool#
- property is_local_collision_mask#
Whether the contype and conaffinity bitmasks of this entity only applies to self-collision.
Equality constraint types#
The value returned by RigidEquality.type, for the equality constraints an entity carries. How each one enters the
constraint solve is described in Constraint model.