CartPole
superdex_gym/CartPole-v0 · superdex.lab.gym.envs.benchmarks.cartpole_env.CartPoleEnv

Description
CartPole balances a pole on a cart moving along a linear rail. It is the smallest
SuperDex Gym environment and the best smoke test: it needs only the benchmark scene
assets (assets/benchmarks/cart_pole/) and no bot asset.
Action Space
The action is a (1,) Box. The single element control is bounded [-3.0, 3.0],
scaled by 100, and applied as a linear force on the prismatic cart DOF. When
actuate_on_pole=True it is applied as a torque on the revolute pole DOF instead.
Observation Space
The observation is a (4,) Box, flattened in alphabetical key order:
| Index | Key | Meaning |
|---|---|---|
| 0 | angular_vel | Angular velocity of the pole [rad/s] |
| 1 | linear_vel | Linear velocity of the cart [m/s] |
| 2 | position | Cart position along the rail [m] |
| 3 | vertical_ang | Vertical angle of the pole [rad] |
Rewards
A single term upright_reward of 1.0 is given for every step while the pole is
upright (abs(vertical_ang) <= 0.2), and 0.0 otherwise.
Starting State
The scene is restored to its captured initial state, then uniform reset noise scaled
by reset_noise_scale (default 0.1) is added to the cart and pole pose and
velocity.
Episode End
The episode terminates (terminated_reason = "Pole angle exceeded threshold") once
the pole leaves the upright band. It truncates at steps_per_episode.
Arguments
In addition to the shared MochiEnvCfg fields (see the Authoring guide's base
configuration section), CartPoleEnvCfg accepts:
| Field | Default | Meaning |
|---|---|---|
control_frequency | 25 | Control frequency [Hz] |
simulation_frequency | 50 | Simulation frequency [Hz]; 2 substeps per control step |
steps_per_episode | 1000 | Truncation limit |
reset_noise_scale | 0.1 | Scale of the uniform reset noise |
render_control | True | Stored on the environment but currently unused |
actuate_on_pole | False | Apply the control force to the pole instead of the cart |
use_damping | True | Apply joint viscous friction |
use_gravity | True | Apply gravity |
free_pole | False | Remove the pole's joint limits |
Scene identity
uid_fields = (use_damping, use_gravity, free_pole). When use_shared_scenes=True,
environments in the same process with matching values share one physics scene.
Variants
CartPoleActuateOnPole
superdex_gym/CartPoleActuateOnPole-v0
| Field | Value |
|---|---|
actuate_on_pole | True |