Refactor viewer initialization and protocol.
Introduced a ViewerConfig dataclass to encapsulate common viewer window parameters. The NativeViewer now accepts a ViewerConfig and no longer requires a model at initialization. The Viewer protocol has been updated to include a close method (renamed from stop) and an upload_image method. Added checks for None models/data in studio event handling. PiperOrigin-RevId: 939631378 Change-Id: Ibc07d0e775efa0d79ce5552ee52102e943a9b290
This commit is contained in:
committed by
Copybara-Service
parent
79f6deac99
commit
f594778813
@@ -175,8 +175,9 @@ def handle_step_control_keyboard_events(
|
||||
step_control.set_pause_state(sim.PauseState.UNPAUSED)
|
||||
return True
|
||||
elif pressed(imgui.Key.Backspace):
|
||||
mujoco.mj_resetData(model, data)
|
||||
mujoco.mj_forward(model, data)
|
||||
if model is not None and data is not None:
|
||||
mujoco.mj_resetData(model, data)
|
||||
mujoco.mj_forward(model, data)
|
||||
return True
|
||||
elif pressed(imgui.Key.Minus):
|
||||
ux.set_speed_index(step_control, ux_state, ux_state.speed_index + 1)
|
||||
|
||||
Reference in New Issue
Block a user