def unpack_quaternion_msg(msg, stamped=False):
    """ Get coordinates from a Quaternion(Stamped) message. """
    if stamped:
        q = msg.quaternion
    else:
        q = msg

    return q.w, q.x, q.y, q.z