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:
Matija Kecman
2025-06-27 02:48:58 -07:00
committed by Copybara-Service
parent 8f6a13aa8f
commit 09f7154e57
6 changed files with 50 additions and 29 deletions
+4 -3
View File
@@ -54,9 +54,10 @@ class Simulate {
std::unique_ptr<PlatformUIAdapter> platform_ui_adapter,
mjvCamera* cam, mjvOption* opt, mjvPerturb* pert, bool is_passive);
// Synchronize mjModel and mjData state with UI inputs, and update
// visualization.
void Sync();
// Synchronize state with UI inputs, and update visualization. If state_only
// is false mjData and mjModel will be updated, otherwise only the subset of
// mjData corresponding to mjSTATE_INTEGRATION will be synced.
void Sync(bool state_only = false);
void UpdateHField(int hfieldid);
void UpdateMesh(int meshid);