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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mjviewer-0.3.22.tar.gz.
File metadata
- Download URL: mjviewer-0.3.22.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe0bd600df4d8990868e18b809e3976323841e497b152d438f542fbf669e757b
|
|
| MD5 |
5ad6d50f9406dbe9eba874ffd82673cf
|
|
| BLAKE2b-256 |
5a5fe6f8ef22c0d4fb8920743a7b4cee93ba6a61b4da4f66e8acd25a63067ab5
|
File details
Details for the file mjviewer-0.3.22-py3-none-any.whl.
File metadata
- Download URL: mjviewer-0.3.22-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
571afe532d5e879fe58a82587c3c081a94bb5d1c01ea775b274d73056e3746e9
|
|
| MD5 |
2c8279177607749f87e81f3e938e7be9
|
|
| BLAKE2b-256 |
13400877769e7d7d5953ccbebf4a253445530ebf58dd258844170247c5dea1e2
|