What is the purpose of a commutator in a DC machine?

Explanation:

The commutator in a DC machine reverses the direction of current in the armature windings, ensuring that the torque produced in the machine is always in the same direction.