Skip to content

Commit c40340f

Browse files
saran-tcopybara-github
authored andcommitted
Expose a handle for the Python viewer.
This change also requires user scripts to explicitly synchronize changes to physics state to the viewer. The Simulate class was reconfigured so that certain UI events are handled during this sync operation, outside of the render loop on the main thread. These correspond to operations that require access to the full mjModel/mjData. To support other, more interactive operations (e.g. camera movements), a new mjvSceneState struct is introduced which captures only the portion of the physics state required for scene re-rendering. The mjvSceneState is updated from mjModel/mjData during the viewer sync operation, and is significantly cheaper than a full mj_copyModel and mj_copyData. Fixes google-deepmind/mujoco#796 PiperOrigin-RevId: 525723636 Change-Id: I57530ea34423b1075ae699ce1c2d988182730ae5
1 parent 8f145c6 commit c40340f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

dm_control/autowrap/header_parsing.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ def _nested_if_else(if_, pred, else_, endif, match_if_true, match_if_false):
8080

8181
# Some common string patterns to suppress.
8282
# ------------------------------------------------------------------------------
83-
(X, LPAREN, RPAREN, LBRACK, RBRACK, LBRACE, RBRACE, SEMI, COMMA, EQUAL, FSLASH,
84-
BSLASH) = list(map(pp.Suppress, "X()[]{};,=/\\"))
83+
(LPAREN, RPAREN, LBRACK, RBRACK, LBRACE, RBRACE, SEMI, COMMA, EQUAL, FSLASH,
84+
BSLASH) = list(map(pp.Suppress, "()[]{};,=/\\"))
85+
X = (pp.Keyword("X") | pp.Keyword("XMJV")).suppress()
8586
EOL = pp.LineEnd().suppress()
8687

8788
# Comments, continuation.

0 commit comments

Comments
 (0)