LIRRA  1.0.0
Loading...
Searching...
No Matches
rl_stl.envs.skydio_x2.model Namespace Reference

Classes

class  X2Params
 

Functions

Path menagerie_x2_dir ()
 
str|None menagerie_commit ()
 
mujoco.MjSpec load_x2_spec (bool scene=True, bool apply_gear_fix=True)
 
mujoco.MjModel load_x2_model (bool scene=True, bool fluid=True, float|None timestep=None, bool apply_gear_fix=True)
 
X2Params x2_params_from_model (mujoco.MjModel model)
 
tuple[np.ndarray, np.ndarray] com_state_from_qpos_qvel (X2Params params, np.ndarray qpos, np.ndarray qvel)
 

Variables

str F_SIM_VERSION = "x2_menagerie-1b86ece_gearfix-9bac002_v1"
 
dict _YAW_GEAR_PINNED = {"thrust1": -0.0201, "thrust2": 0.0201, "thrust3": 0.0201, "thrust4": -0.0201}
 
dict _YAW_GEAR_FIXED = {"thrust1": -0.0201, "thrust2": 0.0201, "thrust3": -0.0201, "thrust4": 0.0201}
 
tuple MOTOR_NAMES = ("thrust1", "thrust2", "thrust3", "thrust4")
 

Detailed Description

Skydio X2 simulation model ``f_sim`` from MuJoCo Menagerie.

The asset is loaded from the Menagerie checkout that MuJoCo Playground pins
(``mujoco_playground._src.mjx_env.MENAGERIE_COMMIT_SHA``). That commit
(1b86ece, 2025-11-07) predates the upstream Menagerie fix 9bac002 "fix x2 thrust
gear" (2025-12-12), in which rotors 3 and 4 had swapped yaw-drag signs. With the
unfixed gears the yaw-torque row of the allocation matrix is proportional to the
roll-torque row, so yaw cannot be controlled independently. :func:`load_x2_spec`
applies exactly the upstream fix via ``MjSpec`` and asserts the original values,
so a future Menagerie bump that already contains the fix fails loudly instead of
being patched twice. No other part of the model is modified.

Everything physical used by controllers (mass, inertia, COM, rotor geometry,
allocation matrix, motor limits) is derived from the compiled ``MjModel`` by
:func:`x2_params_from_model`, never hard-coded.

Function Documentation

◆ com_state_from_qpos_qvel()

tuple[np.ndarray, np.ndarray] rl_stl.envs.skydio_x2.model.com_state_from_qpos_qvel ( X2Params  params,
np.ndarray  qpos,
np.ndarray   qvel 
)
COM position and world velocity from free-joint ``qpos``/``qvel`` (NumPy).

◆ load_x2_model()

mujoco.MjModel rl_stl.envs.skydio_x2.model.load_x2_model ( bool   scene = True,
bool   fluid = True,
float | None   timestep = None,
bool   apply_gear_fix = True 
)
Compiled X2 ``MjModel``. ``fluid=False`` zeroes air density/viscosity (ablation only).

◆ load_x2_spec()

mujoco.MjSpec rl_stl.envs.skydio_x2.model.load_x2_spec ( bool   scene = True,
bool   apply_gear_fix = True 
)
Menagerie X2 (optionally with ground plane scene) as an ``MjSpec``.

◆ menagerie_commit()

str | None rl_stl.envs.skydio_x2.model.menagerie_commit ( )

◆ menagerie_x2_dir()

Path rl_stl.envs.skydio_x2.model.menagerie_x2_dir ( )

◆ x2_params_from_model()

X2Params rl_stl.envs.skydio_x2.model.x2_params_from_model ( mujoco.MjModel  model)

Variable Documentation

◆ _YAW_GEAR_FIXED

dict rl_stl.envs.skydio_x2.model._YAW_GEAR_FIXED = {"thrust1": -0.0201, "thrust2": 0.0201, "thrust3": -0.0201, "thrust4": 0.0201}
protected

◆ _YAW_GEAR_PINNED

dict rl_stl.envs.skydio_x2.model._YAW_GEAR_PINNED = {"thrust1": -0.0201, "thrust2": 0.0201, "thrust3": 0.0201, "thrust4": -0.0201}
protected

◆ F_SIM_VERSION

str rl_stl.envs.skydio_x2.model.F_SIM_VERSION = "x2_menagerie-1b86ece_gearfix-9bac002_v1"

◆ MOTOR_NAMES

tuple rl_stl.envs.skydio_x2.model.MOTOR_NAMES = ("thrust1", "thrust2", "thrust3", "thrust4")