-
-
Notifications
You must be signed in to change notification settings - Fork 878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix discrete CarRacing-v3 #1253
Fix discrete CarRacing-v3 #1253
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for spotting this issue, could you add a test to check that this works, probably in tests/envs/test_env_implementations.py
I believe that Lunar Lander has a similar continuous=False
, could you add this to the test. You just need to pass valid and invalid action and check that the error occurs
I added a test that checks if continuous actions fail in the discrete setting and discrete actions don't raise any error both for LunarLander-v3 and CarRacing-v3. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making that change @Sebastian-Griesbach
d2dc19f
into
Farama-Foundation:main
@pseudo-rnd-thoughts For how long has this bug existed, do we need to list it in the environment version history Gymnasium/gymnasium/envs/box2d/car_racing.py Lines 192 to 196 in e732459
|
I dont think this changes environment behaviour |
Description
CarRacing-v3 in discrete mode first converts the action to a float value before checking if the action is part of the discrete action-space. This causes an error to be raised.
Minimal example to reproduce this error:
This problem can be fixed simply by moving the float conversion to after the
if self.continuous:
check such that for the discrete caseelse:
the action will still be an integer. And theInvalidAction
error is not raised.Please delete options that are not relevant.
Checklist:
pre-commit
checks withpre-commit run --all-files
(seeCONTRIBUTING.md
instructions to set it up)