Autonomous-Driving-in-Carla-using-Deep-Reinforcement-Learning icon indicating copy to clipboard operation
Autonomous-Driving-in-Carla-using-Deep-Reinforcement-Learning copied to clipboard

Not able to run discrete or continous file

Open SExpert12 opened this issue 1 year ago • 0 comments

Hi, When I run the continous file I got this error:

################################################################################################## python continuous_driver.py --exp-name ppo --town Town07 ################################################################################################## Couldn't import Carla egg properly pygame 2.1.2 (SDL 2.0.16, Python 3.8.10) Hello from the pygame community. https://www.pygame.org/contribute.html ERROR:root:Connection has been refused by the server.

Exit Traceback (most recent call last): File "continuous_driver.py", line 330, in runner() File "continuous_driver.py", line 146, in runner env = CarlaEnvironment(client, world,town) UnboundLocalError: local variable 'client' referenced before assignment

##################################################################################################

As I am getting error related to egg file. I also add these lines in the continous flie: try: import pygame except ImportError: raise RuntimeError('cannot import pygame, make sure pygame package is installed')

try: import numpy as np except ImportError: raise RuntimeError('cannot import numpy, make sure numpy package is installed') except ImportError: raise RuntimeError('cannot import pygame, make sure pygame package is installed')

Calra module

try: sys.path.append(glob.glob('../carla/dist/carla-*%d.%d-%s.egg' % ( sys.version_info.major, sys.version_info.minor, 'win-amd64' if os.name == 'nt' else 'linux-x86_64'))[0]) except IndexError: pass

##################################################################################################

But still I am getting the error related to the egg flie. My other files are working perfectly in CARLA.

When I run the file for discrete file. I got this error.

python3 discrete_driver.py Couldn't import Carla egg properly pygame 2.1.2 (SDL 2.0.16, Python 3.8.10) Hello from the pygame community. https://www.pygame.org/contribute.html Traceback (most recent call last): File "discrete_driver.py", line 16, in from networks.off_policy.ddqn.agent import DQNAgent File "/home/Autonomous-Driving-in-Carla-using-Deep-Reinforcement-Learning-main/networks/off_policy/ddqn/agent.py", line 4, in from networks.off_policy.ddqn.dueling_dqn import DuelingDQnetwork File "/home/Autonomous-Driving-in-Carla-using-Deep-Reinforcement-Learning-main/networks/off_policy/ddqn/dueling_dqn.py", line 5, in from parameters import DQN_LEARNING_RATE, DQN_CHECKPOINT_DIR, TOWN7 ImportError: cannot import name 'TOWN7' from 'parameters' (/home/ryzen/Autonomous-Driving-in-Carla-using-Deep-Reinforcement-Learning-main/parameters.py)

So I add this line in parameters.py file TOWN7 = "Town07"

And then I got this error:

python3 discrete_driver.py Couldn't import Carla egg properly pygame 2.1.2 (SDL 2.0.16, Python 3.8.10) Hello from the pygame community. https://www.pygame.org/contribute.html

Exit Traceback (most recent call last): File "discrete_driver.py", line 212, in runner() File "discrete_driver.py", line 57, in runner writer = SummaryWriter(f"runs/{run_name}/{town}") UnboundLocalError: local variable 'run_name' referenced before assignment

How to resolve both these errors?

SExpert12 avatar Jul 04 '24 09:07 SExpert12