How to prevent gripper holding too tight?

I think I have run across some code that involved calculating when you get close to the stall rate of a motor. Don't ask me how to do it, but I have seen it somewhere in these forums, and it seems that it wouldn't involve any further purchases.