(self)
| 625 | np.testing.assert_array_equal(spec.maximum, [mujoco.mjMAXVAL, 2.0]) |
| 626 | |
| 627 | def testNstep(self): |
| 628 | # Make initial state. |
| 629 | with self._physics.reset_context(): |
| 630 | self._physics.data.qvel[0] = 1 |
| 631 | self._physics.data.qvel[1] = 1 |
| 632 | initial_state = self._physics.get_state() |
| 633 | |
| 634 | # step() 4 times. |
| 635 | for _ in range(4): |
| 636 | self._physics.step() |
| 637 | for_loop_state = self._physics.get_state() |
| 638 | |
| 639 | # Reset state, call step(4). |
| 640 | with self._physics.reset_context(): |
| 641 | self._physics.set_state(initial_state) |
| 642 | self._physics.step(4) |
| 643 | nstep_state = self._physics.get_state() |
| 644 | |
| 645 | np.testing.assert_array_equal(for_loop_state, nstep_state) |
| 646 | |
| 647 | # Repeat test with with RK4 integrator: |
| 648 | self._physics.model.opt.integrator = enums.mjtIntegrator.mjINT_RK4 |
| 649 | |
| 650 | # step() 4 times. |
| 651 | with self._physics.reset_context(): |
| 652 | self._physics.set_state(initial_state) |
| 653 | for _ in range(4): |
| 654 | self._physics.step() |
| 655 | for_loop_state_rk4 = self._physics.get_state() |
| 656 | |
| 657 | # Reset state, call step(4). |
| 658 | with self._physics.reset_context(): |
| 659 | self._physics.set_state(initial_state) |
| 660 | self._physics.step(4) |
| 661 | nstep_state_rk4 = self._physics.get_state() |
| 662 | |
| 663 | np.testing.assert_array_equal(for_loop_state_rk4, nstep_state_rk4) |
| 664 | |
| 665 | if __name__ == '__main__': |
| 666 | absltest.main() |
nothing calls this directly
no test coverage detected