Namespace Gym.Environments.Envs.Box2D
Classes
- BipedalWalkerEnv
BipedalWalker-v3 and BipedalWalkerHardcore-v3 in one class, as in Gymnasium: a four-joint walker (a hull, two legs of two segments each) that must cross 200 terrain steps to the right. Actions are the four motors' commands in
Box(-1, 1, (4,), float32)(hip, knee, hip, knee): the sign picks the motor's direction at full speed, the magnitude its torque. The observation is 24 float32 values: the hull's angle and velocities, each joint's angle and speed, each lower leg's ground contact, and ten lidar distances. Step for step and frame for frame what Gymnasium'sBipedalWalkercomputes on Box2D 2.3, errors included.
- BipedalWalkerEnvOptions
The keyword arguments of BipedalWalkerEnv's constructor as a typed record (DR-34), generated from the constructor so it cannot drift from it. A property that is set becomes a keyword argument by its Python name; one left unset is not passed, so
makekeeps the registered spec's value and the constructor its default.
- BipedalWalkerHardcoreEnv
Gymnasium's
BipedalWalkerHardcore: a class that only refuses to be built, pointing atmake("BipedalWalker-v3", hardcore=True)(DR-32).
- BipedalWalkerHeuristics
Gymnasium's
BipedalWalkerHeuristics: the hand-written gait that walks BipedalWalkerEnv, a state machine over three phases (stand on one leg while the other swings up, put the other leg down, push off) that alternates the legs and steers each joint toward a target angle with a proportional-derivative term, plus a hull tilt correction and vertical damping. It walks the normal terrain slowly and falls in the hardcore one.
- Car
Gymnasium's
car_dynamics.Car: a top-down car of a four-polygon hull and four wheels on limited revolute joints, rear-wheel drive. Each Step(double) turns the front wheels toward their steering target, spins the wheels from gas and brakes, and applies each wheel's friction force (more on road tiles than on grass), leaving skid marks when a wheel slides.
- CarRacingEnv
CarRacing-v3: a top-down race on a random closed track, learned from pixels. The observation is a 96×96 RGB image of the car and the track around it (with the speed, ABS, steering and gyro indicators and the score at the bottom); the reward is -0.1 per frame plus 1000/N for each of the track's N tiles first touched, and -100 when the car leaves the playfield. Continuous actions are
Box([-1, 0, 0], [1, 1, 1], float32)(steer, gas, brake); discrete onesDiscrete(5)(nothing, right, left, gas, brake). Step for step and frame for frame what Gymnasium'sCarRacingcomputes on Box2D 2.3.
- CarRacingEnv.RoadTile
A track tile: its static sensor body and the attributes Gymnasium hangs on it (
color,road_visited,road_friction,idx). The body's user data is this object, as Python'st.userData = tlets the FrictionDetector recognize a tile.
- CarRacingEnvOptions
The keyword arguments of CarRacingEnv's constructor as a typed record (DR-34), generated from the constructor so it cannot drift from it. A property that is set becomes a keyword argument by its Python name; one left unset is not passed, so
makekeeps the registered spec's value and the constructor its default.
- CarRacingInfo
CarRacing's info (CarRacingEnv, CarRacing-v3), typed (DR-91, DR-95):
{}on every reset and on most steps, and{"lap_finished": ...}on the step that ends an episode by finishing the lap or leaving the playfield. LunarLander and BipedalWalker send{}and have no record.
- CarWheel
A wheel of Car: its Box2D body with the attributes Gymnasium hangs on it (
wheel_rad,gas,brake,steer,phase,omega, the skid state,joint,tiles). The body's user data is this object, as Python'sw.userData = wmakes the contact listener find the wheel.
- FrictionDetector
Gymnasium's
FrictionDetector: CarRacing's contact listener. Any contact with a tile recolours the tile with the road colour; a wheel's contact adds the tile to the wheel's tiles (removed when it ends), and a tile's first visit pays 1000/N to the score and may complete the lap.
- LunarLanderContinuousEnv
Gymnasium's
LunarLanderContinuous: a class that only refuses to be built, pointing atmake("LunarLander-v3", continuous=True)(DR-32).
- LunarLanderEnv
LunarLander-v3 and LunarLanderContinuous-v3 in one class, as in Gymnasium: a lander dropped from the top of the screen with a random push, which must touch down on the pad between the flags. Discrete actions fire nothing, the left engine, the main engine or the right engine (0 to 3); continuous actions throttle the main engine and the side engines (
Box(-1, 1, (2,), float32)). Step for step and frame for frame what Gymnasium'sLunarLandercomputes on Box2D 2.3, errors included.
- LunarLanderEnvOptions
The keyword arguments of LunarLanderEnv's constructor as a typed record (DR-34), generated from the constructor so it cannot drift from it. A property that is set becomes a keyword argument by its Python name; one left unset is not passed, so
makekeeps the registered spec's value and the constructor its default.
- Particle
A skid mark (Gymnasium's
car_dynamics.Particle): the polyline a skidding wheel leaves, black on the road and mud-coloured on grass, extended point by point while the wheel keeps skidding on the same ground (up to 30 points).
Enums
- LunarLanderDiscreteActions
0.2's names for LunarLander's four discrete actions, kept so 0.2 code compiles until 2.0 (DR-58). The values are Gymnasium's action indices, so
env.Step((int)LunarLanderDiscreteActions.FireMainEngine)fires the main engine of LunarLanderEnv as 0.2's did.