Aw jeez...
Idiocy.
Safety for human co-workers is one goal. Apparently.
Actually it’s really smart. Pain is the most basic way you learn. You do something, it hurts, you don’t do that again. Think about electrical outlets, almost every kid in America zapped themselves once, and learned not to screw with those little holes in the wall. A pain type learning mechanism is a good way to structure adaptive behavior that will help the robot learn its own limitations without the programmers having to figure out every little possible way a robot can damage itself and program against them.