Fix step timing diagnostics and make compiler errors transient in simulate.

PiperOrigin-RevId: 935675994
Change-Id: I7bc26291fb061e712187e0a6205723fda65b5f46
This commit is contained in:
Yuval Tassa
2026-06-21 11:07:24 -07:00
committed by Copybara-Service
parent 3b08f39747
commit 916695e794
2 changed files with 38 additions and 8 deletions
+11
View File
@@ -290,6 +290,8 @@ void PhysicsLoop(mj::Simulate& sim) {
std::chrono::time_point<mj::Simulate::Clock> syncCPU;
mjtNum syncSim = 0;
int last_run = -1;
// run until asked to exit
while (!sim.exitrequest.load()) {
if (sim.droploadrequest.load()) {
@@ -355,6 +357,15 @@ void PhysicsLoop(mj::Simulate& sim) {
// run only if model is present
if (m) {
// reset timers on transition between running and paused
if (sim.run != last_run) {
if (last_run != -1) {
std::memset(d->timer, 0, sizeof(d->timer));
std::memset(sim.timer_prev_, 0, sizeof(sim.timer_prev_));
}
last_run = sim.run;
}
// running
if (sim.run) {
bool stepped = false;