Learning while preventing mechanical failure due to random motions