Check out the naoLoop Handbook