To make them smarter, researchers are teaching robots to feel pain