MCPcopy Index your code
hub / github.com/google-deepmind/dm_control / testSetPose

Method testSetPose

dm_control/composer/entity_test.py:337–360  ·  view source on GitHub ↗
(self, position, quaternion, freejoint)

Source from the content-addressed store, hash-verified

335 freejoint=[False, True],
336 ))
337 def testSetPose(self, position, quaternion, freejoint):
338 # Setup entity.
339 test_arena = arena.Arena()
340 subentity = TestEntity(name='subentity')
341 frame = test_arena.attach(subentity)
342 if freejoint:
343 frame.add('freejoint')
344
345 physics = mjcf.Physics.from_mjcf_model(test_arena.mjcf_model)
346
347 if quaternion is None:
348 ground_truth_quat = _NO_ROTATION
349 else:
350 ground_truth_quat = quaternion
351
352 if position is None:
353 ground_truth_pos = np.zeros(shape=(3,))
354 else:
355 ground_truth_pos = position
356
357 subentity.set_pose(physics, position=position, quaternion=quaternion)
358
359 np.testing.assert_allclose(physics.bind(frame).xpos, ground_truth_pos)
360 np.testing.assert_allclose(physics.bind(frame).xquat, ground_truth_quat)
361
362 @parameterized.parameters(*_param_product(
363 original_position=[[-2, -1, -1.], [1., 0., -1.]],

Callers

nothing calls this directly

Calls 6

TestEntityClass · 0.85
from_mjcf_modelMethod · 0.80
attachMethod · 0.45
addMethod · 0.45
set_poseMethod · 0.45
bindMethod · 0.45

Tested by

no test coverage detected