Skip to main content

The kscale-mujoco-viewer project

Project description

kscale-mujoco-viewer

Mujoco viewer maintained by K-Scale Labs.

https://github.com/user-attachments/assets/5312fa03-7215-4c1b-9d66-acaa18b96a3c

Installation

pip install kmv

Examples

Run the humanoid example script to see the viewer in action:

# cd to the root of the repo
python examples/default_humanoid.py

Usage

import mujoco, time
from kmv.app.viewer import QtViewer

model  = mujoco.MjModel.from_xml_path("path/to/model.xml")
data   = mujoco.MjData(model)
viewer = QtViewer(model)

while viewer.is_open:
    mujoco.mj_step(model, data)

    # send state
    viewer.push_state(data.qpos, data.qvel, sim_time=data.time)

    # send a few scalars to the “Debug” plot group
    viewer.push_plot_metrics(
        scalars={
            "qpos0": float(data.qpos[0]),
            "qvel0": float(data.qvel[0]),
        },
        group="Debug",
    )

    time.sleep(model.opt.timestep)

viewer.close()

Troubleshooting

If you have issues with linux machines that have both integrated and nvidia GPUs, you may need to set these environment variables to force use of the nvidia GPU.

__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia python examples/default_humanoid.py

You may also have to install the following utilities:

sudo apt install libxcb-cursor0 libxcb-cursor-dev

Additionally, depending on your setup, you may need to set the right environment variables to run the viewer properly. See this issue for more details.

QT_QPA_PLATFORM=wayland python examples/default_humanoid.py

Acknowledgements

Originally referenced from mujoco-python-viewer.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kmv-0.3.20.tar.gz (28.1 kB view details)

Uploaded Source

File details

Details for the file kmv-0.3.20.tar.gz.

File metadata

  • Download URL: kmv-0.3.20.tar.gz
  • Upload date:
  • Size: 28.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for kmv-0.3.20.tar.gz
Algorithm Hash digest
SHA256 c065d42af621bf4134a2fc171fcedc4680c8ff66040d78223bc171b4e5b58ba7
MD5 08701deb869f0e948be559df1d777c7e
BLAKE2b-256 e1232d7299b2c966b558fcb9ec8bbe3c26296abe11d32d49e64a6a430976c90f

See more details on using hashes here.

Provenance

The following attestation bundles were made for kmv-0.3.20.tar.gz:

Publisher: publish.yml on kscalelabs/kscale-mujoco-viewer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page