Make a raceway or train track on a carpet by laying down books of equal thickness side by side to make a smooth lane, or use pieces of plywood or two-by-fours. (Your raceway can be any length and can be straight or have turns.)
This will transform the carpet into a smooth surface for racing toys with wheels.