Add option to only sync the state to improve sync performance in passive mode.
By default this option is off, which preserves the current behavior of syncing all of `mjModel` and `mjData`. PiperOrigin-RevId: 776498017 Change-Id: I02127c9397efbabebb89b0e0d139b00b6e665d35
This commit is contained in:
committed by
Copybara-Service
parent
8f6a13aa8f
commit
09f7154e57
@@ -336,6 +336,7 @@ PYBIND11_MODULE(_simulate, pymodule) {
|
||||
CallIfNotNull(&mujoco::Simulate::LoadMessageClear),
|
||||
py::call_guard<py::gil_scoped_release>())
|
||||
.def("sync", CallIfNotNull(&mujoco::Simulate::Sync),
|
||||
py::arg("state_only") = false,
|
||||
py::call_guard<py::gil_scoped_release>())
|
||||
.def("add_to_history", CallIfNotNull(&mujoco::Simulate::AddToHistory),
|
||||
py::call_guard<py::gil_scoped_release>())
|
||||
|
||||
@@ -230,10 +230,10 @@ class Handle:
|
||||
return sim.lock()
|
||||
return contextlib.nullcontext()
|
||||
|
||||
def sync(self):
|
||||
def sync(self, state_only: bool = False):
|
||||
sim = self._get_sim()
|
||||
if sim is not None:
|
||||
sim.sync() # locks internally
|
||||
sim.sync(state_only) # locks internally
|
||||
|
||||
def update_hfield(self, hfieldid: int):
|
||||
sim = self._get_sim()
|
||||
|
||||
Reference in New Issue
Block a user