Skip to content

Commit ed7cff3

Browse files
Added joint overlay
Joint overlay added with "J"
1 parent 5db4db5 commit ed7cff3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

mujoco_viewer/mujoco_viewer.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def __init__(self, model, data):
2222
self._paused = False
2323
self._transparent = False
2424
self._contacts = False
25+
self._joints = False
2526
self._render_every_frame = True
2627
self._image_idx = 0
2728
self._image_path = "/tmp/frame_%07d.png"
@@ -108,7 +109,9 @@ def _key_callback(self, window, key, scancode, action, mods):
108109
elif key == glfw.KEY_C:
109110
self._contacts = not self._contacts
110111
self.vopt.flags[mujoco.mjtVisFlag.mjVIS_CONTACTPOINT] = self._contacts
111-
self.vopt.flags[mujoco.mjtVisFlag.mjVIS_CONTACTFORCE] = self._contacts
112+
elif key == glfw.KEY_J:
113+
self._joints = not self._joints
114+
self.vopt.flags[mujoco.mjtVisFlag.mjVIS_JOINT] = self._joints
112115
# Display coordinate frames
113116
elif key == glfw.KEY_E:
114117
self.vopt.frame = 1 - self.vopt.frame
@@ -369,6 +372,10 @@ def add_overlay(gridpos, text1, text2):
369372
topleft,
370373
"[C]ontact forces",
371374
"On" if self._contacts else "Off")
375+
add_overlay(
376+
topleft,
377+
"[J]oints",
378+
"On" if self._joints else "Off")
372379
add_overlay(
373380
topleft,
374381
"T[r]ansparent",

0 commit comments

Comments
 (0)