Rigid bodies#

A rigid body is the default kind of entity in Genesis World: a solid that does not deform, simulated by the rigid solver. It is what you get from Hello, Genesis World, and it covers most of robotics: robot arms, grippers, mobile bases, and the props they interact with. The rest of this section covers the non-rigid families that build on the same Scene.

Adding a rigid body#

An entity is rigid whenever its material is gs.materials.Rigid, which is the default, so you usually pass only a morph:

box = scene.add_entity(gs.morphs.Box(pos=(0, 0, 0.5), size=(0.2, 0.2, 0.2)))
franka = scene.add_entity(gs.morphs.MJCF(file="xml/franka_emika_panda/panda.xml"))

Both are rigid entities. The box is a single body; the Franka is articulated, a tree of rigid links connected by joints.

Single bodies and articulated bodies#

Every rigid entity is a RigidEntity, driven through its own methods rather than a global handle. An articulated entity exposes its structure:

  • Links (entity.links, entity.n_links): the individual rigid bodies in the tree.

  • Joints (entity.joints, entity.n_joints): the connections between links.

  • Degrees of freedom (entity.n_dofs): the independent coordinates the joints move along. A single free body has 6 dofs; a fixed box has none.

Read and write state through the entity: get_pos() and get_quat() for the base pose, and get_dofs_position() for joint positions. Control your robot covers driving those dofs with a controller, and Robot control does the same for arms.

Fixed and free bases#

Whether an entity’s base is bolted to the world or floats freely depends on the morph. An MJCF file specifies the base joint itself; a URDF base is free (a 6-dof joint to the world) unless you pass fixed=True. See Loading assets for the details.

Physical properties#

The rigid material sets how a body interacts physically. Pass a configured gs.materials.Rigid to override the defaults:

box = scene.add_entity(
    gs.morphs.Box(pos=(0, 0, 0.5), size=(0.2, 0.2, 0.2)),
    material=gs.materials.Rigid(
        rho=1000.0,               # density in kg/m3, used to estimate mass
        friction=1.0,             # sliding (Coulomb) friction coefficient
        friction_torsional=0.005, # resists spin about the contact normal (meters)
        friction_rolling=0.0001,  # resists rolling about the tangent axes (meters)
    ),
)

Torsional and rolling friction take effect only once you enable them on the solver, since they add constraint rows to every contact:

scene = gs.Scene(
    rigid_options=gs.options.RigidOptions(
        friction_cone=gs.friction_cone.elliptic,  # exact isotropic cone (default: pyramidal)
        enable_torsional_friction=True,
        enable_rolling_friction=True,              # requires enable_torsional_friction
    ),
)

Choose the elliptic friction_cone when resting objects have to stay put rather than creeping slowly. Paired with the default Newton constraint_solver it also unlocks the signorini contact resolution, which we then select by default: friction is bounded by the normal force the contact has developed, so a fast-sliding body decelerates at friction times gravity instead of lifting off a flat floor. Set contact_resolution explicitly to override that choice.

Two examples show each coefficient on its own. examples/rigid/torsional_grasp.py pinches a ball between two plates and spins it, and the point contact resists the spin only through friction_torsional. examples/rigid/rolling_coast.py rolls two balls side by side, and only the one with a friction_rolling coefficient coasts to a stop.

The rigid solver governs how these bodies actually push on each other: contact, collision geometry, and constraints. Theory and modeling documents that model, and covers contact resolution in full.

See also#