RobertTLange / gymnax

RL Environments in JAX 🌍
Apache License 2.0
577 stars 54 forks source link

Fixed broken wrapping of angles in acrobot.py #42

Closed keraJLi closed 1 year ago

keraJLi commented 1 year ago

With the current version of Acrobot-v1, an angle could become arbitrarily negative, eventually leading to nans. This is due to a bug in the wrap function of acrobot.py. For example, wrap(-2, -1, 1) gave Array(-2., dtype=float32, weak_type=True), which was probably not intended. I suppose that the error wasn't detected by the tests, but I wasn't sure how to fix that.

keraJLi commented 1 year ago

I also implemented the behavior in the function's comment, which wasn't present before :-)