google-deepmind / google-deepmind/mujoco

viewer.update_texture() blocks windows.is_running()

Open
#2,346 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
15.2k
Forks
1.8k
Avg merge
10d 16h
Merged PRs (30d)
25

Description

### Intro

MuJoCo advanced user

### My setup

MuJoCo 3.2.4, mac os

### What's happening? What did you expect?

Repeated calls to update textures `window.update_texture(tex.id)` blocks `window.is_running()`

https://github.com/user-attachments/assets/2de47075-997b-4d0c-9086-47084b1188ee

cc @saran-t

### Steps for reproduction

1. Run the code below.
2. close the viewer()
3. execution hangs without exit

### Minimal model for reproduction

import time

from mujoco import viewer

XML = r"""








"""
mj_model = mujoco.MjModel.from_xml_string(XML)
mj_data = mujoco.MjData(mj_model)
tex = mj_model.tex("tex_rgb")

window = viewer.launch_passive(
mj_model,
mj_data,
show_left_ui=False,
show_right_ui=False,
)

while window.is_running():
mujoco.mj_step(mj_model, mj_data)
window.update_texture(tex.id)
window.sync()
time.sleep(mj_model.opt.timestep)

print("Clean Exit")

### Code required for reproduction

See above

### Confirmations

- [X] I searched the [latest documentation](https://mujoco.readthedocs.io/en/latest/overview.html) thoroughly before posting.
- [X] I searched previous [Issues](https://github.com/google-deepmind/mujoco/issues) and [Discussions](https://github.com/google-deepmind/mujoco/discussions), I am certain this has not been raised before.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.