Take a permanent magnet DC motor because it' easier.
#1: Torque is proportional to current
#2: RPM is proportional to unloaded voltage (tach)
#3. A DC motor acts as a DC generator when externally driven.
A simple way of implementing dynamic braking - short the winding. The
"generator" is operating into the lowest load, itself or the resistance of the windings. Note is says "negative motor torque". it's in the opposite direction of a normal motor.
That said, you can have a 4-quadrant power supply which means you can have +I,-V and -I,+V in addition to +I+V, =OI, -V.
When you have all 4 quadrants available, you can charge batteries, you can coast, you can brake and you can drive.
I built a gantry crane for a model railroad for a client and to stop the motor instantly, I shorted the windings.
I didn't in the 80's, but PWM is generally used to control speed. So, if you apply full voltage to the motor, but with a small duty cycle, you get all the torque the motor can produce at a much lower speed.