newton.solvers.SolverMuJoCo#

class newton.solvers.SolverMuJoCo(model, *, separate_worlds=None, njmax=None, njmax_nnz=None, nconmax=None, iterations=None, ls_iterations=None, ccd_iterations=None, sdf_iterations=None, sdf_initpoints=None, solver=None, integrator=None, cone=None, jacobian=None, impratio=None, tolerance=None, ls_tolerance=None, ccd_tolerance=None, density=None, viscosity=None, wind=None, magnetic=None, use_mujoco_cpu=False, enable_multiccd=None, enable_sleeping=None, nvmax=None, sleep_tolerance=None, disable_contacts=None, disable_sensors=None, update_data_interval=None, save_to_mjcf=None, use_mujoco_contacts=True, use_speculative_contacts=False, include_sites=True, skip_visual_only_geoms=True, deterministic=None, strict_capacity=False, kinematic_switchable_roots=True)[source]#

Bases: SolverBase, CouplingInterface

This solver provides an interface to simulate physics using the MuJoCo physics engine, optimized with GPU acceleration through mujoco_warp. It supports both MuJoCo and mujoco_warp backends, enabling efficient simulation of articulated systems with contacts and constraints.

Note

  • This solver requires mujoco_warp and its dependencies to be installed.

  • For installation instructions, see the mujoco_warp repository.

  • shape_collision_radius from Newton models is not used by MuJoCo. Instead, MuJoCo computes bounding sphere radii (geom_rbound) internally based on the geometry definition.

Joint support:

See Joint Feature Support for the full comparison across solvers.

Example

solver = newton.solvers.SolverMuJoCo(model)

# simulation loop
for i in range(100):
    solver.step(state_in, state_out, control, contacts, dt)
    state_in, state_out = state_out, state_in

Debugging#

To debug the SolverMuJoCo, you can save the MuJoCo model that is created from the newton.Model in the constructor of the SolverMuJoCo:

solver = newton.solvers.SolverMuJoCo(model, save_to_mjcf="model.xml")

This will save the MuJoCo model as an MJCF file, which can be opened in the MuJoCo simulator.

It is also possible to visualize the simulation running in the SolverMuJoCo through MuJoCo’s own viewer. This may help to debug the simulation and see how the MuJoCo model looks like when it is created from the Newton model.

import newton

solver = newton.solvers.SolverMuJoCo(model)

for _ in range(num_frames):
    # step the solver
    solver.step(state_in, state_out, control, contacts, dt)
    state_in, state_out = state_out, state_in

    solver.render_mujoco_viewer()
class CtrlSource(*values)#

Bases: IntEnum

Control source for MuJoCo actuators.

Determines where an actuator gets its control input from:

CTRL_DIRECT = 1#
JOINT_TARGET = 0#
class CtrlType(*values)#

Bases: IntEnum

Control type for MuJoCo actuators.

For JOINT_TARGET mode, determines which target array to read from:

DCMOTOR = 3#
GENERAL = 2#
POSITION = 0#
VELOCITY = 1#
class EqType(*values)#

Bases: IntEnum

MuJoCo equality constraint type.

CONNECT = 0#

Constrains two bodies at a point (like a ball joint).

JOINT = 2#

Constrains one scalar joint coordinate to a quartic polynomial of another.

TENDON = 3#

Constrains one tendon length to a quartic polynomial of another, or to a constant offset.

WELD = 1#

Welds two bodies together (like a fixed joint).

class ObservableKind#

Bases: ObservableKind

Standard and MuJoCo-specific observable kinds.

Inherits all standard names from SolverBase.ObservableKind. Backend support is reported by SolverMuJoCo.supported_observables.

See Solver Observables for solver-specific kinds and backend support.

Experimental

Experimental feature. API, behavior, defaults, and supported use cases may change without prior notice.

OVERFLOW = 'overflow'#

Per-world capacity-overflow bitmask for the most recent step; see MuJoCo overflow diagnostics.

QFRC_ACTUATOR = 'qfrc_actuator'#

Actuator forces in Newton generalized-coordinate order.

QFRC_BIAS = 'qfrc_bias'#

Coriolis, centrifugal and gravity forces C(q, qd) in Newton generalized-coordinate order.

QFRC_CONSTRAINT = 'qfrc_constraint'#

Constraint forces in Newton generalized-coordinate order, including DOF friction loss.

QFRC_FRICTIONLOSS = 'qfrc_frictionloss'#

DOF friction-loss constraint forces in Newton generalized-coordinate order.

class Observables#

Bases: Observables

Standard and MuJoCo-specific observable arrays.

When use_mujoco_contacts=True, size contact storage using SolverMuJoCo.get_max_contact_count(). Otherwise, use the collision pipeline’s contact storage.

See Solver Observables for allocation, backend limitations, and examples.

Experimental

The solver observable API may change without prior notice.

__init__()#
overflow: wp.array[wp.int32] | None = None#

Per-world capacity-overflow bitmask of SolverMuJoCo.OverflowBits for the latest step, shape (world_count,).

qfrc_actuator: wp.array[wp.float32] | None = None#

Actuator forces [N or N·m], shape (joint_dof_count,).

qfrc_bias: wp.array[wp.float32] | None = None#

Coriolis, centrifugal and gravity forces from MuJoCo’s last force evaluation of the step [N or N·m], shape (joint_dof_count,).

That is the start of the step, except for RK4, where it is the last stage.

qfrc_constraint: wp.array[wp.float32] | None = None#

Constraint forces [N or N·m], shape (joint_dof_count,).

From the same force evaluation as qfrc_bias.

qfrc_frictionloss: wp.array[wp.float32] | None = None#

DOF friction-loss forces [N or N·m], shape (joint_dof_count,).

Part of qfrc_constraint; qfrc_constraint - qfrc_frictionloss is the constraint load on a DOF without its own friction. As in MuJoCo, the force opposes the DOF motion. From the same force evaluation as qfrc_bias.

class OverflowBits(*values)#

Bases: IntFlag

Bits of the per-world Observables.overflow bitmask.

Bits 0-15 carry MuJoCo Warp’s own mujoco_warp.OverflowType flags (NEFC, NJMAX_NNZ, BROADPHASE, …). The members below are the bits Newton adds on top.

See MuJoCo overflow diagnostics for allocation, interpretation, backend support, and shared-buffer attribution.

CONTACT_PIPELINE = 65536#

The Newton collision pipeline generated more contacts than rigid_contact_max.

SOLVER_NCONMAX = 131072#

Newton contacts exceeded MuJoCo Warp’s nconmax capacity.

class SleepPolicy(*values)#

Bases: IntEnum

Sleep policy for a MuJoCo kinematic tree.

ALLOWED = 4#

Allow the tree to sleep.

AUTO = 0#

Let the MuJoCo compiler choose whether the tree can sleep.

INIT = 5#

Initialize the tree asleep.

NEVER = 3#

Prevent the tree from sleeping.

class TrnType(*values)#

Bases: IntEnum

Transmission type values for MuJoCo actuators.

BODY = 4#
JOINT = 0#
JOINT_IN_PARENT = 1#
SITE = 3#
SLIDERCRANK = 5#
TENDON = 2#
UNDEFINED = -1#
classmethod import_mujoco()#

Import the MuJoCo Warp dependencies and cache them as class variables.

classmethod register_custom_attributes(builder)#

Declare custom attributes to be allocated on the Model object within the mujoco namespace. Legacy dof_passive_stiffness and dof_springref inputs are converted once into Model.joint_stiffness and Model.joint_rest_q during finalization. Runtime dof_passive_stiffness remains a deprecated alias to the core stiffness array. Runtime dof_springref is a deprecated alias to Model.joint_rest_q when their layouts and values coincide and raises an error otherwise; see Passive spring migration. Custom attributes use CustomAttribute.usd_attribute_name with the mjc: prefix (e.g. "mjc:condim") to leverage the MuJoCo USD schema where attributes are named "mjc:attr" rather than "newton:mujoco:attr".

__init__(model, *, separate_worlds=None, njmax=None, njmax_nnz=None, nconmax=None, iterations=None, ls_iterations=None, ccd_iterations=None, sdf_iterations=None, sdf_initpoints=None, solver=None, integrator=None, cone=None, jacobian=None, impratio=None, tolerance=None, ls_tolerance=None, ccd_tolerance=None, density=None, viscosity=None, wind=None, magnetic=None, use_mujoco_cpu=False, enable_multiccd=None, enable_sleeping=None, nvmax=None, sleep_tolerance=None, disable_contacts=None, disable_sensors=None, update_data_interval=None, save_to_mjcf=None, use_mujoco_contacts=True, use_speculative_contacts=False, include_sites=True, skip_visual_only_geoms=True, deterministic=None, strict_capacity=False, kinematic_switchable_roots=True)#

Solver options (e.g., impratio) follow this resolution priority:

  1. Constructor argument - If provided, same value is used for all worlds.

  2. Newton model custom attribute (model.mujoco.<option>) - Supports per-world values.

  3. MuJoCo default - Used if neither of the above is set.

For imported MJCF position drives using joint-target control and dampratio, construction writes resolved damping into zero entries of model.joint_target_kd and consumes the placeholders in model.mujoco.actuator_biasprm. These coefficients use the initial physical inertia, armature, and position gain; later inertia edits or solver reconstruction do not recompute them. Update joint_target_kd explicitly to change damping. Other consumers of the same model see the initialized values. Direct actuators keep their dampratio (a positive biasprm[2]), which is resolved from each world’s current physical inertia and position gain whenever model changes refresh MuJoCo’s constants. With use_mujoco_cpu=True, only the template world is simulated when separate_worlds=True.

Parameters:
  • model (Model) – The model to be simulated.

  • separate_worlds (bool | None) – If True, each Newton world is mapped to a separate MuJoCo world. Defaults to not use_mujoco_cpu.

  • njmax (int | None) – Maximum number of constraints per world. If None, a default value is estimated automatically. An explicit value is preserved unless it cannot hold the initial MuJoCo constraints; in that case, it is increased with a warning.

  • njmax_nnz (int | None) – Sparse constraint Jacobian nonzero capacity per world. If provided, must be non-negative and large enough for the initial sparse Jacobian. If None, derived from the model’s constraint counts and njmax, plus friction nonzeros for every DOF and tendon.

  • nconmax (int | None) – Number of contact points per world. If None, a default value is estimated automatically. An explicit value is preserved unless it cannot hold the initial MuJoCo contacts; in that case, it is increased with a warning. With use_mujoco_cpu=True, this limits contact export rather than simulation; excess runtime contacts are omitted from the export with a warning.

  • iterations (int | None) – Number of solver iterations. If None, uses model custom attribute or MuJoCo’s default (100).

  • ls_iterations (int | None) – Number of line search iterations for the solver. If None, uses model custom attribute or MuJoCo’s default (50).

  • ccd_iterations (int | None) – Maximum CCD iterations. If None, uses model custom attribute or MuJoCo’s default (35).

  • sdf_iterations (int | None) – Maximum SDF iterations. If None, uses model custom attribute or MuJoCo’s default (10).

  • sdf_initpoints (int | None) – Number of SDF initialization points. If None, uses model custom attribute or MuJoCo’s default (40).

  • solver (int | str | None) – Solver type. Can be “cg” or “newton”, or their corresponding MuJoCo integer constants. If None, uses model custom attribute or Newton’s default (“newton”).

  • integrator (int | str | None) – Integrator type. Can be “euler”, “rk4”, “implicit”, “implicitfast”, or “discrete”, or their corresponding MuJoCo integer constants. If None, uses model custom attribute or Newton’s default (“implicitfast”).

  • cone (int | str | None) – The type of contact friction cone. Can be “pyramidal”, “elliptic”, or their corresponding MuJoCo integer constants. If None, uses model custom attribute or Newton’s default (“pyramidal”).

  • jacobian (int | str | None) – Jacobian computation method. Can be “dense”, “sparse”, or “auto”, or their corresponding MuJoCo integer constants. If None, uses model custom attribute or MuJoCo’s default (“auto”).

  • impratio (float | None) – Frictional-to-normal constraint impedance ratio. If None, uses model custom attribute or MuJoCo’s default (1.0).

  • tolerance (float | None) – Solver tolerance for early termination. If None, uses model custom attribute or MuJoCo’s default (1e-8).

  • ls_tolerance (float | None) – Line search tolerance for early termination. If None, uses model custom attribute or MuJoCo’s default (0.01).

  • ccd_tolerance (float | None) – Continuous collision detection tolerance. If None, uses model custom attribute or MuJoCo’s default (1e-6).

  • density (float | None) – Medium density for lift and drag forces. If None, uses model custom attribute or MuJoCo’s default (0.0).

  • viscosity (float | None) – Medium viscosity for lift and drag forces. If None, uses model custom attribute or MuJoCo’s default (0.0).

  • wind (tuple | None) – Wind velocity vector (x, y, z) for lift and drag forces. If None, uses model custom attribute or MuJoCo’s default (0, 0, 0).

  • magnetic (tuple | None) – Global magnetic flux vector (x, y, z). If None, uses model custom attribute or MuJoCo’s default (0, -0.5, 0).

  • use_mujoco_cpu (bool) – If True, use MuJoCo’s C implementation instead of mujoco_warp.

  • enable_multiccd (bool | None) – If True, enable multi-CCD contact generation (up to 4 contact points per geom pair instead of 1). If False, disable it. If None, use the model custom attribute or disable it by default. Note: geom pairs where either geom has margin > 0 always produce a single contact regardless of this flag.

  • enable_sleeping (bool | None) – Whether to enable MuJoCo Warp’s sleeping optimization. If None, uses the model custom attribute or defaults to False. Sleeping requires the GPU backend, the Newton solver, MuJoCo contact handling, island detection, and a non-RK4 integrator.

  • nvmax (int | None) – Maximum number of active degrees of freedom per world when sleeping is enabled. Must accommodate every initially awake degree of freedom. If None, allocates space for every degree of freedom, which is safe but provides no compact-solver memory savings.

  • sleep_tolerance (float | None) – Sleep velocity tolerance. If None, uses model custom attribute or MuJoCo default (0.001).

  • disable_contacts (bool | None) – If True, disable contact computation in MuJoCo. If False, enable it. If None, use the model custom attribute or enable it by default.

  • disable_sensors (bool | None) – If True, disable sensor computation in MuJoCo. If False, enable it. If None, use the model custom attribute or enable it by default. body_qdd and body_parent_f are still computed on either backend when requested through solver observables or legacy output-state fields.

  • update_data_interval (int | None) –

    Frequency (in simulation steps) at which to update the MuJoCo Data object from the Newton state. If 0, Data is never updated after initialization. If None, Data is updated on every step.

    Deprecated since version 1.8: Passing any value is deprecated; Data will always be updated on every step.

  • save_to_mjcf (str | None) – Optional path to save the generated MJCF model file.

  • use_mujoco_contacts (bool) – If True, use MuJoCo collision detection. If False, use Newton-generated contacts supplied to step(). Must be True with use_mujoco_cpu=True.

  • use_speculative_contacts (bool) –

    Add frictionless normal constraints for separated Newton contact candidates, bounding closing velocity by clearance divided by the physics timestep. Requires use_mujoco_contacts=False, the MuJoCo Warp backend, and Euler or implicitfast integration. Enable velocity expansion in newton.CollisionPipeline and pass its contacts to step(). This mitigates tunneling; it is not continuous collision detection and does not make penetrating contacts rigid.

    Experimental

    The use_speculative_contacts=True mode may change without prior notice.

  • include_sites (bool) – If True (default), Newton shapes marked with ShapeFlags.SITE are exported as MuJoCo sites. Sites are non-colliding reference points used for sensor attachment, debugging, or as frames of reference. If False, sites are skipped during export. Defaults to True.

  • skip_visual_only_geoms (bool) – If True (default), geometries used only for visualization (i.e. not involved in collision) are excluded from the exported MuJoCo spec. This avoids mismatches with models that use explicit <contact> definitions for collision geometry.

  • deterministic (DeterministicMode | None) – Deterministic mode for MuJoCo Warp solver kernels. Pass a warp.DeterministicMode, or None to inherit wp.config.deterministic. Modes other than NOT_GUARANTEED currently fail to compile MuJoCo Warp’s kernels with Warp 1.19; the CPU backend (use_mujoco_cpu=True) is always deterministic. See Deterministic Simulation.

  • strict_capacity (bool) – If True, raise a RuntimeError when the Newton contact pipeline buffer capacity (contacts.rigid_contact_max) exceeds MuJoCo Warp’s buffer capacity (nconmax); the check runs at the start of every step and requires no GPU sync. This is a capacity mismatch, not evidence that contacts were actually dropped — the two buffers are sized by independent heuristics and routinely disagree even on scenes that never overflow — so it is not reported by default (False). Runtime overflow (contacts actually dropped during a step) is always reported GPU-side via a wp.printf message; to detect it in Python without a GPU sync, request ObservableKind.OVERFLOW via observables() and check the bitmask after each step.

  • kinematic_switchable_roots (bool) – If True, every movable root gets an inactive weld so it can be switched to kinematic at runtime. If False, only roots that are kinematic in some world at construction get one, which keeps the compiled MuJoCo model free of unused welds.

close_mujoco_viewer()#

Close the MuJoCo viewer if it exists.

coupling_eval_effective_mass(endpoint_kind, endpoint_index, endpoint_local_pos, out)#

Evaluate MuJoCo articulated effective masses for coupling endpoints.

coupling_eval_effective_mass_block(endpoint_kind, endpoint_index, endpoint_local_pos, out_mass, out_inertia=None)#

Evaluate MuJoCo articulated effective mass and inertia blocks.

coupling_eval_gravity_acceleration(out_body_acceleration, out_particle_acceleration)#

Evaluate MuJoCo’s internally applied gravity acceleration for coupling.

get_max_contact_count()#

Return the configured rigid contact export capacity.

With use_mujoco_cpu=True, this is the resolved nconmax. Excess runtime contacts are omitted from export with a warning.

notify_model_changed(flags)#
observables(kinds, *, contacts=None, requires_grad=None)#

Allocate solver observables with compatible contact storage.

Supply contacts when requesting contact-indexed fields; their capacities size the contact arrays.

See SolverBase.observables() for the shared allocation contract and errors, and Solver Observables for usage and native collision setup.

Raises:

ValueError – If MuJoCo’s contact export capacity exceeds the rigid contact capacity of contacts.

render_mujoco_viewer(show_left_ui=True, show_right_ui=True, show_contact_points=True, show_contact_forces=False, show_transparent_geoms=True)#

Create and synchronize the MuJoCo viewer. The viewer will be created if it is not already open.

Note

The MuJoCo viewer only supports rendering Newton models with a single world, unless use_mujoco_cpu is True or the solver was initialized with separate_worlds set to False.

The MuJoCo viewer is only meant as a debugging tool. It shows the geoms compiled at construction, so it rejects models with body variants.

Parameters:
  • show_left_ui (bool) – Whether to show the left UI.

  • show_right_ui (bool) – Whether to show the right UI.

  • show_contact_points (bool) – Whether to show contact points.

  • show_contact_forces (bool) – Whether to show contact forces.

  • show_transparent_geoms (bool) – Whether to show transparent geoms.

Raises:

NotImplementedError – If the model has body variants.

reset(state, world_mask=None, flags=None)#

Reset joint state to model defaults and clear MuJoCo’s internal buffers.

MuJoCo carries solver state (acceleration warm-start, actuator activations) and applied-force inputs across step() calls. After a divergence (e.g. NaNs), these buffers can poison the next step even once the joint state has been reset, because step() warm-starts from them. This method therefore always zeros, per world, qacc_warmstart, qfrc_applied, xfrc_applied, act and ctrl. (qacc is left alone: the solver overwrites it from qacc_warmstart at the start of every step.)

In addition, the requested entries of the Newton State are reset to the model defaults (model.joint_q / model.joint_qd) for the selected worlds, controlled by flags:

Because MuJoCo is a reduced-coordinate solver, state.body_q / state.body_qd are derived from the joint coordinates by forward kinematics on the next step(); the corresponding BODY_Q / BODY_QD (and particle) flags are not actionable here and are ignored.

qpos / qvel are normally synced from the reset state at the start of the next step(). When the deprecated update_data_interval is not 1, that per-step sync is disabled or sparse, so the reset joint coordinates are pushed into qpos / qvel immediately for the selected worlds. When sleeping is enabled, reset synchronizes immediately, rebuilds MuJoCo Warp’s cached position- and velocity-dependent data, and restores the initial sleep state in the selected worlds.

Parameters:
  • state (newton.State) – The simulation state to reset (modified in place).

  • world_mask (wp.array[wp.bool] | None) – Optional boolean mask of shape (world_count + 1,) selecting which worlds to reset. The final entry represents global world -1 and is a no-op because MuJoCo does not support global dynamic objects. If None, all worlds are reset.

  • flags (StateFlags | int | None) – Optional StateFlags bitmask controlling which joint-state quantities are reset. If None, all are reset. The internal MuJoCo buffers are always cleared regardless.

step(state_in, state_out, control, contacts, dt, *, observables=None)#

Advance the simulation by one timestep.

Follows a three-phase push-integrate-pull cycle:

  1. Push — transfer state_in and control to MuJoCo’s working data. When use_mujoco_contacts=False, contacts are also converted and fed to MuJoCo Warp before the integrator runs.

  2. Integrate — run MuJoCo (CPU) or MuJoCo Warp (GPU) forward by dt seconds.

  3. Pull — populate state_out from the integrated MuJoCo data. Request ObservableKind.CONTACT_F to export contact geometry and forces into the supplied contacts and observables.

Overflow detection — capacity overflows (contacts dropped, constraint buffer exceeded, broadphase clipped) are reported through Observables.overflow, a per-world int32 bitmask. Allocate it with observables() using ObservableKind.OVERFLOW and pass the container to this method, then read the bitmask after each step (or after warp.capture_launch() when using CUDA graphs). The request is only supported with MuJoCo Warp (use_mujoco_cpu=False):

observables = solver.observables({solver.ObservableKind.OVERFLOW})
solver.step(state_in, state_out, control, contacts, dt, observables=observables)
overflow = observables.overflow.numpy()
if overflow[0] & newton.solvers.SolverMuJoCo.OverflowBits.SOLVER_NCONMAX:
    # runtime contacts exceeded nconmax — increase nconmax
    ...

Bits 0-15 carry MuJoCo Warp’s own mujoco_warp.OverflowType flags (NEFC, NJMAX_NNZ, BROADPHASE, NVMAX, …). The bits Newton adds are SolverMuJoCo.OverflowBits.CONTACT_PIPELINE, set when the Newton collision pipeline dropped contacts beyond rigid_contact_max, and SolverMuJoCo.OverflowBits.SOLVER_NCONMAX, set when runtime contacts exceeded nconmax. The bitmask is reset at every step so it always reflects the current step only. Steps that are not passed the container leave it unchanged.

See MuJoCo overflow diagnostics for the bit layout, public flag names, and shared-buffer attribution.

Parameters:
  • state_in (newton.State) – Input state for this step.

  • state_out (newton.State) – Output state written by this step.

  • control (Control) – Joint targets and feedforward forces.

  • contacts (Contacts | None) – Contact storage. MuJoCo Warp consumes Newton collision input when use_mujoco_contacts=False. With MuJoCo collision detection, supply output storage when CONTACT_F is requested.

  • dt (float) – Timestep in seconds.

  • observables (Observables | None) – Optional solver observable arrays allocated by observables().

update_contacts(contacts, state=None)#

Update contact geometry and optional legacy force storage from MuJoCo.

Geometry-only export remains supported when contacts.force is None.

Deprecated since version 1.7: Exporting contacts.force is deprecated. Request CONTACT_F and pass the resulting container to step() instead. Geometry-only export is not deprecated.

SUPPORTED_OBSERVABLES: ClassVar[frozenset[str]] = frozenset({'body_parent_f', 'body_qdd', 'contact_f', 'overflow', 'qfrc_actuator', 'qfrc_bias', 'qfrc_constraint', 'qfrc_frictionloss'})#

Names of observables supported by this solver class.

Entries are string identifiers, such as ObservableKind.BODY_QDD. Query supported_observables for the capabilities of an instance.

body_free_qd_start: wp.array[wp.int32] | None#

Per-body mapping to the free-joint qd_start index (or -1 if not free).

connect_constraint_X_rel: wp.array2d[wp.transform] | None#

Relative body pose inv(X_body2) * X_body1 at the reference pose per MuJoCo CONNECT row, shape [world_count, neq].

enable_sleeping#

Whether MuJoCo Warp sleeping is enabled.

has_connect_constraints: bool#

Whether the model contains any CONNECT equality constraints.

has_jnt_connect_constraints: bool#

Whether the model contains CONNECT constraints synthesized from loop-closure joints (revolute or ball).

jnt_connect_hinge_side: wp.array2d[wp.int32] | None#

Side (-1 or +1) along the hinge axis of revolute loop-joint CONNECT rows, 0 otherwise, shape [world_count, neq].

mjc_actuator_ctrl_source: wp.array[wp.int32] | None#

Control source for each MuJoCo actuator.

Values: 0=JOINT_TARGET (uses joint_target_q/joint_target_qd), 1=CTRL_DIRECT (uses mujoco.ctrl) Shape [nu], dtype int32.

mjc_actuator_to_newton_ball_jnt: wp.array[wp.int32] | None#

Per-actuator template-world Newton joint index for BALL-joint actuators, -1 otherwise.

The control kernel uses this to read the current world’s child-anchor rotation from joint_X_c[world * joints_per_world + jnt % joints_per_world]. Shape [nu], dtype int32.

mjc_actuator_to_newton_idx: wp.array[wp.int32] | None#

Mapping from MuJoCo actuator to Newton index.

For JOINT_TARGET: sign-encoded DOF index (>=0: position, -1: unmapped, <=-2: velocity with -(idx+2)) For CTRL_DIRECT: MJCF-order index into control.mujoco.ctrl array

Shape [nu], dtype int32.

mjc_actuator_to_newton_target_q_idx: wp.array[wp.int32] | None#

Per-actuator coordinate lookup for target conversion.

For position actuators, entries index Control.joint_target_q using Model.joint_target_q_start. For BALL-joint velocity actuators, entries index the current quaternion in State.joint_q using Model.joint_q_start, so the target velocity can be rotated into MuJoCo’s current ball-joint frame. -1 means unused. Note that the BALL velocity case reuses this existing target-q lookup slot. Shape [nu], dtype int32.

mjc_actuator_to_target_q_axis_idx: wp.array[wp.int32] | None#

Angular-axis selector (0/1/2) for BALL-joint position and velocity actuators, -1 otherwise. Shape [nu].

mjc_body_to_newton: wp.array2d[wp.int32] | None#

Mapping from MuJoCo [world, body] to Newton body index. Shape [nworld, nbody], dtype int32.

mjc_dof_to_newton_dof: wp.array2d[wp.int32] | None#

Mapping from MuJoCo [world, dof] to Newton DOF index. Shape [nworld, nv], dtype int32.

mjc_eq_to_newton_eq: wp.array2d[wp.int32] | None#

Mapping from MuJoCo [world, eq] to Newton equality constraint index.

Corresponds to the equality constraints that are created in MuJoCo from Newton’s equality constraints. A value of -1 indicates the entry is unmapped – the MuJoCo constraint was synthesized from a loop-closure joint (CONNECT or WELD) rather than from an explicit Newton equality constraint. For CONNECT-only entries see mjc_eq_to_newton_jnt.

Shape [nworld, neq], dtype int32.

mjc_eq_to_newton_jnt: wp.array2d[wp.int32] | None#

Mapping from MuJoCo [world, eq] to Newton joint index for CONNECT constraints only.

Corresponds to the CONNECT equality constraints synthesized from loop-closure joints (revolute or ball) that have no associated articulation (joint_articulation == -1). WELD constraints (from FIXED loop joints) are excluded — their eq_data is managed entirely by MuJoCo and must not be overwritten by the CONNECT anchor kernels. A value of -1 indicates an unmapped entry (either an explicit Newton equality constraint or a WELD).

Shape [nworld, neq], dtype int32.

mjc_eq_to_newton_joint_mimic: wp.array2d[wp.int32] | None#

Mapping from MuJoCo [world, eq] to Newton mimic follower joint index.

Corresponds to equality constraints created from joint-owned mimic metadata. A value of -1 indicates an unmapped equality constraint.

Shape [nworld, neq], dtype int32.

mjc_eq_to_newton_mimic: wp.array2d[wp.int32] | None#

Mapping from MuJoCo [world, eq] to Newton mimic constraint index.

Corresponds to the equality constraints that are created in MuJoCo from Newton’s mimic constraints. A value of -1 indicates that the MuJoCo equality constraint is not associated with a Newton mimic constraint.

Shape [nworld, neq], dtype int32.

mjc_geom_to_newton_shape: wp.array2d[wp.int32] | None#

Mapping from MuJoCo [world, geom] to Newton shape index. Shape [nworld, ngeom], dtype int32.

mjc_jnt_to_newton_dof: wp.array2d[wp.int32] | None#

Mapping from MuJoCo [world, joint] to Newton DOF index. Shape [nworld, njnt], dtype int32.

mjc_jnt_to_newton_jnt: wp.array2d[wp.int32] | None#

Mapping from MuJoCo [world, joint] to Newton joint index. Shape [nworld, njnt], dtype int32.

mjc_mocap_to_newton_jnt: wp.array2d[wp.int32] | None#

Mapping from MuJoCo [world, mocap] to Newton joint index. Shape [nworld, nmocap], dtype int32.

mjc_tendon_to_newton_tendon: wp.array2d[wp.int32] | None#

Mapping from MuJoCo [world, tendon] to Newton tendon index.

Shape [nworld, ntendon], dtype int32.

newton_dof_to_body: wp.array[wp.int32] | None#

Mapping from Newton DOF index to child body index. Shape [joint_dof_count], dtype int32.

newton_shape_to_mjc_geom: wp.array[wp.int32] | None#

Inverse mapping from Newton shape index to MuJoCo geom index. Only created when use_mujoco_contacts=False. Shape [nshape], dtype int32.

nvmax#

Maximum number of active degrees of freedom allocated per world.

property supported_observables#

Return observables available for the configured MuJoCo backend.

See Solver Observables for backend limitations.

property update_data_interval: int#

Steps between MuJoCo data synchronizations from the input state.

Deprecated since version 1.8: Reading or assigning this attribute warns; data will always be synchronized on every step.