| #!/usr/bin/env python3 | |
| """Headless entrypoint for the Unitree G1 MuJoCo sim container. | |
| Runs the hub repo's own ``run_sim.py`` with container-friendly defaults | |
| (no on-screen viewer; camera rendering off by default). Controlled via env vars: | |
| G1_SIM_DIR directory holding the baked hub sim (default: /opt/g1-sim) | |
| G1_PUBLISH_IMAGES "1" to render + publish head camera over ZMQ (needs GL), else off | |
| G1_CAMERA_PORT ZMQ port for camera images (default: 5555) | |
| """ | |
| import os | |
| import sys | |
| SIM_DIR = os.environ.get("G1_SIM_DIR", "/opt/g1-sim") | |
| sys.path.insert(0, SIM_DIR) | |
| os.chdir(SIM_DIR) | |
| import run_sim # noqa: E402 (imported after sys.path insert) | |
| publish_images = os.environ.get("G1_PUBLISH_IMAGES", "0") == "1" | |
| camera_port = int(os.environ.get("G1_CAMERA_PORT", "5555")) | |
| run_sim.main(publish_images=publish_images, camera_port=camera_port) | |