utiasDSL / safe-control-gym

PyBullet CartPole and Quadrotor environments—with CasADi symbolic a priori dynamics—for learning-based control and RL
https://www.dynsyslab.org/safe-robot-learning/
MIT License
637 stars 132 forks source link

Vectorized Environment for RARL controller #160

Closed XilunZhangRobo closed 1 month ago

XilunZhangRobo commented 2 months ago

Hi Thanks for the amazing work! I am currently running the rarl controller for quadrotor control, however, when I tried to increase the n_workers above 1, it raises an error: AttributeError: 'list' object has no attribute 'tolist'.

Also I have noticed that Here(https://github.com/utiasDSL/safe-control-gym/blob/c8c5c75f8a417e98777a28f02aa0d3720d238c4d/safe_control_gym/envs/env_wrappers/vectorized_env/subproc_vec_env.py#L113C9-L113C76), the function has two outputs, but in the set_attr , it changes to three.

Thanks for the help!

Here is the full error message: File "/safe-control-gym/safe_control_gym/experiments/train_rl_controller.py", line 123, in train() File "/safe-control-gym/safe_control_gym/experiments/train_rl_controller.py", line 54, in train ctrl = make(config.algo, File "/safe-control-gym/safe_control_gym/utils/registration.py", line 125, in make return registry.make(idx, *args, kwargs) File "safe-control-gym/safe_control_gym/utils/registration.py", line 88, in make obj = spec.make(*args, *kwargs) File "/safe-control-gym/safe_control_gym/utils/registration.py", line 69, in make obj = cls(args, kwargs) File "/safe-control-gym/safe_control_gym/controllers/rarl/rarl.py", line 70, in init self.adv_obs_space = self.env.get_attr('adversary_observation_space')[0] File "/safe-control-gym/safe_control_gym/envs/env_wrappers/vectorized_env/vec_env.py", line 189, in get_attr return self.venv.get_attr(attr_name, indices) File "/safe-control-gym/safe_control_gym/envs/env_wrappers/vectorized_env/subproc_vec_env.py", line 113, in get_attr target_remotes, remote_env_indices = self._get_target_envs(indices) File "/safe-control-gym/safe_control_gym/envs/env_wrappers/vectorized_env/subproc_vec_env.py", line 182, in _get_target_envs remote_env_indices = remote_env_indices.tolist() AttributeError: 'list' object has no attribute 'tolist'

adamhall commented 2 months ago

Hey @XilunZhangRobo,

Thanks for posting. I'm not overly familiar with the RL side (and in particular the vectorized envs), but I'll take a look. So I can recreate the issue can you post:

  1. The OS and python version you are using
  2. A list of your installed packaged with their versions, using something like pip list
  3. The exact command you are using to run (along with and config files)

Thanks.

Federico-PizarroBejarano commented 1 month ago

I am going to close this due to inactivity. I can look into this more if there is renewed interest.