Merge branch 'deepmind:main' into usd-integration

This commit is contained in:
Abhishek Joshi
2023-09-06 14:04:36 -05:00
committed by GitHub
122 changed files with 4019 additions and 1524 deletions
+1 -1
View File
@@ -948,7 +948,7 @@ Euler integrator, semi-implicit in velocity.
def test_can_raise_error(self):
self.data.pstack = self.data.narena
with self.assertRaisesRegex(mujoco.FatalError,
r'\AmjData stack overflow'):
r'\Amj_stackAlloc: insufficient memory:'):
mujoco.mj_forward(self.model, self.data)
def test_mjcb_time(self):
+2 -1
View File
@@ -31,6 +31,7 @@
namespace mujoco::python {
namespace {
using UIAdapter = mujoco::GlfwAdapter;
namespace py = ::pybind11;
template <typename T, int N>
@@ -196,7 +197,7 @@ PYBIND11_MODULE(_simulate, pymodule) {
py::object pert, bool fully_managed,
py::object key_callback) {
return std::make_unique<SimulateWrapper>(
std::make_unique<UIAdapterWithPyCallback<mujoco::GlfwAdapter>>(
std::make_unique<UIAdapterWithPyCallback<UIAdapter>>(
key_callback),
scn, cam, opt, pert, fully_managed);
}))
+4 -4
View File
@@ -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