Line following with error handling