import math


def quaternionToRpy(q0, q1, q2, q3):
    """ Compute the roll, pitch and yaw angles corresponding to drone
        quaternion. Angles are in radian."""
    roll = math.atan2(2.0 * (q3*q2 + q0*q1), 1.0 - 2.0 * (q1*q1 + q2*q2))
    pitch = math.asin(2.0 * (q2*q0 - q3*q1))
    yaw = math.atan2(2.0 * (q3*q0 + q1*q2), - 1.0 + 2.0 * (q0*q0 + q1*q1))

    return[roll, pitch, yaw]