RLBench/envs/_quadrocopter/quaternions.py
def global_to_body(q, vec):
    """
    Convert a vector from global to body coordinates.

    Parameters:
    -----------
    q: quaternion
        The rotation quaternion
    vec: ndarray
        The vector in global coordinates

    Returns:
    vec: ndarray
        The vector in body coordinates
    """
    # quaternion_matrix(q)[:3,:3] is a homogenous rotation matrix that
    # rotates a vector by q
    # quaternion_matrix(q)[:3,:3] is rot. matrix from body to global frame
    # its transpose is the trafo matrix from global to body
    # that matrix is multiplied by omega
    return np.dot(quaternion_matrix(q)[:3, :3].transpose(), vec)

    Convert a vector from global to body coordinates.

    Parameters:
    -----------
    q: quaternion
        The rotation quaternion
    vec: ndarray
        The vector in global coordinates

    Returns:
    vec: ndarray
        The vector in body coordinates
    
Convert a vector from global to body coordinates.
Parameters.

quaternion
The rotation quaternion
vec: ndarray
The vector in global coordinates

ndarray
The vector in body coordinates
Convert a vector from global to body coordinates . Parameters . quaternion The rotation quaternion vec : ndarray The vector in global coordinates ndarray The vector in body coordinates
def global_to_body(q, vec):
    return np.dot(quaternion_matrix(q)[:3, :3].transpose(), vec)
def global_to_body ( q , vec ) : return np . dot ( quaternion_matrix ( q ) [ : 3 , : 3 ] . transpose ( ) , vec )
Convert a vector from global to body coordinates.
Convert a vector from global to body coordinates .
"""
    Convert a vector from global to body coordinates.

    Parameters:
    -----------
    q: quaternion
        The rotation quaternion
    vec: ndarray
        The vector in global coordinates

    Returns:
    vec: ndarray
        The vector in body coordinates
    """ # quaternion_matrix(q)[:3,:3] is a homogenous rotation matrix that # rotates a vector by q # quaternion_matrix(q)[:3,:3] is rot. matrix from body to global frame # its transpose is the trafo matrix from global to body # that matrix is multiplied by omega
q
vec