This was an interesting article, but looking at the current state of AI, I'm wondering how we could possibly give an AI the capacity to feel pain. A motherboard contains silicon chips and capacitors and resistors, and they will all silently melt into a numb oblivion if you set them on fire.
It could be useful to spread sensors around the surface of a mobile robot. They could detect conditions that might cause injury: temperature, piercing or tearing the external covering, sudden deceleration, extreme pressure changes. One could then write a reflex mechanism that pulls the affected body part away, and have that command override all of its other routines (like path finding, grasping objects, manipulating objects).
This would be similar to how nerves in the arm route pain signals (overloads) to the central nervous system, which responds quickly with a reflex to pull the arm back--long before the brain ever gets the signal. But would the AI really "feel" pain?
Aside from physical pain, there's the idea of mental pain. If you continually put blockades in front of a mobile robot so that it can never reach its goal destination, it's not going to feel "frustrated" or "angry." But perhaps you could change its reinforcement learning algorithm to recognize the futility of the situation, have it "time out" after some configurable period of time, and then switch to a different, more "chaotic" planning algorithm that would start investigating other areas of the robot's environment for possible solutions. I suppose you could even have that strategy time out after a while and instruct the AI to verbally request "help," perhaps using a stressed voice pattern.
But all of these approaches would simply mimic human behavior. It might look like the robot is experiencing physical or mental pain, but it would honestly just be a simulation. It wouldn't be real. Outward manifestations and simulations of pain would seem somewhat meaningless unless and until they became truly meaningful to the machine itself. And we won't reach that point until we figure out how to make machines sentient.