Skip to content

Can we step a Gym environment faster than real time? #79

Discussion options

You must be logged in to vote

Environments are CPU-based by choice (so that they run the same in sim and on the robot), but for training it is possible to step the simulation faster than real-time, provided the CPU is powerful enough for that. There are two sides to it:

  1. Start the Bullet spine in "stepping" mode: ./tools/bazelisk run -c opt //spines:bullet -- --nb-substeps 5 --spine-frequency 1000.
    • Here the spine runs at 1000 Hz, i.e. with 1 ms time steps.
    • Every action it receives will forward the simulation by 5 steps == 5 ms.
  2. Disable loop frequency regulation in the environment: gym.make("UpkieWheelsEnv-v3", frequency=None)

These two steps are illustrated in ppo_balancer/train.py.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by stephane-caron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant