LIRRA  1.0.0
Loading...
Searching...
No Matches
rl_stl.utils.render Namespace Reference

Functions

str pick_h264_encoder ()
 
None add_box (scene, np.ndarray center, np.ndarray halfwidth, rgba=(0.2, 0.85, 0.2, 0.25), np.ndarray|None rot=None)
 
None add_sphere (scene, np.ndarray center, float radius, rgba)
 
None add_segment (scene, np.ndarray start, np.ndarray end, float width, rgba)
 
int render_qpos_video (mujoco.MjModel mj_model, np.ndarray qpos, str|Path path, float fps, np.ndarray|None box_center=None, np.ndarray|None box_halfwidth=None, int width=640, int height=480, str|int camera="track")
 

Detailed Description

Small MuJoCo video helpers shared by the X2 rollout/evaluation scripts.

Rendering needs an OpenGL context: on a headless machine use ``MUJOCO_GL=egl``.

Function Documentation

◆ add_box()

None rl_stl.utils.render.add_box (   scene,
np.ndarray  center,
np.ndarray  halfwidth,
  rgba = (0.2, 0.85, 0.2, 0.25),
np.ndarray | None   rot = None 
)
Append a translucent box geom to an already updated ``mujoco.MjvScene`` (``rot``: 3x3 world
orientation of the box, default axis aligned).

◆ add_segment()

None rl_stl.utils.render.add_segment (   scene,
np.ndarray  start,
np.ndarray  end,
float  width,
  rgba 
)
Append a capsule from ``start`` to ``end`` to an already updated ``mujoco.MjvScene``.

◆ add_sphere()

None rl_stl.utils.render.add_sphere (   scene,
np.ndarray  center,
float  radius,
  rgba 
)
Append a sphere geom to an already updated ``mujoco.MjvScene``.

◆ pick_h264_encoder()

str rl_stl.utils.render.pick_h264_encoder ( )
mediapy's default codec='h264' resolves to whatever ffmpeg registers under
that name; on some cluster ffmpeg builds that is the v4l2m2m hardware encoder,
which fails without a /dev/video* device. Prefer a software encoder.

◆ render_qpos_video()

int rl_stl.utils.render.render_qpos_video ( mujoco.MjModel  mj_model,
np.ndarray  qpos,
str | Path  path,
float  fps,
np.ndarray | None   box_center = None,
np.ndarray | None   box_halfwidth = None,
int   width = 640,
int   height = 480,
str | int   camera = "track" 
)
Render one frame per row of ``qpos`` (kinematic replay) and write an mp4. Returns frame count.