diff --git a/python/mujoco/simulate.cc b/python/mujoco/simulate.cc index 1bbe5802..ec9f2dd3 100644 --- a/python/mujoco/simulate.cc +++ b/python/mujoco/simulate.cc @@ -31,6 +31,7 @@ namespace mujoco::python { namespace { +using UIAdapter = mujoco::GlfwAdapter; namespace py = ::pybind11; template @@ -196,7 +197,7 @@ PYBIND11_MODULE(_simulate, pymodule) { py::object pert, bool fully_managed, py::object key_callback) { return std::make_unique( - std::make_unique>( + std::make_unique>( key_callback), scn, cam, opt, pert, fully_managed); })) diff --git a/python/mujoco/viewer.py b/python/mujoco/viewer.py index ccf7243b..9784691f 100644 --- a/python/mujoco/viewer.py +++ b/python/mujoco/viewer.py @@ -236,7 +236,7 @@ def _physics_loop(simulate: _Simulate, loader: Optional[_InternalLoaderType]): assert d is not None if simulate.run: # Record CPU time at start of iteration. - startcpu = glfw.get_time() + startcpu = time.time() elapsedcpu = startcpu - synccpu elapsedsim = d.time - syncsim @@ -281,8 +281,8 @@ def _physics_loop(simulate: _Simulate, loader: Optional[_InternalLoaderType]): refreshtime = SIM_REFRESH_FRACTION / simulate.refresh_rate # Step while sim lags behind CPU and within refreshtime. while (((d.time - syncsim) * slowdown < - (glfw.get_time() - synccpu)) and - ((glfw.get_time() - startcpu) < refreshtime)): + (time.time() - synccpu)) and + ((time.time() - startcpu) < refreshtime)): # Measure slowdown before first step. if not measured and elapsedsim: simulate.measured_slowdown = elapsedcpu / elapsedsim @@ -349,7 +349,6 @@ def _launch_internal( notify_loaded = ( lambda: handle_return.put_nowait(Handle(simulate, scn, cam, opt, pert))) - side_thread = None if run_physics_thread: side_thread = threading.Thread( target=_physics_loop, args=(simulate, loader)) @@ -427,6 +426,7 @@ def launch_passive( if __name__ == '__main__': + # pylint: disable=g-bad-import-order from absl import app # pylint: disable=g-import-not-at-top from absl import flags # pylint: disable=g-import-not-at-top diff --git a/src/engine/engine_vis_state.c b/src/engine/engine_vis_state.c index 36409a17..f2d0eb25 100644 --- a/src/engine/engine_vis_state.c +++ b/src/engine/engine_vis_state.c @@ -263,9 +263,9 @@ void mjv_updateSceneState(const mjModel* m, mjData* d, const mjvOption* opt, mjvSceneState* scnstate) { // Check that mjModel sizes haven't changed. #define X(var) -#define XMJV(var) \ - if (scnstate->model.var != m->var) { \ - mjERROR("m->%s changed", #var); \ +#define XMJV(var) \ + if (scnstate->model.var != m->var) { \ + mjERROR("m->%s changed: %d vs %d", #var, scnstate->model.var, m->var); \ } MJMODEL_INTS #undef XMJV