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

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

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

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

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

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

ndarray
The vector in global coordinates
Convert a vector from global to body coordinates . Parameters . quaternion The rotation quaternion vec : ndarray The vector in body coordinates ndarray The vector in global coordinates
def body_to_global(q, vec):
    return np.dot(quaternion_matrix(q)[:3, :3], vec)
def body_to_global ( q , vec ) : return np . dot ( quaternion_matrix ( q ) [ : 3 , : 3 ] , 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 body coordinates

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