Preserve time when recompiling a model.

Fixes #1890.

PiperOrigin-RevId: 662084324
Change-Id: I6aed40761cee5044e63426935d102123db295b25
This commit is contained in:
Alessio Quaglino
2024-08-12 07:59:53 -07:00
committed by Copybara-Service
parent d3a976e10d
commit 648fd56ed1
2 changed files with 5 additions and 0 deletions
+2
View File
@@ -851,6 +851,7 @@ TEST_F(MujocoTest, PreserveState) {
// step models
mj_step(model, data);
mj_step(m_expected, d_expected);
EXPECT_THAT(data->time, model->opt.timestep);
// detach subtree
mjsBody* body = mjs_findBody(spec, "detachable");
@@ -877,6 +878,7 @@ TEST_F(MujocoTest, PreserveState) {
// compile new model
mj_recompile(spec, 0, model, data);
EXPECT_THAT(model, NotNull());
EXPECT_THAT(data->time, model->opt.timestep);
// compare qpos
EXPECT_EQ(model->nq, m_expected->nq);