myosuite.core.protocols
EnvAccessor protocol and PhysicsPath enum shared across all three backend paths (CPU/Gymnasium, MJX+Brax, MuJoCo Warp/mjlab).
Classes
Identifies which physics backend an environment runs on. |
|
Minimal read interface exposed to term functions. |
Module Contents
- class myosuite.core.protocols.PhysicsPath
Bases:
enum.EnumIdentifies which physics backend an environment runs on.
- CPU = 'cpu'
- MJX = 'mjx'
- MJLAB = 'mjlab'
- class myosuite.core.protocols.EnvAccessor
Bases:
ProtocolMinimal read interface exposed to term functions.
Returns the native array type for the current path: - CPU: numpy.ndarray - MJX: jax.Array - mjlab: torch.Tensor
Term functions receive an EnvAccessor and call accessor.array_module for any array operations so the same code runs on all three paths.
- property physics_path: PhysicsPath
The backend physics path this accessor wraps.
- Return type:
- joint_pos()
Joint positions. Shape: (nq,) or (N, nq) for batched envs.
- Return type:
Any
- joint_vel()
Joint velocities. Shape: (nv,) or (N, nv) for batched envs.
- Return type:
Any
- muscle_act()
Muscle activations. Shape: (na,) or (N, na) for batched envs.
- Return type:
Any
- site_xpos(site_ids)
Cartesian positions of sites in world frame. Shape: (len(site_ids), 3).
- Parameters:
site_ids (Any)
- Return type:
Any
- time()
Simulation time in seconds.
- Return type:
Any
- ctrl_range()
Actuator control range. Shape: (nu, 2) where [:,0] is min, [:,1] is max.
- Return type:
Any
- array_module()
The array library for this backend: numpy, jax.numpy, or torch.
- Return type:
Any
- site_id(name)
Return the integer index of a named site in the model.
- Parameters:
name (str) – Site name as defined in the MJCF XML.
- Returns:
Integer site index usable with
site_xpos().- Raises:
ValueError – If the site name is not found in the model.
- Return type: