Entity#
An entity is a single simulated object in a Genesis World scene: a robot, a rigid body, a piece of cloth, a volume of fluid, or a deformable solid. It is the unit you add, configure, query, and control.
You create an entity by calling scene.add_entity, which combines three ingredients:
Morph: the geometry and pose: a primitive shape, a mesh, or a robot description loaded from URDF, MJCF, or USD. See Morph.
Material: the physical model that decides which solver simulates the entity and how it responds to forces. See Material.
Surface: the visual appearance used for rendering: color, texture, and visualization mode. See Surface.
import genesis as gs
gs.init()
scene = gs.Scene()
franka = scene.add_entity(
gs.morphs.MJCF(file="xml/franka_emika_panda/panda.xml"),
)
scene.build() # required before stepping or reading state
add_entity returns the entity object. Its concrete type depends on the material’s solver: a rigid material yields a RigidEntity, an MPM material yields an MPMEntity, and so on.
Object-oriented accessors#
Genesis World follows an object-oriented model: you interact with each entity through methods on the object add_entity returned, rather than through global scene calls indexed by id. After scene.build(), you read state and issue commands directly, for example franka.get_pos(), franka.get_dofs_position(), and franka.control_dofs_position(...) on a rigid entity. The available methods differ by entity type; see each type’s reference page.
State-reading methods return tensors that follow the batched-optional shape convention: the leading environment dimension is present when the scene is built with multiple environments and absent otherwise, for example ([n_envs,] 3) for a position. See Hello, Genesis World for a worked example.
Entity types#
Each physics solver has its own entity type. Choosing a material selects the solver, and therefore the type of the returned entity.
RigidEntity: articulated rigid bodies and robots simulated by the rigid solver. It is the type used for most manipulation and locomotion tasks and exposes links, joints, and dofs.DroneEntity: aRigidEntitysubclass that adds propeller and thrust control for quadrotor simulation.MPMEntity: elastic and plastic solids, sand, snow, and similar continua simulated with the Material Point Method (MPM) solver.FEMEntity: deformable solids simulated with the Finite Element Method (FEM) solver.PBD entities: cloth, ropes, and particle-based fluids simulated by the Position Based Dynamics (PBD) solver. The material determines the concrete type: for example
PBD2DEntityfor cloth andPBD3DEntityfor elastic volumes.SPHEntity: liquids and gases simulated with the Smoothed Particle Hydrodynamics (SPH) solver.SFParticleEntity: smoke and gaseous media simulated with the Stable Fluid (SF) solver.ToolEntity: a kinematically-scripted collider that couples one-way with soft and particle-based entities to push or deform them.HybridEntity: an entity composed of both rigid and soft components, used to couple, for example, a soft body to a rigid skeleton.Emitter: a helper that continuously injects particles into a particle-based entity during simulation, for spraying and streaming effects.
- Rigid entity
RigidEntityRigidEntityRigidEntity.get_jacobian()RigidEntity.inverse_kinematics()RigidEntity.inverse_kinematics_multilink()RigidEntity.forward_kinematics()RigidEntity.plan_path()RigidEntity.get_state()RigidEntity.get_AABB()RigidEntity.get_aabb()RigidEntity.get_links_pos()RigidEntity.get_links_vel()RigidEntity.get_links_acc()RigidEntity.get_links_acc_ang()RigidEntity.get_links_inertial_mass()RigidEntity.get_links_invweight()RigidEntity.set_pos()RigidEntity.set_pos_grad()RigidEntity.set_quat()RigidEntity.set_quat_grad()RigidEntity.get_verts()RigidEntity.set_qpos()RigidEntity.set_dofs_kp()RigidEntity.set_dofs_kv()RigidEntity.set_dofs_act_gain()RigidEntity.set_dofs_act_bias()RigidEntity.set_dofs_force_range()RigidEntity.set_dofs_stiffness()RigidEntity.set_dofs_invweight()RigidEntity.set_dofs_armature()RigidEntity.set_dofs_damping()RigidEntity.set_dofs_frictionloss()RigidEntity.set_dofs_velocity_grad()RigidEntity.set_dofs_position()RigidEntity.control_dofs_force()RigidEntity.control_dofs_velocity()RigidEntity.control_dofs_position()RigidEntity.control_dofs_position_velocity()RigidEntity.get_dofs_control_force()RigidEntity.get_dofs_force()RigidEntity.get_dofs_kp()RigidEntity.get_dofs_kv()RigidEntity.get_dofs_act_gain()RigidEntity.get_dofs_act_bias()RigidEntity.get_dofs_force_range()RigidEntity.get_dofs_stiffness()RigidEntity.get_dofs_invweight()RigidEntity.get_dofs_armature()RigidEntity.get_dofs_damping()RigidEntity.get_dofs_frictionloss()RigidEntity.get_mass_mat()RigidEntity.get_kinetic_energy()RigidEntity.get_potential_energy()RigidEntity.get_total_energy()RigidEntity.detect_collision()RigidEntity.get_contacts()RigidEntity.get_links_net_contact_force()RigidEntity.set_friction_ratio()RigidEntity.set_friction()RigidEntity.set_mass_shift()RigidEntity.set_COM_shift()RigidEntity.set_links_inertial_mass()RigidEntity.set_links_invweight()RigidEntity.set_mass()RigidEntity.get_mass()RigidEntity.visualize_contactRigidEntity.n_geomsRigidEntity.n_cellsRigidEntity.n_vertsRigidEntity.n_facesRigidEntity.n_edgesRigidEntity.geom_startRigidEntity.geom_endRigidEntity.cell_startRigidEntity.cell_endRigidEntity.gravity_compensationRigidEntity.vert_startRigidEntity.face_startRigidEntity.edge_startRigidEntity.geomsRigidEntity.n_equalitiesRigidEntity.equality_startRigidEntity.equality_endRigidEntity.equalitiesRigidEntity.is_freeRigidEntity.is_local_collision_mask
RigidLinkRigidLinkRigidLink.get_verts()RigidLink.get_AABB()RigidLink.set_mass()RigidLink.get_mass()RigidLink.set_friction()RigidLink.visualize_contactRigidLink.invweightRigidLink.inertial_posRigidLink.inertial_quatRigidLink.inertial_massRigidLink.inertial_iRigidLink.geomsRigidLink.n_geomsRigidLink.geom_startRigidLink.geom_endRigidLink.n_cellsRigidLink.n_vertsRigidLink.n_facesRigidLink.n_edgesRigidLink.is_free
RigidJointRigidJointRigidJoint.get_pos()RigidJoint.get_quat()RigidJoint.get_anchor_pos()RigidJoint.get_anchor_axis()RigidJoint.set_sol_params()RigidJoint.sol_paramsRigidJoint.uidRigidJoint.nameRigidJoint.entityRigidJoint.solverRigidJoint.linkRigidJoint.idxRigidJoint.idx_localRigidJoint.init_qposRigidJoint.n_qsRigidJoint.n_dofsRigidJoint.typeRigidJoint.posRigidJoint.quatRigidJoint.q_startRigidJoint.dof_startRigidJoint.q_endRigidJoint.dof_endRigidJoint.dofs_idxRigidJoint.dofs_idx_localRigidJoint.qs_idxRigidJoint.qs_idx_localRigidJoint.dofs_motion_angRigidJoint.dofs_motion_velRigidJoint.dofs_limitRigidJoint.dofs_invweightRigidJoint.dofs_lengthRigidJoint.dofs_frictionlossRigidJoint.dofs_stiffnessRigidJoint.dofs_dampingRigidJoint.dofs_armatureRigidJoint.dofs_act_gainRigidJoint.dofs_act_biasRigidJoint.dofs_force_rangeRigidJoint.is_built
RigidGeomRigidGeomRigidGeom.get_trimesh()RigidGeom.get_sdf_trimesh()RigidGeom.visualize_sdf()RigidGeom.set_friction()RigidGeom.get_pos()RigidGeom.get_quat()RigidGeom.get_verts()RigidGeom.get_AABB()RigidGeom.set_sol_params()RigidGeom.sol_paramsRigidGeom.uidRigidGeom.idxRigidGeom.typeRigidGeom.frictionRigidGeom.dataRigidGeom.metadataRigidGeom.linkRigidGeom.entityRigidGeom.solverRigidGeom.is_convexRigidGeom.meshRigidGeom.needs_coupRigidGeom.contypeRigidGeom.conaffinityRigidGeom.coup_softnessRigidGeom.coup_frictionRigidGeom.coup_restitutionRigidGeom.init_posRigidGeom.init_quatRigidGeom.init_vertsRigidGeom.init_facesRigidGeom.init_edgesRigidGeom.init_normalsRigidGeom.init_center_posRigidGeom.uvsRigidGeom.surfaceRigidGeom.gsd_pathRigidGeom.sdf_resRigidGeom.sdf_valRigidGeom.sdf_val_flattenedRigidGeom.sdf_gradRigidGeom.sdf_grad_flattenedRigidGeom.sdf_maxRigidGeom.sdf_cell_sizeRigidGeom.sdf_grad_deltaRigidGeom.sdf_closest_vertRigidGeom.sdf_closest_vert_flattenedRigidGeom.T_mesh_to_sdfRigidGeom.n_cellsRigidGeom.n_vertsRigidGeom.n_facesRigidGeom.n_edgesRigidGeom.cell_startRigidGeom.vert_startRigidGeom.face_startRigidGeom.edge_startRigidGeom.verts_state_startRigidGeom.cell_endRigidGeom.vert_endRigidGeom.verts_state_endRigidGeom.face_endRigidGeom.edge_endRigidGeom.is_builtRigidGeom.is_freeRigidGeom.is_fixed
RigidVisGeomRigidVisGeomRigidVisGeom.get_trimesh()RigidVisGeom.get_pos()RigidVisGeom.get_quat()RigidVisGeom.get_vAABB()RigidVisGeom.set_vverts()RigidVisGeom.get_vverts()RigidVisGeom.uidRigidVisGeom.idxRigidVisGeom.linkRigidVisGeom.entityRigidVisGeom.vmeshRigidVisGeom.solverRigidVisGeom.metadataRigidVisGeom.init_posRigidVisGeom.init_quatRigidVisGeom.init_vvertsRigidVisGeom.init_vfacesRigidVisGeom.init_vnormalsRigidVisGeom.uvsRigidVisGeom.surfaceRigidVisGeom.n_vvertsRigidVisGeom.n_vfacesRigidVisGeom.vvert_startRigidVisGeom.vface_startRigidVisGeom.vvert_endRigidVisGeom.vface_endRigidVisGeom.is_builtRigidVisGeom.is_freeRigidVisGeom.is_fixed
MPMEntityMPMEntityMPMEntity.init_tgt_keys()MPMEntity.add_grad_from_state()MPMEntity.process_input()MPMEntity.process_input_grad()MPMEntity.get_state()MPMEntity.get_frame()MPMEntity.set_particles_pos()MPMEntity.get_particles_pos()MPMEntity.set_particles_vel()MPMEntity.get_particles_vel()MPMEntity.set_particles_active()MPMEntity.get_particles_active()MPMEntity.set_actuation()MPMEntity.set_particles_actu()MPMEntity.get_particles_actu()MPMEntity.set_muscle_group()MPMEntity.get_muscle_group()MPMEntity.set_muscle_direction()MPMEntity.set_muscle()MPMEntity.set_free()MPMEntity.get_free()MPMEntity.get_particles_in_bbox()MPMEntity.set_particle_constraints()MPMEntity.remove_particle_constraints()
FEMEntityFEMEntityFEMEntity.set_position()FEMEntity.set_velocity()FEMEntity.set_actuation()FEMEntity.set_muscle()FEMEntity.get_state()FEMEntity.deactivate()FEMEntity.activate()FEMEntity.instantiate()FEMEntity.sample()FEMEntity.compute_pressure_field()FEMEntity.init_tgt_keys()FEMEntity.init_tgt_vars()FEMEntity.init_ckpt()FEMEntity.save_ckpt()FEMEntity.load_ckpt()FEMEntity.reset_grad()FEMEntity.process_input()FEMEntity.process_input_grad()FEMEntity.set_pos()FEMEntity.set_pos_grad()FEMEntity.set_vel()FEMEntity.set_vel_grad()FEMEntity.set_actu()FEMEntity.set_actu_grad()FEMEntity.set_active()FEMEntity.set_muscle_group()FEMEntity.set_muscle_direction()FEMEntity.set_vertex_constraints()FEMEntity.update_constraint_targets()FEMEntity.remove_vertex_constraints()FEMEntity.get_el2v()FEMEntity.get_frame()FEMEntity.clear_grad()FEMEntity.n_verticesFEMEntity.n_elementsFEMEntity.n_surfacesFEMEntity.v_startFEMEntity.el_startFEMEntity.s_startFEMEntity.morphFEMEntity.materialFEMEntity.surfaceFEMEntity.n_surface_verticesFEMEntity.surface_trianglesFEMEntity.uvsFEMEntity.tet_cfg
- PBD entities
SPHEntitySPHEntitySPHEntity.init_sampler()SPHEntity.add_grad_from_state()SPHEntity.get_frame()SPHEntity.get_state()SPHEntity.set_particles_pos()SPHEntity.get_particles_pos()SPHEntity.get_position()SPHEntity.set_particles_vel()SPHEntity.get_particles_vel()SPHEntity.set_particles_active()SPHEntity.get_particles_active()
SFParticleEntityDroneEntityHybridEntityHybridEntityHybridEntity.get_dofs_position()HybridEntity.get_dofs_velocity()HybridEntity.get_dofs_force()HybridEntity.get_dofs_control_force()HybridEntity.set_dofs_velocity()HybridEntity.set_dofs_force()HybridEntity.control_dofs_position()HybridEntity.control_dofs_position_velocity()HybridEntity.control_dofs_velocity()HybridEntity.control_dofs_force()HybridEntity.build()HybridEntity.update_soft_part()HybridEntity.n_dofsHybridEntity.fixedHybridEntity.part_rigidHybridEntity.part_softHybridEntity.solver_rigidHybridEntity.solver_soft
ToolEntityToolEntityToolEntity.init_tgt_vars()ToolEntity.init_ckpt()ToolEntity.reset_grad()ToolEntity.save_ckpt_kernel()ToolEntity.load_ckpt_kernel()ToolEntity.save_ckpt()ToolEntity.load_ckpt()ToolEntity.substep_pre_coupling()ToolEntity.substep_pre_coupling_grad()ToolEntity.substep_post_coupling()ToolEntity.substep_post_coupling_grad()ToolEntity.collide()ToolEntity.pbd_collide()ToolEntity.update_latest_pos()ToolEntity.advect()ToolEntity.copy_frame()ToolEntity.copy_grad()ToolEntity.reset_grad_till_frame()ToolEntity.get_frame()ToolEntity.set_frame()ToolEntity.set_frame_add_grad_pos()ToolEntity.set_frame_add_grad_quat()ToolEntity.set_frame_add_grad_vel()ToolEntity.set_frame_add_grad_ang()ToolEntity.get_state()ToolEntity.set_state()ToolEntity.build()ToolEntity.set_init_state()ToolEntity.set_vel()ToolEntity.set_vel_grad()ToolEntity.set_ang()ToolEntity.set_ang_grad()ToolEntity.set_pos()ToolEntity.set_pos_grad()ToolEntity.set_quat()ToolEntity.set_quat_grad()ToolEntity.set_velocity()ToolEntity.set_position()ToolEntity.set_quaternion()ToolEntity.process_input()ToolEntity.process_input_grad()ToolEntity.collect_output_grads()ToolEntity.add_grad_from_state()ToolEntity.uidToolEntity.idxToolEntity.sceneToolEntity.solverToolEntity.materialToolEntity.morphToolEntity.surfaceToolEntity.init_posToolEntity.init_quat
Emitter