Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Environments

An environment defines the interaction loop an agent learns from: reset to an initial observation, apply an action, and return the next observation and reward. ModuRL represents one environment with Gym and a batch of environments with MultiGym.

The getting-started example uses CartPoleV1 for individual environments and VectorizedGymWrapper to train from several of them at once.

modurl_gym includes these Gymnasium-compatible environments:

ModuleEnvironmentAction spaceObservation shape
classic_control::acrobotAcrobotV1Discrete, 3 actions[6]
classic_control::cartpoleCartPoleV1Discrete, 2 actions[4]
classic_control::mountain_carMountainCarV0Discrete, 3 actions[2]
classic_control::pendulumPendulumV1Continuous [1][3]
box_2d::bipedal_walkerBipedalWalkerV3Continuous [4][24]
box_2d::lunar_landerLunarLanderV3Discrete, 4 actions[8]

BipedalWalkerV3 implements the standard environment with uneven grass terrain; the hardcore obstacle variant is not included.

These structs expose Gymnasium’s unwrapped dynamics. Registry time limits are applied explicitly with TimeLimitGym: use 500 steps for AcrobotV1, 200 for PendulumV1, and the registry horizon appropriate to the other environment. Keeping the limit in a wrapper makes truncation visible and composable.

modurl_mujoco provides the Gymnasium v5 AntV5, HalfCheetahV5, HopperV5, HumanoidV5, and Walker2dV5 environments. See that crate’s README for model, installation, metadata, and parity details.

Read Use Vectorized Environments before writing manual training or evaluation loops. Read Build a Custom Gym Environment when you need a new environment type.