(self, physics, xmat)
Transforms another entity's `xmat` into this entity's local frame.

    This function takes another entity's (E) xmat, which is an SO(3) matrix
    from E's frame to the world frame, and turns it to a matrix that transforms
    from E's frame into this entity's local frame.

    Args:
      physics: An `mjcf.Physics` instance.
      xmat: A NumPy array of shape (3, 3) or (9,) that represents another
        entity's xmat.

    Returns:
      The `xmat` reexpressed in this entity's local frame. The returned
      np.array has the same shape as np.asarray(xmat).

    Raises:
      ValueError: if `xmat` does not have shape (3, 3) or (9,).
Transforms another entity's `xmat` into this entity's local frame.
Transforms another entity s xmat into this entity s local frame .
def global_xmat_to_local_frame(self, physics, xmat):
    """Transforms another entity's `xmat` into this entity's local frame.

    This function takes another entity's (E) xmat, which is an SO(3) matrix
    from E's frame to the world frame, and turns it to a matrix that transforms
    from E's frame into this entity's local frame.

    Args:
      physics: An `mjcf.Physics` instance.
      xmat: A NumPy array of shape (3, 3) or (9,) that represents another
        entity's xmat.

    Returns:
      The `xmat` reexpressed in this entity's local frame. The returned
      np.array has the same shape as np.asarray(xmat).

    Raises:
      ValueError: if `xmat` does not have shape (3, 3) or (9,).
    """
    xmat = np.asarray(xmat)

    input_shape = xmat.shape
    if xmat.shape == (9,):
      xmat = np.reshape(xmat, (3, 3))

    self_xmat = np.reshape(physics.bind(self.root_body).xmat, (3, 3))
    if xmat.shape == (3, 3):
      return np.reshape(np.dot(self_xmat.T, xmat), input_shape)
    else:
      raise ValueError('`xmat` should have shape (3, 3) or (9,): got {}'.format(
          xmat.shape))
def global_xmat_to_local_frame ( self , physics , xmat ) : xmat = np . asarray ( xmat ) input_shape = xmat . shape if xmat . shape == ( 9 , ) : xmat = np . reshape ( xmat , ( 3 , 3 ) ) self_xmat = np . reshape ( physics . bind ( self . root_body ) . xmat , ( 3 , 3 ) ) if xmat . shape == ( 3 , 3 ) : return np . reshape ( np . dot ( self_xmat . T , xmat ) , input_shape ) else : raise ValueError ( '`xmat` should have shape (3, 3) or (9,): got {}' . format ( xmat . shape ) )