How to setup CARLA scenario runner
How to setup scenario runner
Scenario Runner Github: https://github.com/carla-simulator/scenario_runner
1 Preparation
1.1 Create a new environment
Install the scenario runner matching you CARLA version: Ex; Release version 0.9.12: matching CARLA version 0.9.12:https://github.com/carla-simulator/scenario_runner/releases Open a virtual environment of python 3.7~/anaconda3:
$conda create --name scrun python=3.7
$conda activate scrun
$cd ~/path_to_scenario_runner
$pip install -r requirements.txt
1.2 Set path
-
Path Setting: # %CARLA_ROOT% is the CARLA installation directory
-
%SCENARIO_RUNNER% is the ScenarioRunner installation directory
-
is the correct string for the Python version being used - In a build from source, the .egg files may be in: ${CARLA_ROOT}/PythonAPI/dist/ instead of ${CARLA_ROOT}/PythonAPI
set CARLA_ROOT=\path\to\your\carla\installationset SCENARIO_RUNNER_ROOT=\path\to\your\scenario\runner\installationset PYTHONPATH=%PYTHONPATH%;%CARLA_ROOT%\PythonAPI\carla\dist\carla-<VERSION>.eggset PYTHONPATH=%PYTHONPATH%;%CARLA_ROOT%\PythonAPI\carla
Example: in the windows you used, input the following:
export CARLA_ROOT=/home/user10/Downloads/CARLA_0.9.12
export SCENARIO_RUNNER_ROOT=/home/user10/Downloads/CARLA_0.9.12/scenario_runner
export PYTHONPATH=$PYTHONPATH:${CARLA_ROOT}/PythonAPI/carla/dist/carla-0.9.12-py3.7-linux-x86_64.egg (This name can be find on CARLA_0.9.12/PythonAPI/carla/dist)
export PYTHONPATH=$PYTHONPATH:${CARLA_ROOT}/PythonAPI/carla
export PYTHONPATH=$PYTHONPATH:${CARLA_ROOT}/PythonAPI
Optional:
- Save it on bashrc so that you never need to do step 2 again
- ~/anaconda3$gedit ~/.bashrc
- Paste the modified Example in step 2 on the end of the file
- Make an alias to quickly access the folder of scenario_runner by
- $open .~/anaconda3
- $gedit ~/.bashrcPaste the following on the end of the file:if [ -f ~/.bash_aliases ]; then. ~/.bash_aliasesfi
How to run
Starting using scenario runner (all need to cd to your scenario_runner folder and then use the previous virtual environment by $conda activate scrun first):
Open one terminal for loading the scenario:
python scenario_runner.py --scenario FollowLeadingVehicle_1 --reloadWorld
Open another terminal for manual control:
pip install pygame # (need to do this for the first time)
python manual_control.py
To see the full list of scenario:
python scenario_runner.py --list
Enjoy Reading This Article?
Here are some more articles you might like to read next: