Self driving algorithm for an active four wheel drive racecar