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

Method get_pose

dm_control/composer/entity.py:417–453  ·  view source on GitHub ↗

Get the position and orientation of this entity relative to its parent. Note that the semantics differ slightly depending on whether or not the entity has a free joint: * If it has a free joint the position and orientation are always given in global coordinates. * If the enti

(self, physics)

Source from the content-addressed store, hash-verified

415 xmat.shape))
416
417 def get_pose(self, physics):
418 """Get the position and orientation of this entity relative to its parent.
419
420 Note that the semantics differ slightly depending on whether or not the
421 entity has a free joint:
422
423 * If it has a free joint the position and orientation are always given in
424 global coordinates.
425 * If the entity is fixed or attached with a different joint type then the
426 position and orientation are given relative to the parent frame.
427
428 For entities that are either attached directly to the worldbody, or to other
429 entities that are positioned at the global origin (e.g. the arena) the
430 global and relative poses are equivalent.
431
432 Args:
433 physics: An instance of `mjcf.Physics`.
434
435 Returns:
436 A 2-tuple where the first entry is a (3,) numpy array representing the
437 position and the second is a (4,) numpy array representing orientation as
438 a quaternion.
439
440 Raises:
441 RuntimeError: If the entity is not attached.
442 """
443 root_joint = mjcf.get_frame_freejoint(self.mjcf_model)
444 if root_joint:
445 position = physics.bind(root_joint).qpos[:3]
446 quaternion = physics.bind(root_joint).qpos[3:]
447 else:
448 attachment_frame = mjcf.get_attachment_frame(self.mjcf_model)
449 if attachment_frame is None:
450 raise RuntimeError(_NO_ATTACHMENT_FRAME)
451 position = physics.bind(attachment_frame).pos
452 quaternion = physics.bind(attachment_frame).quat
453 return position, quaternion
454
455 def set_pose(self, physics, position=None, quaternion=None):
456 """Sets position and/or orientation of this entity relative to its parent.

Callers 14

shift_poseMethod · 0.95
place_propsMethod · 0.45
test_settle_physicsMethod · 0.45
get_featuresFunction · 0.45
test_ghost_propMethod · 0.45
test_ball_positionMethod · 0.45
__call__Method · 0.45

Calls 1

bindMethod · 0.45