⚙️ Global Settings (Options)#
Options is the global configuration object in MotrixSim, used to set various parameters for physical simulation. These parameters affect the accuracy, stability, and performance of the simulation.
Basic Concepts#
Common configuration parameters include:
Parameter |
Description |
Default Value |
|---|---|---|
|
Simulation time step (seconds) |
0.002 |
|
Gravity acceleration [x, y, z] |
[0, 0, -9.81] |
|
Max iterations for constraint solver |
100 |
Configuration Methods#
XML Configuration#
In MJCF files, you can use the <option> tag to configure parameters:
<mujoco>
<option timestep="0.002" gravity="0 0 -9.81" iterations="100"/>
</mujoco>
Code Configuration#
You can access and modify the configuration via the options attribute of SceneModel.
# ---------Try to access options----------
options = model.options
print(f"model.options: {options}")
# Get gravity
gravity = options.gravity # noqa: F841
# Get timestep
timestep = options.timestep # noqa: F841
# Get max iterations
max_iterations = options.max_iterations # noqa: F841
# Get solver tolerance
solver_tolerance = options.solver_tolerance # noqa: F841
# Get simulation flags
disable_gravity = options.disable_gravity # noqa: F841
disable_contacts = options.disable_contacts # noqa: F841
# ----------End----------
# Set gravity
options.gravity = [0, 0, 9.8]
for i in range(50):
step(model, data)
render.sync(data)
# Set gravity
options.gravity = [0, 0, -9.8]
for i in range(200):
step(model, data)
render.sync(data)
# Set simulation flags
options.disable_contacts = True
For a complete example, see examples/options.py.
API Reference#
For more APIs related to Options, see Options API