Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

viewer.update_texture() blocks windows.is_running() #2346

Open
2 tasks done
vikashplus opened this issue Jan 9, 2025 · 0 comments
Open
2 tasks done

viewer.update_texture() blocks windows.is_running() #2346

vikashplus opened this issue Jan 9, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@vikashplus
Copy link

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()

bug.mov

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"""
<mujoco>

    <asset>
        <texture name="tex_rgb" builtin="gradient" type="2d" mark="edge" height="480" width="640" rgb1=".3 .4 .5"/>
        <material name="tex_rgb" reflectance="0.05" texture="tex_rgb" texrepeat="1 1" texuniform="false"/>
    </asset>

    <worldbody>
        <geom type="plane" size="5 5 2" rgba="1 1 1 1" material="tex_rgb"/>
    </worldbody>
</mujoco>
"""
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

@vikashplus vikashplus added the bug Something isn't working label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant