Skip to main content

The mjviewer project, based on kscale-mujoco-viewer

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

mjviewer-0.3.23.tar.gz (28.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mjviewer-0.3.23-py3-none-any.whl (32.1 kB view details)

Uploaded Python 3

File details

Details for the file mjviewer-0.3.23.tar.gz.

File metadata

  • Download URL: mjviewer-0.3.23.tar.gz
  • Upload date:
  • Size: 28.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for mjviewer-0.3.23.tar.gz
Algorithm Hash digest
SHA256 2f1dfc44ea5e531e8fb84fd5fb78b379ade345d8b599948ad97c6179d9d29431
MD5 f8948ae88a62634aab9da5e0474a0f1b
BLAKE2b-256 5d7bc7a3b078f02dc7b58c9704cfd873feacb98916bec6651fe4ba55a2cc0e2c

See more details on using hashes here.

File details

Details for the file mjviewer-0.3.23-py3-none-any.whl.

File metadata

  • Download URL: mjviewer-0.3.23-py3-none-any.whl
  • Upload date:
  • Size: 32.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for mjviewer-0.3.23-py3-none-any.whl
Algorithm Hash digest
SHA256 473089839d51ed388173bd037c5885854d1fa48b7e30657dedce9613ff915d16
MD5 43322ec4a338560b0611e214641677b5
BLAKE2b-256 6fd4281abff83d4dad20ccdf0473ac26595dd1e4858df0b216245e484dacb51a

See more details on using hashes here.

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