Install timers by default in Python bindings

PiperOrigin-RevId: 744663306
Change-Id: Ia322ace94d1f269ff9b0275567b2e453acc94843
This commit is contained in:
Yuval Tassa
2025-04-07 03:53:42 -07:00
committed by Copybara-Service
parent 26c14c500e
commit 93251f07d9
2 changed files with 33 additions and 0 deletions
+14
View File
@@ -1083,6 +1083,20 @@ Euler integrator, semi-implicit in velocity.
):
mujoco.mj_forward(self.model, self.data)
def test_timer_installed_by_default(self):
timer_step = mujoco.mjtTimer.mjTIMER_STEP
self.assertEqual(self.data.timer[timer_step].number, 0)
self.assertEqual(self.data.timer[timer_step].duration, 0.0)
mujoco.mj_step(self.model, self.data)
self.assertEqual(self.data.timer[timer_step].number, 1)
duration_1 = self.data.timer[timer_step].duration
self.assertGreater(duration_1, 0.0)
mujoco.mj_step(self.model, self.data, 5)
self.assertEqual(self.data.timer[timer_step].number, 6)
self.assertGreater(self.data.timer[timer_step].duration, duration_1)
def test_mjcb_time(self):
class CallCounter: