Lots of ways to do this.
Does the motors have a dedicated controller/driver?
Or just a driver controller by the micro-processor?
I assume the driver is an H-bridge. Are there current sensor resistors on the bottom legs of the H-bridge?
This would be the first step to sensor motor current. Typically these are fairly low values, to keep the voltage drop small, so need an op-amp to increase the voltage. Then either a comparator in hardware or ADC processor input to sensor the current limit. The processor code would then stop the motor and not allow movement to the direction the motor was moving until the current limit is not exceeded.