Self-teaching robot arm