Skip to content

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

Open
@vikashplus

Description

@vikashplus

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions