Skip to content

Fix passive viewer pause example - #3971

Open
yonatantussa wants to merge 1 commit into
google-deepmind:mainfrom
yonatantussa:fix-passive-viewer-pause-example
Open

yonatantussa wants to merge 1 commit into
google-deepmind:mainfrom
yonatantussa:fix-passive-viewer-pause-example

Conversation

@yonatantussa

Copy link
Copy Markdown

The passive-viewer pause example in the Python guide defines paused at module scope, so nonlocal paused raises a SyntaxError. This fix changes uses global paused and unindents the viewer.sync() line to move it outside of the pause check so changes made in the viewer reach the model while the simulation time is frozen.

Tested with Python 3.12 and MuJoCo 3.17.0. Reproduced the original error and verified with Space presses that physics pauses and resumes while the viewer continues syncing.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant