Inverse Optimal Control for robot arm motions