26 model_path = mjk.menagerie.model_path(
"kinova_gen3", env_var=
"MJ_KDL_MODEL")
30 tmp = tempfile.NamedTemporaryFile(suffix=
".mjb", delete=
False)
32 mjb_path = Path(tmp.name)
33 scene.save_binary(str(mjb_path))
44actual = mujoco.mj_versionString()
47 f"This example exports a MuJoCo {expected} .mjb file. "
48 f"Installed Python mujoco is {actual}; install the same mujoco version "
49 "or rebuild the wrapper against the installed Python mujoco version."
52model = mujoco.MjModel.from_binary_path(sys.argv[1])
53data = mujoco.MjData(model)
54mujoco.viewer.launch(model, data)
58 [sys.executable,
"-c", viewer_code, str(mjb_path), mjk.mujoco_version()],
61 except subprocess.CalledProcessError
as exc:
63 "MuJoCo viewer failed to start. If you are running from a sandbox, SSH session, "
64 "or headless shell, run this command from a graphical session with DISPLAY or "
65 "WAYLAND_DISPLAY available."