For DC motors the torque is linked to the current. Measure the current and you can estimate the torque in real time.
There are very simple equations for DC motors given below.
[ This connection between torque and current does _not_ apply to stepper motors, note. ]
DC motor:
torque = motor_constant x current - friction_torque [ units being newton-metres and amps ]
voltage = motor_constant x no_load_speed [ units being volts and radians/second ]
The motor constant can be given in Nm/A or in Vs/rad, these are completely equivalent, believe it or not.
Sometimes the reciprocal of the motor constant is given - units being rad/s/V, or A/(Nm). Sometimes
rpm is used instead of rad/s.