KinematicSolver#
The KinematicSolver is a lightweight solver for ghost or reference entities that only computes forward kinematics for visualization. It performs no collision detection, physics integration, or constraint solving, so its entities move exactly as scripted without interacting with the rest of the scene. An entity uses it when built with the gs.materials.Kinematic material.
Options#
- class genesis.options.solvers.KinematicOptions(*, dt: float | None = None, batch_links_info: bool = False, batch_joints_info: bool = False, batch_dofs_info: bool = False, IK_max_targets: int = 6) None[source]#
Options configuring the KinematicSolver (visualization-only solver).
KinematicSolver is a lightweight solver for ghost/reference entities that only computes forward kinematics for visualization. No collision, physics integration, or constraint solving is performed.
- Parameters:
dt (float, optional) – Time duration for each simulation step in seconds. If none, it will inherit from
SimOptions. Defaults to None.batch_links_info (bool, optional) – Whether to batch link info. Automatically enabled for heterogeneous simulation. Defaults to False.
batch_dofs_info (bool, optional) – Whether to batch DOF info. Defaults to False.
IK_max_targets (int, optional) – Maximum number of IK targets. Increasing this doesn’t affect IK solving speed, but will increase memory usage. Defaults to 6.
KinematicSolver#
- class genesis.engine.solvers.kinematic_solver.KinematicSolver(scene: Scene, sim: Simulator, options: KinematicOptions)[source]#
Bases:
SolverBase solver for articulated kinematic entities (FK, rendering, state get/set).
Provides the full build pipeline, field init methods, counter properties, render methods, and IO sanitization shared by both KinematicSolver and RigidSolver.
RigidSolver extends this with physics (collision, constraints, dynamics).
- add_entity(idx, material, morph, surface, visualize_contact=False, name=None) KinematicEntity[source]#
- property is_active#
- set_base_links_pos(pos, links_idx=None, envs_idx=None, *, relative=False, skip_forward=False)[source]#
- set_base_links_quat(quat, links_idx=None, envs_idx=None, *, relative=False, skip_forward=False)[source]#
- update_forward_pos()[source]#
Run forward kinematics if links_state is not already up to date for the current pose.
- update_vverts_for_vgeoms(vgeoms_idx)[source]#
Refresh the vverts_state.pos slice for the requested vgeoms by re-running FK.
Used by set_vverts(None, …) and at scene-build time to initialize the custom buffer with a meaningful pose. The kernel is a no-op for vgeoms whose vverts have no state slot.
- set_vverts(custom_vvert_start, custom_vvert_end, vgeoms_idx, vverts, envs_idx=None)[source]#
Write the slice [custom_vvert_start:custom_vvert_end] of vverts_state.pos.
vverts=None re-populates the slice from FK by running update_vverts_for_vgeoms over the vgeoms owning the slice. Otherwise vverts is broadcast to the slice shape and written directly. vverts_state.pos is always batched; envs_idx selects which envs to write to.
- get_vverts(custom_vvert_start, custom_vvert_end, envs_idx=None)[source]#
Return a copy of the vverts_state.pos slice for the given custom-vvert range.
Shape: (len(envs_idx), custom_vvert_end - custom_vvert_start, 3). envs_idx=None returns every env.
- get_links_jacobian(link_idx, dof_start, n_dofs, local_point=None)[source]#
Spatial Jacobian of a link-local point, as (n_envs, 6, n_dofs), for the entity owning that link.
dof_start offsets the entity degrees of freedom into the solver and n_dofs narrows the shared buffer down to that entity. local_point defaults to the link origin.
- forward_kinematics_query(entity, qpos, envs_idx=None)[source]#
Link poses one entity would have at the given configuration, leaving the live configuration as it was.
Distinct from the forward kinematics the step propagates: this evaluates a configuration the solver does not hold, and restores the one it does. Returns positions (n_envs, n_links, 3) and orientations (n_envs, n_links, 4), without the batch dimension when the scene is not batched.
- inverse_kinematics(entity_idx, q_start, link_start, joint_start, links_idx, dofs_idx, envs_idx, poss, quats, local_points, init_qpos, pos_mask, rot_mask, link_pos_mask, link_rot_mask, n_qs, n_dofs, custom_init_qpos, max_samples, max_solver_iters, damping, pos_tol, rot_tol, max_step_size, seed, respect_joint_limit)[source]#
Damped-least-squares inverse kinematics of one entity for the given link targets.
Returns the best configuration per environment, spanning the entity, and the stacked pose residual of every target it carries. Callers narrow both to the environments and targets they asked for.
- property links#
- property joints#
- property geoms#
- property vgeoms#
- property vfaces_raycast_mask: Tensor#
Per-vface mask, shape (n_vfaces,), selecting the vfaces opted into visual raycasting.
A vface is opted in iff its owning vgeom belongs to an entity whose material has use_visual_raycasting=True. Both the entity materials and the vface-to-vgeom mapping are fixed once the scene is built, so the mask is fitted at build time and shared by every visual raycast BVH (raycaster sensors, viewer plugins) to gate which vfaces contribute.
- property n_links#
- property n_joints#
- property n_vgeoms#
- property n_vverts#
- property n_vfaces#
- property n_custom_vverts#
- property n_custom_vfaces#
- property n_qs#
- property n_dofs#
- property init_qpos#
See also#
Kinematic: the kinematic material that selects this solver.