typing
¶
MeshName
module-attribute
¶
Alias of string. Used to type hint a field is the name of a Mesh.
-
Code Reference
mujoco_mojotypingName
HFieldName
module-attribute
¶
Alias of string. Used to type hint a field is the name of an HField.
-
Code Reference
mujoco_mojotypingName
MaterialName
module-attribute
¶
Alias of string. Used to type hint a field is the name of a Material.
-
Code Reference
mujoco_mojotypingName
TextureName
module-attribute
¶
Alias of string. Used to type hint a field is the name of a Texture.
-
Code Reference
mujoco_mojotypingName
ModelName
module-attribute
¶
Alias of string. Used to type hint a field is the name of a Model.
-
Code Reference
mujoco_mojotypingName
BodyName
module-attribute
¶
Alias of string. Used to type hint a field is the name of a Body.
-
Code Reference
mujoco_mojotyping
JointName
module-attribute
¶
Alias of string. Used to type hint a field is the name of a Joint.
-
Code Reference
mujoco_mojo
GeomName
module-attribute
¶
Alias of string. Used to type hint a field is the name of a Geom.
-
Code Reference
mujoco_mojo
SiteName
module-attribute
¶
Alias of string. Used to type hint a field is the name of a Site.
-
Code Reference
mujoco_mojo
CameraName
module-attribute
¶
Alias of string. Used to type hint a field is the name of a Camera.
-
Code Reference
mujoco_mojoruntime
LightName
module-attribute
¶
Alias of string. Used to type hint a field is the name of a Light.
-
Code Reference
mujoco_mojo
FrameName
module-attribute
¶
Alias of string. Used to type hint a field is the name of a Frame.
-
Code Reference
mujoco_mojotypingName
ContactPairName
module-attribute
¶
Alias of string. Used to type hint a field is the name of a contact Pair.
-
Code Reference
mujoco_mojotypingName
ContactExcludeName
module-attribute
¶
Alias of string. Used to type hint a field is the name of a contact Exclude.
-
Code Reference
mujoco_mojotypingName
DeformableSkinName
module-attribute
¶
Alias of string. Used to type hint a field is the name of a DeformableSkin.
-
Code Reference
mujoco_mojotypingName
FlexName
module-attribute
¶
Alias of string. Used to type hint a field is the name of a DeformableFlex.
-
Code Reference
mujoco_mojo
EqualityName
module-attribute
¶
Alias of string. Used to type hint a field is the name of an Eqaulity.
-
Code Reference
mujoco_mojo
TendonName
module-attribute
¶
Alias of string. Used to type hint a field is the name of a Tendon.
-
Code Reference
mujoco_mojo
ActuatorName
module-attribute
¶
Alias of string. Used to type hint a field is the name of an Actuator.
-
Code Reference
mujoco_mojo
PluginName
module-attribute
¶
Alias of string. Used to type hint a field is the name of a Plugin.
-
Code Reference
mujoco_mojotypingName
InstanceName
module-attribute
¶
Alias of string. Used to type hint a field is the name of a plugin Instance.
-
Code Reference
mujoco_mojo
SensorName
module-attribute
¶
Alias of string. Used to type hint a field is the name of a Sensor.
-
Code Reference
mujoco_mojo
KeyName
module-attribute
¶
Alias of string. Used to type hint a field is the name of a Key.
-
Code Reference
mujoco_mojotypingName
SensorAttachableName
module-attribute
¶
SensorAttachableName = (
BodyName | GeomName | SiteName | CameraName
)
Alias of names which can have a sensor attached to them.
Name
module-attribute
¶
Name = (
MeshName
| HFieldName
| MaterialName
| TextureName
| ModelName
| BodyName
| JointName
| GeomName
| SiteName
| CameraName
| LightName
| FrameName
| ContactPairName
| ContactExcludeName
| DeformableSkinName
| FlexName
| EqualityName
| TendonName
| ActuatorName
| PluginName
| InstanceName
| SensorName
| KeyName
)
Alias of any name.
ActuatorGroup
module-attribute
¶
An integer representing an actuator group index. Must be between 0 and 30 inclusive.
GeomGroup
module-attribute
¶
An integer representing a geom group index. Must be between 0 and 30 inclusive.
-
Code Reference
mujoco_mojotypingInertiaGroupRange
InertiaGroupRange
module-attribute
¶
A tuple specifying the inclusive range of geom groups used for inertia computation.
GridLayoutStr
module-attribute
¶
GridLayoutStr = Annotated[
str,
Field(
pattern="^[\\.RLUDFB]+$",
description="String which may only use `'.'`, `'R'`, `'L'`, `'U'`, `'D'`, `'F'`, and `'B'`",
),
]
A string used for texture grid layout. May only include '.', 'R', 'L', 'U', 'D', 'F', and 'B'.
Mat3
¶
A 3x3 numeric matrix, often used for rotation matrices or inertia tensors.
EulerSeq
¶
Bases: StrEnum
Euler rotation sequences.
- Lowercase letters denote intrinsic rotations (about the rotating frame).
- Uppercase letters denote extrinsic rotations (about the fixed parent frame).
LayerRole
¶
Bases: StrEnum
Role of the texture. The valid values, expected number of channels, and the role semantics are:
RGB
class-attribute
instance-attribute
¶
3 channels. base color / albedo [red, green, blue].
NORMAL
class-attribute
instance-attribute
¶
3 channels. bump map (surface normals).
OCCLUSION
class-attribute
instance-attribute
¶
1 channel. ambient occlusion.
OPACITY
class-attribute
instance-attribute
¶
1 channel. opacity (alpha channel).
EMISSIVE
class-attribute
instance-attribute
¶
4 channels. RGB light emmision intensity, exposure weight in 4th channel.
ORM
class-attribute
instance-attribute
¶
3 channels. packed 3 channel [occlusion, roughness, metallic].
RGBA
class-attribute
instance-attribute
¶
4 channels. packed 4 channel [red, green, blue, alpha].
UserInterface
¶
Bases: StrEnum
Which viewer backend mujoco-mojo reloaded renders with.
-
Code Reference
mujoco_mojoutilslayersreloadedMojoReloaded
OPENGL
class-attribute
instance-attribute
¶
Native OpenGL window. Requires X11 forwarding over SSH, but is ideal for local development.
MJVISER
class-attribute
instance-attribute
¶
Browser-based viewer built on mjviser. Requires the mujoco-mojo[reloaded] extra.
VISER
class-attribute
instance-attribute
¶
Browser-based viewer built directly on viser. Requires the mujoco-mojo[reloaded] extra.
Direction
¶
Bases: StrEnum
Optimization goal for mujoco-mojo run optimization.
-
Code Reference
mujoco_mojoutils
Sampler
¶
Bases: StrEnum
Optuna search algorithm for mujoco-mojo run optimization.
-
Code Reference
mujoco_mojoutils
TPE
class-attribute
instance-attribute
¶
Tree-structured Parzen Estimator. Optuna's default, and generally the best choice for noisy physics simulations.
CMAES
class-attribute
instance-attribute
¶
Covariance Matrix Adaptation Evolution Strategy - a robust evolutionary algorithm for continuous parameters.
RANDOM
class-attribute
instance-attribute
¶
Uniform random sampling. A useful baseline for comparison.
NSGAII
class-attribute
instance-attribute
¶
Genetic algorithm suited to multi-objective optimization.
NSGAIII
class-attribute
instance-attribute
¶
Built for 3+ objectives, but also works as a robust single-objective genetic algorithm.
QMC
class-attribute
instance-attribute
¶
Quasi-Monte Carlo sampling. Low-discrepancy sequences for even coverage of the design space.
GP
class-attribute
instance-attribute
¶
Gaussian Process. Best for very expensive simulations where only a few dozen trials are affordable.
BRUTE
class-attribute
instance-attribute
¶
Exhaustive grid search over the entire space. Does not support a random seed.
SortMode
¶
SortDirection
¶
GeomType
¶
Bases: StrEnum
Enumeration of supported geometric types in MuJoCo.
PLANE
class-attribute
instance-attribute
¶
Plane which is infinite for collision detection purposes.
CAPSULE
class-attribute
instance-attribute
¶
A capsule, which is a cylinder capped with two half-spheres.
SDF
class-attribute
instance-attribute
¶
Signed distance field (SDF, also referred to as signed distance function).
Integrator
¶
Bases: StrEnum
Enumeration of simulation integrators.
EULER
class-attribute
instance-attribute
¶
Semi-implicit with implicit joint damping (Euler).
For this method, D only includes derivatives of joint damping. Note that in this case D is diagonal and Mhat is symmetric, so LT L decomposition (a variant of Cholesky) can be used. This factorization is stored mjData.qLD. If the model has no joint damping or the eulerdamp disable-flag is set, implicit damping is disabled and the semi-implicit update (3) is used, rather than (6), avoiding the additional factorization of Mhat (additional because M is already factorized for the acceleration update (5)).
RK4
class-attribute
instance-attribute
¶
4th-order Runge-Kutta (RK4).
One advantage of our continuous-time formulation is that we can use higher order integrators such as Runge-Kutta or multistep methods. The only such integrator currently implemented is the fixed-step 4th-order Runge-Kutta method, though users can easily implement other integrators by calling mj_forward and integrating accelerations themselves. We have observed that for energy-conserving systems (example), RK4 is qualitatively better than the single-step methods, both in terms of stability and accuracy, even when the timestep is decreased by a factor of 4 (so the computational effort is identical). In the presence of large velocity- dependent forces, if the chosen single-step method integrates those forces implicitly, single-step methods can be significantly more stable than RK4.
IMPLICIT
class-attribute
instance-attribute
¶
Implicit-in-velocity (implicit).
For this method, D includes derivatives of all forces except the constraint forces JTf(v). These are currently ignored since even though computing them is possible, it is complicated, and numerical tests show that including them does not confer much benefit. That said, analytical derivatives of constraint forces are planned for a future version. Additionally, we restrict D to have the same sparsity pattern as M, for computational efficiency. This restriction will exclude damping in tendons which connect bodies that are on different branches of the kinematic tree. Since D is not symmetric, we cannot use Cholesky factorization, but because D and M have the same sparsity pattern corresponding to the topology of the kinematic tree, reverse-order LU factorization of Mhat is guaranteed to have no fill-in. This factorization is stored mjData.qLU.
IMPLICITFAST
class-attribute
instance-attribute
¶
Fast implicit-in-velocity (implicitfast).
For this method, D includes derivatives of all forces used in the implicit method, with the exception of the centripetal and Coriolis forces c(v) computed by the RNE algorithm. Additionally, it is symmetrized D←(D+DT)/2. One reason for dropping the RNE derivatives is that they are the most expensive to compute. Second, these forces change rapidly only at high rotational velocities of complex pendula and spinning bodies, scenarios which are not common and already well-handled by the Runge-Kutta integrator (see below). Because the RNE derivatives are also the main source of asymmetry of D, by dropping them and symmetrizing, we can use the faster LTL rather than LU decomposition.
DISCRETE
class-attribute
instance-attribute
¶
The integrators above preserve MuJoCo's continuous-time contract: forward dynamics compute the instantaneous acceleration, and integration is a separate stage which advances the state. This integrator gives up that separation, in the tradition of the velocity-stepping schemes: the constraint solve and the implicit update are one operation whose solution is the step itself, so integration is trivial and the additional factorization of Mhat performed by the integrators above (stored in mjData.qH or mjData.qLU) is not needed. The solver minimizes the same convex Gauss-principle objective, but in the effective metric Mhat = M + hD + h^2K * M, where D and K denote positive damping and stiffness matrices: the negated derivatives of the smooth forces, restricted to terms which keep Mhat positive definite. Constraint forces are therefore computed against the same effective inertia which performs the velocity update.
The constraint rows are treated implicitly in the same way: each row's solref spring-damper is evaluated at the end of the step and folded into the row's impedance and reference. Constraint rows are then stable for any solref at any timestep. A contact or limit row whose spring is stiffer than the timestep can resolve (timeconst * dampratio < h) would however rebound on impact, so under this integrator the refsafe flag replaces such rows by the resolved row: the stiffest zero-restitution spring for the timestep at the authored damping ratio. Rows with timeconst * dampratio >= h and equality rows are left as authored; with refsafe disabled, every row is honored and timeconst -> 0 approaches the rigid-constraint limit (the violation is removed in one step) rather than an instability. The row's effective impedance is capped at the maximum impedance mjMAXIMP, which keeps the constraint weights well-conditioned. The cost is extra damping of the constraint response, growing with h/timeconsth/timeconst; the specified damping ratio is recovered as h -> 0.
The h^2 * K term makes discrete the only integrator which is implicit in position: joint, tendon and flex stiffness and actuator position feedback are stable at timesteps far beyond the explicit stability limit h ~< 2 / omega_max, where omega_max is the highest natural frequency in the model. The terms entering D and K are: joint damping and stiffness, tendon damping and stiffness, actuator gains (clamped to the stabilizing sign), flex elasticity and damping, and the dissipative drag component of fluid forces. Terms which fit inside the sparsity pattern of M (the joint diagonals, the fluid drag blocks) join its tree-structured factorization with no fill-in and add no cost to the solve; the couplings introduced by tendon, actuator and flex terms are applied matrix-free inside the iterative solvers. This split determines solver support: CG is matrix-free and requires only products with Mhat, and Newton merges the metric directly into its Hessian, while the dual PGS and noslip solvers require an explicit factorization.
Under PGS, tendon and actuator terms are therefore excluded from the metric and their forces integrate explicitly, like the sparsity-pattern restriction of implicit above. Noslip post-processing under a primal solver splits the metric: the main solve runs in the full Mhat, while the post-pass consumes the factored part alone as an approximation. Flex terms, which are too stiff to integrate explicitly, raise an error. The Coriolis and centripetal derivatives are excluded — they cannot enter a positive-definite metric — so gyroscopically-dominated mechanisms are better served by implicit; standalone free bodies receive the same local gyroscopic treatment as implicitfast.
Under this integrator forward dynamics computes the discrete step map: mjData.qacc holds the velocity difference (v+ - v) / h rather than the continuous-time acceleration, so the same state yields a different qacc under a different timestep; as h -> 0 it converges to the continuous acceleration. Acceleration-stage sensors (accelerometer, force/torque) report this finite-difference acceleration, which is what a physical sensor averaging over one timestep measures. Inverse dynamics inverts the same relation, so the fwdinv consistency check remains meaningful and invdiscrete is implied. Because qacc is the step, derivatives of forward dynamics are derivatives of the discrete transition, with no discretization gap for gradient-based methods.
Jacobian
¶
Solver
¶
Bases: StrEnum
Solver algorithms for constraint resolution.
PGS
class-attribute
instance-attribute
¶
Projected Gauss-Seidel method.
This is the most common algorithm used in physics simulators, and used to be the default in MuJoCo, until we developed the Newton method which appears to be better in every way. PGS uses the dual formulation. Unlike gradient-based methods which improve the solution along oblique directions, Gauss-Seidel works on one scalar component at a time, and sets it to its optimal value given the current values of all other components. One sweep of PGS has the computational complexity of one matrix-vector multiplication (although the constants are larger). It has first-order convergence but nevertheless makes rapid progress in a few iterations.
CG
class-attribute
instance-attribute
¶
Conjugate gradient method.
This algorithm uses the non-linear conjugate gradient method with the Polak-Ribiere-Plus formula. Line-search is exact, using Newton's method in one dimension, with analytical second derivatives.
NEWTON
class-attribute
instance-attribute
¶
Newton's method.
This algorithm implements the exact Newton method, with analytical second-order derivatives and Cholesky factorization of the Hessian. The line-search is the same as in the CG method. It is the default solver.
EnableDisable
¶
Coordinate
¶
Bases: StrEnum
In previous versions, this attribute could be used to specify whether frame positions and orientations are expressed in local or global coordinates, but the "global" option has since been removed, and will cause an error to be generated. In order to convert older models which used the "global" option, load and save them in MuJoCo 2.3.3 or older.
Angle
¶
Bases: StrEnum
This attribute specifies whether the angles in the MJCF model are expressed in units of degrees or radians. The compiler converts degrees into radians, and mjModel always uses radians. For URDF models the parser sets this attribute to "radian" internally, regardless of the XML setting.
InertiaFromGeom
¶
Bases: StrEnum
This attribute controls the automatic inference of body masses and inertias from geoms attached to the body.
FALSE
class-attribute
instance-attribute
¶
No automatic inference is performed. In that case each body must have explicitly defined mass and inertia with the inertial element, or else a compile error will be generated.
TRUE
class-attribute
instance-attribute
¶
The mass and inertia of each body will be inferred from the geoms attached to it, overriding any values specified with the inertial element.
AUTO
class-attribute
instance-attribute
¶
Masses and inertias are inferred automatically only when the inertial element is missing in the body definition.
LengthRangeMode
¶
Bases: StrEnum
Determines the type of actuators to which length range computation is applied.
DynType
¶
Bases: StrEnum
Activation dynamics type of actuators.
FILTER
class-attribute
instance-attribute
¶
act_dot = (ctrl - act) / dynprm[0]
FILTEREXACT
class-attribute
instance-attribute
¶
Like filter but with exact integration
DCMOTOR
class-attribute
instance-attribute
¶
DC motor electrical dynamics, see dcmotor
MUSCLE
class-attribute
instance-attribute
¶
act_dot = mju_muscleDynamics(...)
GainType
¶
Bases: StrEnum
Gain type of actuators.
AFFINE
class-attribute
instance-attribute
¶
gain_term = gain_prm[0] + gain_prm[1] * length + gain_prm[2] * velocity
DCMOTOR
class-attribute
instance-attribute
¶
DC motor gain (K or K/R), see dcmotor.
PID
class-attribute
instance-attribute
¶
gain_term = gainprm[0] (ki), applied to act (the integrated position error), for the pid actuator.
SO3
class-attribute
instance-attribute
¶
gain_term = gainprm[0] (kp), applied to the geodesic orientation error log(q^-1 q_target), for SO(3) transmissions.
BiasType
¶
Bases: StrEnum
Bias type of actuators.
AFFINE
class-attribute
instance-attribute
¶
bias_term = biasprm[0] + biasprm[1]length + biasprm[2]velocity
DCMOTOR
class-attribute
instance-attribute
¶
DC motor bias: back-EMF, cogging, LuGre friction, see dcmotor.
SO3
class-attribute
instance-attribute
¶
bias_term = biasprm[1]log(q^-1 q_target) + biasprm[2]omega, the geodesic analog of the affine bias for SO(3) transmissions.
Inertia
¶
Bases: StrEnum
This attribute controls how the mesh is used when mass and inertia are inferred from geometry. The current default value legacy will be changed to convex in a future release.
CONVEX
class-attribute
instance-attribute
¶
Use the mesh's convex hull to compute volume and inertia, assuming uniform density.
EXACT
class-attribute
instance-attribute
¶
Compute volume and inertia exactly, even for non-convex meshes. This algorithm requires a well-oriented, watertight mesh and will error otherwise.
LEGACY
class-attribute
instance-attribute
¶
Use the legacy algorithm, leads to volume overcounting for non-convex meshes. Though currently the default to avoid breakages, it is not recommended.
SHELL
class-attribute
instance-attribute
¶
Assume mass is concentrated on the surface of the mesh. Use the mesh's surface to compute the inertia, assuming uniform surface density.
TextureType
¶
Bases: StrEnum
This attribute determines how the texture is represented and mapped to objects. It also determines which of the remaining attributes are relevant.
D2
class-attribute
instance-attribute
¶
Maps a 2D image to a 3D object using texture coordinates (a.k.a UV coordinates). However, UV coordinates are only available for meshes.
CUBE
class-attribute
instance-attribute
¶
Has the effect of shrink-wrapping a texture cube over an object. Apart from the adjustment provided by the texuniform attribute of material, the process is automatic.
SKYBOX
class-attribute
instance-attribute
¶
Very similar to cube mapping, and in fact the texture data is specified in exactly the same way. The only difference is that the visualizer uses the first such texture defined in the model to render a skybox.
ColorSpace
¶
Bases: StrEnum
This attribute determines the color space of the texture. The default value auto means that the color space will be determined from the image file itself. If no color space is defined in the file, then linear is assumed.
AUTO
class-attribute
instance-attribute
¶
Color space will be determined from the image file itself. If no color space is defined in the file, then linear is assumed.
TextureBuiltInType
¶
Bases: StrEnum
This and the remaining attributes control the generation of procedural textures. If the value of this attribute is different from "none", the texture is treated as procedural and any file names are ignored.
GRADIENT
class-attribute
instance-attribute
¶
Generates a color gradient from rgb1 to rgb2. The interpolation in color space is done through a sigmoid function. For cube and skybox textures the gradient is along the +Y axis, i.e., from top to bottom for skybox rendering.
CHECKER
class-attribute
instance-attribute
¶
Generates a 2-by-2 checker pattern with alternating colors given by rgb1 and rgb2. This is suitable for rendering ground planes and also for marking objects with rotational symmetries. Note that 2d textures can be scaled so as to repeat the pattern as many times as necessary. For cube and skybox textures, the checker pattern is painted on each side of the cube.
FLAT
class-attribute
instance-attribute
¶
Fills the entire texture with rgb1, except for the bottom face of cube and skybox textures which is filled with rgb2.
Mark
¶
Bases: StrEnum
Procedural textures can be marked with the markrgb color, on top of the colors determined by the builtin type. All markings are one-pixel wide, thus the markings appear larger and more diffuse on smaller textures.
Sleep
¶
Bases: StrEnum
Sleep policy for the tree under this body. This attribute is only supported by moving bodies which are the root of a kinematic tree.
AUTO
class-attribute
instance-attribute
¶
Compiler will set the sleep policy as follows:
- A tree which is affected by actuators is not allowed to sleep (overridable).
- Trees which are connected by tendons which have non-zero stiffness and damping are not allowed to sleep (overridable).
- Trees which are connected by tendons which connect more than two trees are not allowed to sleep (not overridable).
- flexes are not allowed to sleep (not overridable).
- All other trees are allowed to sleep (overridable).
NEVER
class-attribute
instance-attribute
¶
Constitute user overrides of the automatic compiler policy.
ALLOWED
class-attribute
instance-attribute
¶
Constitute user overrides of the automatic compiler policy.
INIT
class-attribute
instance-attribute
¶
Can only be specified by the user and means "initialize this tree as asleep". This policy is implemented in mj_resetData and mj_makeData and only applies to the default configuration. If a keyframe changes the configuration of (or assigns nonzero velocity to) a sleeping tree, it will be woken up. This policy is useful for very large models where waiting for the automatic sleeping mechanism to kick in can be expensive. Trees initialized as sleeping can be placed in unstable configurations like deep penetration or in mid-air, but will only move when woken up. Also note that this policy can fail. For example if a tree marked as sleep="init" is in contact with a tree not marked as such (i.e., they are in the same island) then it is impossible to put the tree to sleep; such models will lead to a compilation error.
Simple
¶
Bases: StrEnum
Controls the simple body optimization. When a body qualifies as "simple", its inertial matrix block in the mass matrix is diagonal, representing independent translational and rotational degrees of freedom. The optimization omits storing of the zero-valued off-diagonal entries, reducing memory footprint and computation.
JointType
¶
Bases: StrEnum
Types of joints supported in MuJoCo.
FREE
class-attribute
instance-attribute
¶
Free "joint" with three translational degrees of freedom followed by three rotational degrees of freedom. In other words it makes the body floating. The rotation is represented as a unit quaternion. This joint type is only allowed in bodies that are children of the world body. No other joints can be defined in the body if a free joint is defined. Unlike the remaining joint types, free joints do not have a position within the body frame. Instead the joint position is assumed to coincide with the center of the body frame. Thus at runtime the position and orientation data of the free joint correspond to the global position and orientation of the body frame. Free joints cannot have limits.
BALL
class-attribute
instance-attribute
¶
A ball joint with three rotational degrees of freedom. The rotation is represented as a unit quaternion. The quaternion (1,0,0,0) corresponds to the initial configuration in which the model is defined. Any other quaternion is interpreted as a 3D rotation relative to this initial configuration. The rotation is around the point defined by the pos attribute. If a body has a ball joint, it cannot have other rotational joints (ball or hinge). Combining ball joints with slide joints in the same body is allowed.
SLIDE
class-attribute
instance-attribute
¶
A sliding or prismatic joint with one translational degree of freedom. Such joints are defined by a position and a sliding direction. For simulation purposes only the direction is needed; the joint position is used for rendering purposes.
HINGE
class-attribute
instance-attribute
¶
A hinge joint with one rotational degree of freedom. The rotation takes place around a specified axis through a specified position. This is the most common type of joint and is therefore the default. Most models contain only hinge and free joints.
JointLimited
¶
TendonLimited
¶
ActuatorControlLimited
¶
Bases: StrEnum
Specifies if the actuator control input has limits.
FALSE
class-attribute
instance-attribute
¶
Control input clamping is disabled.
TRUE
class-attribute
instance-attribute
¶
Control input to this actuator is automatically clamped to ctrlrange at runtime.
AUTO
class-attribute
instance-attribute
¶
If autolimits is set in compiler, control clamping will automatically be set to true if ctrlrange is defined without explicitly setting this attribute to "true".
ActuatorForceLimited
¶
Bases: StrEnum
This attribute specifies whether actuator forces acting on the joint should be clamped. See Force limits for details. It is available only for scalar joints (hinge and slider) and ignored for ball and free joints.
ActuatorLimited
¶
Bases: StrEnum
Specifies if the internal state (activation) associated with an actuator is clamped to actrange at runtime.
AUTO
class-attribute
instance-attribute
¶
If autolimits is set in compiler, activation clamping will automatically be set to true if actrange is defined without explicitly setting this attribute to "true".
Align
¶
Bases: StrEnum
Specifies alignment options for aligning body frame and free joint.
FALSE
class-attribute
instance-attribute
¶
No alignment will occur between the body frame and free joint.
TRUE
class-attribute
instance-attribute
¶
Body frame and free joint will automatically be aligned with inertial frame.
AUTO
class-attribute
instance-attribute
¶
Compiler's alignfree global attribute will be respected.
FluidShape
¶
Bases: StrEnum
Geometry-level fluid interaction model.
ELLIPSOID
class-attribute
instance-attribute
¶
Activates the geom-level fluid interaction model based on an ellipsoidal approximation of the geom shape. When active, the model based on body inertia sizes is disabled for the body in which the geom is defined. See section on ellipsoid-based fluid interaction model for details.
TrackingMode
¶
Bases: StrEnum
Specifies how the camera/light position and orientation in world coordinates are computed in forward kinematics (which in turn determine what the camera/light sees).
FIXED
class-attribute
instance-attribute
¶
The position and orientation specified are fixed relative to the body where the camera/light is defined.
TRACK
class-attribute
instance-attribute
¶
The camera/light position is at a constant offset from the body in world coordinates, while the camera/light orientation is constant in world coordinates. These constants are determined by applying forward kinematics in qpos0 and treating the camera/light as fixed. Tracking can be used for example to position a camera/light above a body, point it down so it sees the body, and have it always remain above the body no matter how the body translates and rotates.
TRACKCOM
class-attribute
instance-attribute
¶
similar to "track" but the constant spatial offset is defined relative to the center of mass of the kinematic subtree starting at the body in which the camera/light is defined. This can be used to keep an entire mechanism in view. Note that the subtree center of mass for the world body is the center of mass of the entire model. So if a camera/light is defined in the world body in mode "trackcom", it will track the entire model.
TARGETBODY
class-attribute
instance-attribute
¶
The camera/light position is fixed in the body frame, while the camera/light orientation is adjusted so that it always points towards the targeted body (which is specified with the target attribute below). This can be used for example to model an eye that fixates a moving object; the object will be the target, and the camera/light/eye will be defined in the body corresponding to the head.
TARGETBODYCOM
class-attribute
instance-attribute
¶
The same as "targetbody" but the camera/light is oriented towards the center of mass of the subtree starting at the target body.
LightType
¶
Bases: StrEnum
Determines the type of light. Note that some light types may not be supported by some renderers (e.g. only spot and directional lights are supported by the default native renderer).
FlexCompDOF
¶
Bases: StrEnum
The parametrization of the flex's degrees of freedom (dofs).
FULL
class-attribute
instance-attribute
¶
Three translational dofs per vertex. This is the most expressive but also the most expensive option.
RADIAL
class-attribute
instance-attribute
¶
A single radial translational dof per vertex. Note that unlike in the "full" case, the radial parametrization requires a free joint at the flex's parent in order for free body motion to be possible. This type of parametrization is appropriate for shapes that are relatively spherical.
D2
class-attribute
instance-attribute
¶
Two orthogonal translational dofs (X and Y) per vertex. This restricts the motion of the vertices to planes parallel to the parent body's X-Y plane.
TRILINEAR
class-attribute
instance-attribute
¶
Three translational dofs at each corner of the bounding box of the flex, for a total of 24 dofs for the entire flex, independent of the number of vertices. The positions of the vertices are updated using trilinear interpolation over the bounding box.
QUADRATIC
class-attribute
instance-attribute
¶
Three translational dofs per corner, edge, face, and volume of the bounding box of the flex, for a total of 81 dofs for the entire flex, independent of the number of vertices. The positions of the vertices are updated using quadratic interpolation over the bounding box. While this option requires more degrees of freedom than trilinear flexes, it enables curved deformation modes, while the only modes achievable for trilinear flexes are strech/compression and shear. To understand the difference between the two parametrizations, see a trilinear cube and a quadratic cube.
FlexCompType
¶
Bases: StrEnum
The type of flexcomp object.
GRID
class-attribute
instance-attribute
¶
grid generates a rectangular grid of points in 1D, 2D or 3D as specified by dim. The number of points in each dimension is determined by count while the grid spacing in each dimension is determined by spacing. Make sure the spacing is sufficiently large relative to radius to avoid permanent contacts. In 2D and 3D the grid is automatically triangulated, and corresponding flex elements are created (triangles or tetrahedra). In 1D the elements are capsules connecting consecutive pairs of points.
BOX
class-attribute
instance-attribute
¶
box generates a 3D box object, however flex bodies are only generated on the outer shell. Each flex body has a radial slider joint allowing it to move in and out from the center of the box. The parent body would normally be a floating body. The box surface is triangulated, and each flex element is a tetrahedron connecting the center of the box with one triangle face. count and spacing determine the count and spacing of the flex bodies, similar to the grid type in 3D. Note that the resulting flex has the same topology as the box generated by composite.
CYLINDER
class-attribute
instance-attribute
¶
cylinder is the same as box, except the points are projected on the surface of a cylinder.
ELLIPSOID
class-attribute
instance-attribute
¶
ellipsoid is the same as box, except the points are projected on the surface of an ellipsoid.
DISC
class-attribute
instance-attribute
¶
disc is the same as box, except the points are projected on the surface of a disc. It is only compatible with dim=2.
CIRCLE
class-attribute
instance-attribute
¶
circle is the same as grid, except the points are sampled along a circle so that the first and last points are the same. The radius of the circle is computed such that each segment has the requested spacing. It is only compatible with dim=1.
MESH
class-attribute
instance-attribute
¶
mesh loads the flexcomp points and elements (i.e. triangles) from a mesh file, in the same file formats as mesh assets, excluding the legacy .msh format. A mesh asset is not actually added to the model. Instead the vertex and face data from the mesh file are used to populate the point and element data of the flexcomp. dim is automatically set to 2. Recall that a mesh asset in MuJoCo can be used as a rigid geom attached to a single body. In contrast, the flex generated here corresponds to a soft mesh with the same initial shape, where each vertex is a separate moving body (unless pinned).
GMSH
class-attribute
instance-attribute
¶
gmsh is similar to mesh, but it loads a GMSH file in format 4.1 and format 2.2 (ascii or binary). The file extension can be anything; the parser recognizes the format by examining the file header. This is a very rich file format, allowing all kinds of elements with different dimensionality and topology. MuJoCo only supports GMSH element types 1, 2, 4 which happen to correspond to our 1D, 2D and 3D flexes and assumes that the nodes are specified in a single block. Only the Nodes and Elements sections of the GMHS file are processed, and used to populate the point and element data of the flexcomp. The parser will generate an error if the GMSH file contains meshes that are not supported by MuJoCo. dim is automatically set to the dimensionality specified in the GMSH file. Presently this is the only mechanism to load a large tetrahedral mesh in MuJoCo and generate a corresponding soft entity. If such a mesh is available in a different file format, use the freely available GMSH software to convert it to GMSH in one of the supported versions.
DIRECT
class-attribute
instance-attribute
¶
direct allows the user to specify the point and element data of the flexcomp directly in the XML. Note that flexcomp will still generate moving bodies automatically, as well as automate other settings; so it still provides convenience compared to specifing the corresponding flex directly.
SelfCollide
¶
Bases: StrEnum
This determines the strategy for midphase collision pruning of element pairs belonging to the same flex.
NONE
class-attribute
instance-attribute
¶
Flex elements cannot collide with each other.
NARROW
class-attribute
instance-attribute
¶
Narrow phase only (i.e. all pairs are checked). This is a diagnostic tool and is never a good idea in practice.
BVH
class-attribute
instance-attribute
¶
Bounding volume hierarchies (strategy for midphase collision pruning).
SAP
class-attribute
instance-attribute
¶
Sweep-and-prune (strategy for midphase collision pruning).
AUTO
class-attribute
instance-attribute
¶
Select sap in 1D and 2D, and bvh in 3D. Which strategy performs better depends on the specifics of the model. The automatic setting is just a simple rule which we have found to perform well in general.
SensorObjectType
¶
Bases: StrEnum
Types of objects to which a sensor may be attached. This must be an object type that has a spatial frame.
ContactReduce
¶
Bases: StrEnum
Reduces the number of matched contacts to exactly num sub-arrays, or "slots". If less than num contacts match, the remaining slots are set to be identically zero. Note that the default, "unsorted" reduction criterion is potentitally non-deterministic. See reduce below.
NONE
class-attribute
instance-attribute
¶
Returns the first num contacts that satisfy the matching criterion, in the order that they appear in mjData.contact. Note that while this is the fastest option, it is also potentially non-deterministic: future changes to collision detection code may cause the identity and order of matching contacts to change.
MINDIST
class-attribute
instance-attribute
¶
Returns num contacts with the smallest penetration depth, ascending order.
MAXFORCE
class-attribute
instance-attribute
¶
Returns num contacts with the largest force norm, descending order.
NETFORCE
class-attribute
instance-attribute
¶
This reduction criterion returns one new "synthetic" contact, located at the force-weighted centroid of all matched contacts. The frame of the contact is the global frame, so normal and tangent directions lose their natural semantic. The force and torque are computed such that a wrench applied at the computed position will have the same net effect as all the matching contacts combined. Note that this reduction criterion always returns exactly one contact.
ContactData
¶
Bases: StrEnum
Specification of which data field(s) to report from the selected contacts.
Importantly, the data attribute can contain multiple sequential data types, as long as the relative order—as listed above—is maintained. For example, data = "found force dist" will return 5 numbers per contact (the concateneated values of [found, force, dist]), while data = "force found dist" is an error because found must come before force.
Missing contacts
If less than num contacts satisfy the matching criterion, the entire data slot is set to be identically zero. Because most data types can take 0 as a valid value, only the zero-ness of the normal and tangent unit vectors can be used to unambiguously detect an empty slot. For this reason, the found data type is in place to allow for simple detection of missing contacts.
Size of sensordata block
Unlike other sensors, the size of the corresponding sensordata block depends on the values of its attributes num and data. The total size of the output of a contact sensor is the product num x size(selected data fields). For example, requesting num = 6 contacts with data = "force dist normal" (3+1+3=7), will result in a sensordata block of 42 numbers (6 consecutive slots x 7 numbers per slot).
Direction convention
Because contacts create two equal-and-opposite forces between contacting bodies, there is freedom in the choice of which body impinges on which.
The sensor's convention is for "geom1/body1/subtree1" and "geom2/body2/subtree2" to determine the direction of the normal. The normal always points from the first to the second.
In the case that a direction cannot be determined, as when only a site is used as the matching criterion, or when both subtrees are the same, the normal direction is the same as it is in mjData.contact, where the normal points from the first to the second geom, and the two geoms are sorted according to their order in mjtGeom.
FOUND
class-attribute
instance-attribute
¶
float: This field serves two purposes. First, it indicates whether a contact was found in this slot, 0 means not found while a positive number means found. Second, the positive value equals the number of matching contacts. So if num = 3 contacts were requested but only 2 were matched, the found fields will equal (2, 2, 0); if 6 were matched they will equal (6, 6, 6).
FORCE
class-attribute
instance-attribute
¶
Vec3: The contact force, in the contact frame.
TORQUE
class-attribute
instance-attribute
¶
Vec3: The contact torque, in the contact frame.
POS
class-attribute
instance-attribute
¶
float: The contact position, in the global frame.
NORMAL
class-attribute
instance-attribute
¶
Vec3: The contact normal direction, in the global frame.
TANGENT
class-attribute
instance-attribute
¶
Vec3: The first tangent direction, in the global frame. In order to complete the full 3x3 contact frame, use tangent2 = cross(normal, tangent).
DataType
¶
Bases: StrEnum
The type of output generated by this sensor.
NeedStage
¶
Bases: StrEnum
The MuJoCo computation stage that must be completed before the user callback mjcb_sensor() is able to evaluate the output of this sensor.
TextureMIME
¶
ActuatorInput
¶
Bases: StrEnum
Specifies the input signal semantics. (see tech note, Section 2.5)
VOLTAGE
class-attribute
instance-attribute
¶
The control directly sets applied motor voltage
POSITION
class-attribute
instance-attribute
¶
The PID controller uses the control as a reference setpoint relative to the joint position.
VELOCITY
class-attribute
instance-attribute
¶
The PID controller uses the control as a reference setpoint relative to the joint velocity.
FF
class-attribute
instance-attribute
¶
The control is a torque feedforward, like with pid/input.
NONE
class-attribute
instance-attribute
¶
The actuator will work as a passive device.
OrientationInput
¶
Bases: StrEnum
Chart of the commanded orientation for the orientation actuator.
EXPMAP
class-attribute
instance-attribute
¶
The control block is an exponential-map vector (3 controls, in radians).
QUAT
class-attribute
instance-attribute
¶
The control block is a quaternion (4 controls, w-first). The commanded quaternion is normalized by the servo, and the control block resets to the identity quaternion. Requires dyntype "none".
CameraProjection
¶
Bases: StrEnum
Whether the camera uses a perspective (the default) or orthographic projection. Setting this attribute to "orthographic" changes the semantic of the fovy attribute.
CameraOutput
¶
Bases: StrEnum
Types of output images supported by the camera.
RangefinderData
¶
Bases: StrEnum
DIST
class-attribute
instance-attribute
¶
The distance from the ray origin to the nearest geom surface, -1 if no surface was hit. If this data type is included, rays will be visualized as lines.
DIR
class-attribute
instance-attribute
¶
Normalized direction of the ray, or (0, 0, 0) if no surface was hit.
ORIGIN
class-attribute
instance-attribute
¶
The point from which the ray emanates (global frame). For sites and perspective cameras, this is the site/camera xpos. However for orthographic cameras, ray origins are spatially distributed along the image plane.
POINT
class-attribute
instance-attribute
¶
The point where the ray intersects the nearest geom surface in the global frame, or (0, 0, 0) if no surface was hit. If this data type is included, intersection points will be visualized as spheres.
NORMAL
class-attribute
instance-attribute
¶
The geom surface normal at the point where the ray intersects it, in the global frame, or (0, 0, 0) if no surface was hit. Note that normals always point towards the outside of the geom surface, regardless of the ray origin. If this data type is included along with either dist or point, normals will be visualized as arrows at the intersection points.
DEPTH
class-attribute
instance-attribute
¶
The distance of the hit point from the camera plane, -1 if no surface was hit. Note that this depth semantic corresponds to depth images in the computer graphics sense.
SensorInterp
¶
EdgeEquality
¶
Bases: StrEnum
The type of equality constraint applied to this edge.
VERT
class-attribute
instance-attribute
¶
Averaged constraint is used, see flexvert.
STRAIN
class-attribute
instance-attribute
¶
A constraint is added to enforce that the invariants of the strain tensor do not change; this is only equality constraint type supported for trilinear and quadratic dofs elements and here.
ProximityType
¶
Bases: IntEnum
Exit types from proximity calculations.
-
Code Reference
mujoco_mojoutils
-
Code Reference
mujoco_mojoutilsproximity_mixinProximityMixinbake_proximity
SPHERE_TO_SPHERE
class-attribute
instance-attribute
¶
Returned value is from a broadphase test (bounding sphere to bounding sphere).
CONVEX_HULL
class-attribute
instance-attribute
¶
VERTEX_TO_FACE
class-attribute
instance-attribute
¶
Returned value is from a vertex to face test.
FACE_TO_FACE
class-attribute
instance-attribute
¶
Returned value is from a face to face test.
Conflict
¶
Bases: StrEnum
This attribute controls how conflicting global attributes (physics options, sizes, visual settings) are resolved when a child spec is attached to a parent using mjs_attach. A conflict occurs when both the parent and child specify authored values for the same field and those values differ. See Attribute Merging for details and a per-field table.
WARNING
class-attribute
instance-attribute
¶
Parent values take precedence. When a conflict is detected, a warning is emitted but the parent value is not modified. This is the default and preserves the pre-existing attachment behavior.
MERGE
class-attribute
instance-attribute
¶
Fields are merged using field-specific strategies (minimum, maximum, OR, or error), depending on the field's semantics. When only the child specifies an authored value, it is adopted by the parent. See the merging table for per-field details.
ERROR
class-attribute
instance-attribute
¶
Any conflict between authored values results in a compile error. This is the strictest mode and is useful for detecting unintended attribute mismatches.
ModelProvider
¶
Bases: StrEnum
env_var_name
property
¶
env_var_name: str | None
Best-effort: the primary environment variable this provider's own pydantic_ai module documents for its credentials (e.g. GOOGLE_API_KEY, or AWS_ACCESS_KEY_ID for Bedrock), or None if it doesn't use one this way - OpenAI Codex uses an OAuth device-code flow instead of any single env var.
pydantic_ai has no structured "get this provider's env var" API - every provider module only ever states it as prose, in its own __init__ docstring and error message. Rather than hand-copying eighteen of those into a lookup table here (exactly the "second copy that can drift out of sync" problem build_model above avoids), this reads that provider's own pydantic_ai.providers.<name> source file directly and looks for its "X_Y_Z environment variable" phrasing - never importing/executing that module, so this works whether or not the provider's optional SDK is installed. Best-effort because it's pattern-matching prose, not calling a documented API: a pydantic_ai wording change could stop matching, in which case this returns None rather than something wrong.
build_model
¶
Builds a live pydantic_ai Model for this provider and model_name.
Delegates to pydantic_ai.models.infer_model - the same provider:model resolution Agent('google:gemini-3-flash') uses internally - instead of hand-mapping every provider to its own Provider/Model class pair here. infer_model already owns that mapping (and every provider's exact Model subclass) and pydantic_ai keeps it current as it adds providers, so re-deriving it in a match statement here only gives us a second copy that can drift out of sync. The provider is otherwise constructed exactly as Agent('provider:model') would build it - reading whatever environment variable that provider looks for by default (see env_var_name).
base_url only matters for OLLAMA (or another self-hosted OpenAI-compatible server pointed at a nonstandard host/port) - pydantic_ai's OllamaProvider, unlike most others, has no built-in localhost default and raises without one. Pass it there; leave it None for every other provider, since a provider that does accept base_url (e.g. Google) would silently redirect its real endpoint to whatever's passed. A provider whose constructor doesn't accept base_url at all falls back to its own default construction instead, logged as a warning.
Raises:
| Type | Description |
|---|---|
ImportError
|
If the optional package this provider's SDK needs isn't installed - caught broadly rather than narrowed to |
NotImplementedError
|
If this member has no |