Modify Python simulate so that the Reload button works.
Also allow a `Callable[[], [MjModel, MjData]]` to be provided as an argument to `launch` instead of a fixed MjModel/MjData instance. This allows users to customise the behaviour of the Reload button. Context: https://github.com/deepmind/mujoco/discussions/576#discussioncomment-4161429 PiperOrigin-RevId: 492296268 Change-Id: Ic4b797d2ea8a6967f7e3e7316f2184ea94a86d8b
This commit is contained in:
committed by
Copybara-Service
parent
89185b4af2
commit
9fcf3b0c2e
@@ -17,9 +17,7 @@
|
||||
#include <string>
|
||||
|
||||
#include <simulate.h>
|
||||
#include "raw.h"
|
||||
#include "structs.h"
|
||||
#include <pybind11/detail/common.h>
|
||||
#include <pybind11/pybind11.h>
|
||||
|
||||
namespace mujoco::python {
|
||||
@@ -47,8 +45,9 @@ PYBIND11_MODULE(_simulate, pymodule) {
|
||||
py::call_guard<py::gil_scoped_release>())
|
||||
.def(
|
||||
"load",
|
||||
[](mujoco::Simulate& simulate, MjModelWrapper& m, MjDataWrapper& d) {
|
||||
simulate.load("", m.get(), d.get());
|
||||
[](mujoco::Simulate& simulate, const std::string& path,
|
||||
MjModelWrapper& m, MjDataWrapper& d) {
|
||||
simulate.load(path.c_str(), m.get(), d.get());
|
||||
},
|
||||
py::call_guard<py::gil_scoped_release>())
|
||||
.def("applyposepertubations", &mujoco::Simulate::applyposepertubations,
|
||||
|
||||
Reference in New Issue
Block a user