DC Motor torque control

If you have a means of measuring the motor current then you can directly monitor (theoretical) torque since this
is proportional to current (ignoring friction, magnetic saturation etc). Thus by monitoring current and adjusting
drive PWM you can set a given torque.

Note that you have to measure average current if using PWM since the current will oscillate about an average.