MCPcopy Create free account

hub / github.com/mujocolab/mjlab / functions

Functions2,812 in github.com/mujocolab/mjlab

↓ 297 callersMethodappend
Append new observation to buffer. Args: data: Observation tensor of shape (batch_size, ...).
src/mjlab/utils/buffers/delay_buffer.py:221
↓ 126 callersMethodcpu
(self)
src/mjlab/viewer/native/viewer.py:103
↓ 117 callersMethodnumpy
(self)
src/mjlab/viewer/native/viewer.py:104
↓ 100 callersMethodcompute
( self, update_history: bool = False )
src/mjlab/managers/observation_manager.py:305
↓ 94 callersMethodstep
(self)
src/mjlab/sim/sim.py:465
↓ 84 callersMethodcompile
(self)
src/mjlab/scene/scene.py:71
↓ 61 callersMethodupdate
(self, dt: float)
src/mjlab/scene/scene.py:196
↓ 60 callersFunctionget_test_device
Get device for testing, preferring CUDA if available. Can be overridden with FORCE_CPU=1 environment variable to test CPU-only behavior on GPU ma
tests/conftest.py:22
↓ 57 callersMethodsense
Execute the sense pipeline: prepare -> graph -> finalize. Runs BVH refit, camera rendering, and raycasting in a single CUDA graph launch. Sho
src/mjlab/sim/sim.py:495
↓ 55 callersMethodset_joint_position_target
Set joint position targets. Args: position: Target joint poisitions with shape (N, num_joints). joint_ids: Optional joint indices to
src/mjlab/entity/entity.py:990
↓ 54 callersMethodwrite_data_to_sim
(self)
src/mjlab/scene/scene.py:202
↓ 52 callersFunctioninitialize_entity
Initialize entity with simulation. Args: entity: Entity to initialize. device: Device to use ("cpu" or "cuda"). num_envs: Number of env
tests/conftest.py:89
↓ 50 callersMethodforward
(self, x)
tests/test_learned_actuator.py:57
↓ 42 callersMethodset_joint_effort_target
Set joint effort targets. Args: effort: Target joint efforts with shape (N, num_joints). joint_ids: Optional joint indices to set. If
src/mjlab/entity/entity.py:1028
↓ 41 callersMethodresolve
Resolve names and IDs for all configured fields. This method ensures consistency between names and IDs for each field type. It handles three
src/mjlab/managers/scene_entity_config.py:129
↓ 39 callersMethodget_default_field
Get the default value for a model field, caching for reuse. Returns the original values from the C MuJoCo model (mj_model), obtained from the
src/mjlab/sim/sim.py:427
↓ 39 callersFunctionmake_scene_and_sim
Create a scene and simulation from inline XML with sensors wired up. ``xml`` may be a single XML string (registered as the ``robot`` entity) or a
tests/conftest.py:107
↓ 38 callersMethodwrite_joint_state_to_sim
Set the joint state into the simulation. The joint state consists of joint positions and velocities. It does not include the root state.
src/mjlab/entity/entity.py:932
↓ 37 callersMethodbuild
(self)
tests/test_entity.py:598
↓ 37 callersMethodset_joint_velocity_target
Set joint velocity targets. Args: velocity: Target joint velocities with shape (N, num_joints). joint_ids: Optional joint indices to
src/mjlab/entity/entity.py:1009
↓ 35 callersFunctioncreate_entity_with_actuator
Create entity with actuator from XML string. Args: xml_string: MuJoCo XML model string. actuator_cfg: Actuator configuration. Returns:
tests/conftest.py:55
↓ 34 callersMethodinitialize
( self, mj_model: mujoco.MjModel, model: mjwarp.Model, data: mjwarp.Data, )
src/mjlab/scene/scene.py:162
↓ 31 callersFunctionload_env_cfg
Load environment configuration for a task. Returns a deep copy to prevent mutation of the registered config.
src/mjlab/tasks/registry.py:48
↓ 31 callersMethodreset
( self, *, seed: int | None = None, env_ids: torch.Tensor | None = None, options: dict[str
src/mjlab/envs/manager_based_rl_env.py:356
↓ 30 callersFunction_randomize_model_field
Core randomization engine for model fields.
src/mjlab/envs/mdp/dr/_core.py:48
↓ 30 callersFunctionbrand_ramp
Create a color ramp from a base RGB color using parameter t. This function creates a color variation by adjusting saturation and value based on t
src/mjlab/utils/color.py:126
↓ 29 callersMethodremove
(self)
src/mjlab/viewer/viser/scene.py:96
↓ 28 callersMethodget_term
(self, name: str)
src/mjlab/managers/action_manager.py:137
↓ 27 callersMethodclose
(self)
src/mjlab/envs/manager_based_rl_env.py:501
↓ 26 callersMethodwrite_root_state_to_sim
Set the root state into the simulation. The root state consists of position (3), orientation as a (w, x, y, z) quaternion (4), linear velocit
src/mjlab/entity/entity.py:868
↓ 25 callersMethodinject_tick
Call tick() with a controlled dt.
tests/test_viewer_tick.py:39
↓ 24 callersMethodappend
Append a new frame for all batch elements. Args: data: Tensor of shape (batch_size, ...).
src/mjlab/utils/buffers/circular_buffer.py:190
↓ 24 callersMethodexpand_model_fields
Expand model fields to support per-environment parameters.
src/mjlab/sim/sim.py:407
↓ 24 callersMethodload
Load checkpoint. Extends the base implementation to: 1. Restore common_step_counter to preserve curricula state. 2. Migrate legacy checkp
src/mjlab/rl/runner.py:83
↓ 23 callersFunctionload_fixture_xml
Load XML content from fixture file. Args: fixture_name: Name of the fixture file (without .xml extension) or full path. Returns: XML con
tests/conftest.py:39
↓ 21 callersMethodcompute
Compute delayed observation for current step. Returns: Delayed observation with shape (batch_size, ...).
src/mjlab/utils/buffers/delay_buffer.py:229
↓ 21 callersFunctioncreate_scene_with_sensor
Helper to create a complete test environment with contact sensor. Sets up a scene with the specified entity and contact sensor configuration, com
tests/test_contact_sensor.py:82
↓ 21 callersFunctionsample_uniform
Sample uniformly within a range. Args: lower: Lower bound of uniform range. upper: Upper bound of uniform range. size: Th
src/mjlab/utils/lab_api/math.py:1361
↓ 20 callersFunctionquat_mul
Multiply two quaternions together. Args: q1: The first quaternion in (w, x, y, z). Shape is (..., 4). q2: The second quaternion i
src/mjlab/utils/lab_api/math.py:527
↓ 19 callersMethodcompute
Compute low-level actuator control signal from high-level commands. Args: cmd: High-level actuator command. Returns: Control sig
src/mjlab/actuator/actuator.py:352
↓ 18 callersMethodcompile
Compile the underlying MjSpec into an MjModel.
src/mjlab/entity/entity.py:629
↓ 18 callersMethodlog
(self, message: str, level: VerbosityLevel = VerbosityLevel.INFO)
src/mjlab/viewer/base.py:214
↓ 16 callersFunction_to_numpy
(x: np.ndarray | torch.Tensor)
src/mjlab/viewer/viser/scene.py:74
↓ 16 callersFunctionquat_apply
Apply a quaternion rotation to a vector. Args: quat: The quaternion in (w, x, y, z). Shape is (..., 4). vec: The vector in (x, y,
src/mjlab/utils/lab_api/math.py:629
↓ 15 callersFunction_make_scene_and_sim
( device: str, sensors: tuple, xml: str = SCENE_WITH_CAMERA_XML, num_envs: int = 2, )
tests/test_camera_sensor.py:36
↓ 15 callersFunctioninitialize_entity_with_sim
Initialize an entity with a simulation.
tests/test_entity_data.py:59
↓ 15 callersFunctionmatrix_from_quat
Convert rotations given as quaternions to rotation matrices. Args: quaternions: The quaternion orientation in (w, x, y, z). Shape is (...
src/mjlab/utils/lab_api/math.py:168
↓ 15 callersFunctionquat_from_matrix
Convert rotations given as rotation matrices to quaternions. Args: matrix: The rotation matrices. Shape is (..., 3, 3). Returns:
src/mjlab/utils/lab_api/math.py:318
↓ 15 callersMethodwrite_joint_position_to_sim
Set the joint positions into the simulation. Like `write_joint_state_to_sim()` but only sets joint positions. Args: position: Tensor of
src/mjlab/entity/entity.py:954
↓ 14 callersMethod_get_frame_pose
Return current frame (position, quaternion) from sim data.
src/mjlab/envs/mdp/actions/differential_ik.py:287
↓ 14 callersFunction_make_reward_cfg
( weight: float = 1.0, params: dict | None = None, )
tests/test_envs_curriculums.py:22
↓ 14 callersFunction_make_reward_env
(step_counter, reward_cfg)
tests/test_envs_curriculums.py:56
↓ 14 callersFunctionbuild_variant_model
Build a Warp Model with per-world mesh assignments. Args: spec: Scene spec (already merged with padded variant geoms). nworld: Number of si
src/mjlab/entity/variants.py:1317
↓ 14 callersMethodcompute
(self)
src/mjlab/managers/metrics_manager.py:147
↓ 14 callersFunctioncreate_test_env
( device, num_envs=NUM_ENVS, expand_fields=("geom_friction", "dof_damping") )
tests/test_domain_randomization.py:71
↓ 14 callersFunctionselect_gpus
Select GPUs based on CUDA_VISIBLE_DEVICES and user specification. This function treats the `gpu_ids` parameter as indices into the existing CUDA_
src/mjlab/utils/gpu.py:9
↓ 14 callersMethodupdate
Advance actuator internal state by one physics substep. Called after each ``sim.step()`` within the decimation loop.
src/mjlab/entity/entity.py:816
↓ 13 callersFunctionprint_info
Print information message with color. Args: message: The message to print. color: Color name ('green', 'red', 'yellow', 'blue', 'cyan', 'ma
src/mjlab/utils/logging.py:6
↓ 13 callersMethodprocess_actions
(self, actions: torch.Tensor)
src/mjlab/managers/action_manager.py:58
↓ 13 callersFunctionquat_apply_inverse
Apply an inverse quaternion rotation to a vector. Args: quat: The quaternion in (w, x, y, z). Shape is (..., 4). vec: The vector
src/mjlab/utils/lab_api/math.py:651
↓ 13 callersMethodreset
( self, env_ids: torch.Tensor | slice | None = None )
src/mjlab/managers/metrics_manager.py:107
↓ 12 callersFunction_build_reward
(env, reward_name, stages)
tests/test_envs_curriculums.py:42
↓ 12 callersFunctionregister_mjlab_task
Register an environment task. Args: task_id: Unique task identifier (e.g., "Mjlab-Velocity-Rough-Unitree-Go1"). env_cfg: Environment config
src/mjlab/tasks/registry.py:22
↓ 12 callersMethodrun
(self, num_steps: Optional[int] = None, catch_sigint: bool = True)
src/mjlab/viewer/base.py:397
↓ 11 callersFunction_broadcast
(src: np.ndarray, shape: tuple[int, ...])
src/mjlab/entity/variants.py:1136
↓ 11 callersMethod_compute_env_origins_curriculum
Compute env origins from sub-terrain origins. Args: num_envs: Number of environments to place. origins: Sub-terrain origins, shape ``
src/mjlab/terrains/terrain_entity.py:325
↓ 11 callersFunction_format_variant_error
( variant_name: str, message: str, hint: str | None = None )
src/mjlab/entity/variants.py:364
↓ 11 callersMethodget_command
Extract command data for this actuator from entity data. Args: data: The entity data containing all state and target information. Retu
src/mjlab/actuator/actuator.py:314
↓ 11 callersMethodinitialize
Prepare the entity for simulation after the spec has been compiled. Computes global index mappings, initializes actuators, and allocates all nwor
src/mjlab/entity/entity.py:647
↓ 11 callersFunctionquat_from_euler_xyz
Convert rotations given as Euler angles in radians to Quaternions. Note: The euler angles are assumed in XYZ convention. Args:
src/mjlab/utils/lab_api/math.py:277
↓ 11 callersMethodreset
(self, env_ids: torch.Tensor | None = None, env=None)
tests/test_rewards.py:58
↓ 11 callersFunctionresolve_matching_names
Match a list of query regular expressions against a list of strings and return the matched indices and names. When a list of query regular expres
src/mjlab/utils/lab_api/string.py:178
↓ 11 callersMethodwrite
Write the scene XML and mesh assets to a directory. Creates ``scene.xml`` and an ``assets/`` subdirectory containing mesh files referenced by
src/mjlab/scene/scene.py:74
↓ 10 callersFunction_articulated_spec
Root + child body (hinge joint). Optional grandchild for arity tests.
tests/test_variants.py:380
↓ 10 callersFunction_make_entity
( *, effort_limit: float | None = 50.0, armature: float | None = None, delay_max_lag: int = 0, delay
tests/test_builtin_pd_actuator.py:39
↓ 10 callersFunction_make_initialized
Build entity from cfg kwargs and initialize it through the sim.
tests/test_builtin_dcmotor_actuator.py:79
↓ 10 callersFunction_make_origins
(num_rows: int, num_cols: int)
tests/test_terrain_proportion_spawning.py:20
↓ 10 callersFunction_qfrc
(entity, sim)
tests/test_builtin_dcmotor_actuator.py:345
↓ 10 callersMethodadd_arrow
( self, start: np.ndarray | torch.Tensor, end: np.ndarray | torch.Tensor, color: tuple[float,
src/mjlab/viewer/viser/scene.py:848
↓ 10 callersFunctiondarken_rgba
Darken an RGBA color by a given factor. Args: rgba: RGBA color tuple with values in range [0, 1]. factor: Darkening factor in range [0, 1],
src/mjlab/utils/color.py:164
↓ 10 callersFunctioninitialize_entity
(entity, device, num_envs=1)
tests/test_delayed_actuator.py:61
↓ 10 callersFunctionmake_border
Create rectangular border using four box geometries. Returns top, bottom, left, right boxes forming a hollow rectangle.
src/mjlab/terrains/utils.py:138
↓ 10 callersFunctionsample
(r: tuple[float, float])
src/mjlab/envs/mdp/dr/body.py:511
↓ 10 callersMethodsave
Save checkpoint. Extends the base implementation to persist the environment's common_step_counter and to respect the ``upload_model`` config
src/mjlab/rl/runner.py:67
↓ 10 callersMethodwrite_root_link_pose_to_sim
Set the root pose into the simulation. Like `write_root_state_to_sim()` but only sets position and orientation. Args: root_pose: Tensor
src/mjlab/entity/entity.py:884
↓ 10 callersMethodwrite_root_link_velocity_to_sim
Set the root link (body origin) velocity into the simulation. Like `write_root_state_to_sim()` but only sets linear and angular velocity. Arg
src/mjlab/entity/entity.py:899
↓ 9 callersFunction_build_scene_with_variants
Build a scene spec + variant_info from two variant spec_fns.
tests/test_variants.py:135
↓ 9 callersFunction_drive
( entity: Entity, sim, device: str, *, pos_target=None, vel_target=None, effort_target=None, q
tests/test_builtin_dcmotor_actuator.py:84
↓ 9 callersFunction_normalized
(proportions: list[float])
tests/test_terrain_proportion_spawning.py:29
↓ 9 callersMethodclear
Clear all debug visualization queues.
src/mjlab/viewer/viser/scene.py:988
↓ 9 callersMethodforward
(self)
src/mjlab/sim/sim.py:458
↓ 9 callersFunctionupdate_terrain
()
src/mjlab/scripts/visualize_terrain.py:221
↓ 8 callersFunction_make_entity
(**kwargs)
tests/test_builtin_dcmotor_actuator.py:75
↓ 8 callersFunction_make_entity
(device, xml=ARM_XML)
tests/test_differential_ik_action.py:81
↓ 8 callersFunction_make_env
(entity, sim, device)
tests/test_differential_ik_action.py:104
↓ 8 callersMethod_resolve_env_ids
Convert env_ids to consistent indexing format.
src/mjlab/entity/data.py:227
↓ 8 callersFunctionallocate_worlds
Assign worlds proportionally by weight (largest-remainder method). Returns a list of length *nworld* containing variant indices. Weights must be
src/mjlab/entity/variants.py:1288
↓ 8 callersMethodapply
Apply configuration settings to a compiled MjModel.
src/mjlab/sim/sim.py:116
↓ 8 callersMethodbuild
(self, env: ManagerBasedRlEnv)
src/mjlab/envs/mdp/actions/differential_ik.py:104
↓ 8 callersFunctioncreate_entity_with_actuator
(actuator_cfg)
tests/test_learned_actuator.py:107
next →1–100 of 2,812, ranked by callers