Programming a robot from scratch is a large scale challenge. To simplify the task, a physics simulator can be used which makes a real robot obsolete. Instead of testing out a control algorithm on a mechanical device, the AI controller works in a simulation. A standard software for realizing a realistic environment is Box2D. It can be used to program a variety of games from simple top down car physics, to robot arms, jump'n'run games and even walking robots .
The Box2D engine itself is not able to calculate the next actions of the intelligent system. It will only provide the environment. In the easiest case, a simulated soccer robot kicks the ball and the physics engine calculates the trajectory of the ball. Box2d-like physics engines are utilized for normal game programming, but are also relevant for AI programming. The famous OpenAI gym environment is using for some simulations the Box2d engine.