cjy1992 / gym-carla

An OpenAI gym wrapper for CARLA simulator
MIT License
520 stars 110 forks source link

when I apply PPO of RL algos to the gym-carla,it will occur that “ RuntimeError: trying to access an expired episode; a new episode was started in the simulation but an object tried accessing the old one.” #16

Open zengsh-cqupt opened 4 years ago

zengsh-cqupt commented 4 years ago

Hi, when I apply PPO of RL algos to the gym-carla,it will occur that “ RuntimeError: trying to access an expired episode; a new episode was started in the simulation but an object tried accessing the old one.” I think the env maybe has some problems,but I don't known that how to fix the env. Can you help me? Thanks. Ddetails are following:

ubnutu18.04 python3.6.2 openai spinningup ppo algo(pytorch,torch=1.3.1)

env = gym.make('carla-v0', params=params) File "/home/ubuntu/anaconda3/envs/spinningup/lib/python3.6/site-packages/gym/envs/registration.py", line 156, in make return registry.make(id, kwargs) File "/home/ubuntu/anaconda3/envs/spinningup/lib/python3.6/site-packages/gym/envs/registration.py", line 101, in make env = spec.make(kwargs) File "/home/ubuntu/anaconda3/envs/spinningup/lib/python3.6/site-packages/gym/envs/registration.py", line 73, in make env = cls(**_kwargs) File "/home/ubuntu/zengsh/gym-carla-master/gym_carla/envs/carla_env.py", line 107, in init self.ego_bp = self._create_vehicle_bluepprint(params['ego_vehicle_filter'], color='49,8,8') File "/home/ubuntu/zengsh/gym-carla-master/gym_carla/envs/carla_env.py", line 321, in _create_vehicle_bluepprint blueprints = self.world.get_blueprint_library().filter(actor_filter) RuntimeError: trying to access an expired episode; a new episode was started in the simulation but an object tried accessing the old one.

cjy1992 commented 3 years ago

Hello, this is because PPO requires parallel simulation, but we currently do not support that. Furthermore, the simulation speed for carla is slow. Thus it is not a good idea to use PPO with carla training.