Skip to content

classic-v1: continuous actions, and frames only on request - #10

Merged
tactino merged 2 commits into
mainfrom
fix/classic-continuous-actions
Sep 29, 2026
Merged

tactino merged 2 commits into
mainfrom
fix/classic-continuous-actions

Conversation

@tactino

@tactino tactino commented Sep 28, 2026

Copy link
Copy Markdown
Member

classic-v1 could not run its continuous tasks. ClassicEnv.step cast every action to an integer, so Pendulum-v1 and MountainCarContinuous-v0 received truncated torques and forces.

  • A discrete action space still takes an integer. A continuous one now takes a float array of the space's shape and dtype.
  • Rendering is off by default, as in the MuJoCo family, and --env.render turns it on. It used to render and send a frame every step, whether or not anything read it.

tests/test_classic_env.py adds five tests:

  • a Pendulum torque of 1.5 moves the pendulum as 1.5 would, where an integer cast would apply 1.0
  • the action is reduced to the space's shape
  • CartPole still takes an integer
  • no frames by default
  • frames when asked

The tests skip where the classic extra is not installed, which is the case in CI's default sync. Locally, with --extra classic, all five pass, and the full suite gives 134 passed and 14 skipped.

PlugRL's E44 needs this change: a Python control run on Pendulum-v1, beside a C++ env client running the same task.

ClassicEnv cast every action to an integer, so the continuous classic-control
tasks (Pendulum-v1, MountainCarContinuous-v0) could not run. A discrete space
still takes an integer; a continuous one now takes a float array of the
space's shape and dtype.

It also rendered a frame every step and sent it, whether or not anything read
it. Rendering is now off by default, as in the MuJoCo family, and
--env.render turns it on.

tests/test_classic_env.py covers both; it skips where the classic extra is
not installed, as CI's default sync is.
@tactino
tactino merged commit 3ea0609 into main Sep 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant