Farama-Foundation / SuperSuit

A collection of wrappers for Gymnasium and PettingZoo environments (being merged into gymnasium.wrappers and pettingzoo.wrappers
Other
441 stars 56 forks source link

Error in pad_action_space_v0 when applied to environment with box action space and truncation. #246

Closed TheShenk closed 4 months ago

TheShenk commented 5 months ago

Hello. Thanks for your work. It seems like there error with truncation work in environments with box action space when pad_action_space_v0 is used. Example script:

from pettingzoo.test import parallel_api_test
from pettingzoo.mpe import simple_spread_v3

env = simple_spread_v3.parallel_env(max_cycles=25, continuous_actions=True)
env = pad_action_space_v0(env)

parallel_api_test(env, num_cycles=100)

For me launching will produce "AttributeError: 'NoneType' object has no attribute 'shape'" in dehomogenize_actions.py, line cur_shape = action.shape. Possible explanation of error is line if not self.terminations[agent] or self.truncations[agent]: in base_aec_wrapper.py. It seems like it correct version should be if not (self.terminations[agent] or self.truncations[agent]): - parentheses added. And then None action produced by aec_to_parallel_wrapper will not be processed.