Sign inSign up

ricardodeazambuja/carlasim

By ricardodeazambuja

•Updated about 3 years ago

CARLA Simulator version 0.9.12 prepared for headless operation

Image
0

748

ricardodeazambuja/carlasim repository overview

Nothing fancy here, just the docker image (tag 0.9.13) from carlasim⁠ using a different script to start the simulation headlessly, and extra packages (sudo, vim...) installed.

You must have docker and nvidia-docker2⁠ installed. Tested ONLY on Ubuntu 20.04.3 LTS, kernel 5.8.18, and NVIDIA Driver Version: 470.63.01.

⁠Launch the simulator:

You can change --gpus 0 to --gpus all or ---gpus <some_number> if you have more than one GPU.

docker run --rm -it --name carla-container -u carla -p 2000-2002:2000-2002 --gpus 0 ricardodeazambuja/carlasim:0.9.13_headless ./launch_headless.sh

Press ENTER to kill the simulator (it takes some seconds until it dies...).

⁠Using the PythonAPI⁠

docker cp carla-container:/home/carla/PythonAPI .

⁠Considering your base environment is py3.7:

conda create --name carla-simulator --clone base
conda activate carla-simulator
pip install --upgrade pip
cd PythonAPI/examples/
pip install -r requirements.txt 
⁠Install the carla python package (so we don't need to add the egg to the sys.path)
cd ../carla/dist/  #it's inside PythonAPI/carla/dist
pip install carla-0.9.13-cp37-cp37m-manylinux_2_27_x86_64.whl

If pip complains and you are sure the Python version is correct, one possible solution is to upgrade pip itself: python -m pip install --upgrade pip

⁠The simulation is empty, so let's put something there!
python generate_traffic.py 

It should print spawned 30 vehicles and 10 walkers, press Ctrl+C to exit.

⁠It's headless, so we need a way to see what's happening there

Open a new terminal (don't forget to run conda activate carla-simulator) the and type:

python synchronous_mode.py

It should open a pygame display with a random vehicle moving through the town (with the focus on the pygame display, press ESC to exit).

Tag summary

Content type

Image

Digest

sha256:4c9f76b1a…

Size

6.6 GB

Last updated

about 3 years ago

docker pull ricardodeazambuja/carlasim:0.9.13_headless