Skip to content

Commit a72bebe

Browse files
committed
Updated CARLA documentation
1 parent 2c185eb commit a72bebe

File tree

1 file changed

+58
-31
lines changed

1 file changed

+58
-31
lines changed

docs/scripts/carla.rst

Lines changed: 58 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
CARLA
44
=====
55

6-
`CARLA <https://carla.org/>`_ is an autonomous driving simulator based on Unreal Engine 4.
6+
`CARLA <https://carla.org/>`_ is an autonomous driving simulator based on Unreal Engine.
77
This page explains how to install CARLA and use it with RAMN.
88
Although we only tested the scripts on Windows, they should be usable on Linux with minor adjustments.
99
Note that the simulator requires that you have a sufficiently powerful GPU.
@@ -17,11 +17,15 @@ Note that the simulator requires that you have a sufficiently powerful GPU.
1717
Installing CARLA
1818
----------------
1919

20+
.. warning::
21+
22+
CARLA is a project independent from RAMN, so please refer to CARLA's documentation for CARLA-related issues.
23+
2024
Follow these steps to install CARLA on Windows:
2125

22-
- Download and unzip the latest release of CARLA, from their `Github repository <https://github.com/carla-simulator/carla/releases>`_. The latest version that we tested is Release 0.9.15.
23-
- Check that the simulator works by launching *WindowsNoEditor/CarlaUE4.exe*. This will likely require that you approve the app with Microsoft's SmartScreen. If a 3D view opens, you can close the simulator and move on to the next step. If you get an error message, install the `latest version of Windows DirectX <https://www.microsoft.com/en-us/download/details.aspx?id=35>`_.
24-
- Install the latest Python **3.8 version (not a later version such as 3.12)** from Python Software foundation's `webpage <https://www.python.org/downloads/windows/>`_. **Check the "add python.exe to PATH" option**. The latest version that we tested is `3.8.10 <https://www.python.org/downloads/release/python-3810/>`_. If you do not know which file you should use, try "Windows installer (64-bit)".
26+
- Download and unzip the latest release of CARLA, from its `Github repository <https://github.com/carla-simulator/carla/releases>`_. The latest version that we tested is Release 0.9.15.
27+
- Check that the simulator works by launching ``CarlaUE4.exe`` (or ``CarlaUnreal.exe``), which is typically located in the ``WindowsNoEditor`` folder. This will likely require that you approve the app with Microsoft's SmartScreen. If a 3D view opens, you can close the simulator and move on to the next step. If you get an error message, install the `latest version of Windows DirectX <https://www.microsoft.com/en-us/download/details.aspx?id=35>`_.
28+
- Install the latest Python **3.8 version** from Python Software foundation's `webpage <https://www.python.org/downloads/windows/>`_ (you may use later Python versions such as 3.12 only on recent CARLA releases). **Check the "add python.exe to PATH" option**. The latest version that we tested is `3.8.10 <https://www.python.org/downloads/release/python-3810/>`_. If you do not know which file you should download, try **"Windows installer (64-bit)"**.
2529
- Install CARLA's pythonAPI by opening a command prompt (press Windows+R and type "cmd") and executing:
2630

2731
.. code-block:: bash
@@ -34,33 +38,49 @@ Follow these steps to install CARLA on Windows:
3438
3539
$ pip3 install shapely networkx
3640
37-
- Try CARLA's *manual_control.py* and *automatic_control.py* examples. First, execute *WindowsNoEditor/CarlaUE4.exe* and leave the window open (that is your CARLA server). Then, open a command prompt in *WindowsNoEditor/PythonAPI/examples* (open the folder in Windows Explorer and type "cmd" in the address bar) and try the first example:
41+
- Try CARLA's ``manual_control.py`` and ``automatic_control.py`` examples. First, execute ``CarlaUE4.exe`` (or ``CarlaUnreal.exe``) and leave the window open; that is your CARLA server. Then, open a command prompt in ``PythonAPI/examples`` (open the folder in Windows Explorer and type "cmd" in the address bar) and try the first example:
3842

39-
.. code-block:: bash
43+
.. code-block:: bash
4044
41-
$ python manual_control.py
45+
$ python manual_control.py
4246
43-
You should be able to control the car manually with the WASD keys of your keyboard.
44-
Then, try the second example:
47+
You should be able to control the car manually with the WASD keys of your keyboard. Refer to the notes below if you encounter issues.
48+
49+
You can also verify that the self-driving algorithm is functional with:
4550

4651
.. code-block:: bash
4752
4853
$ python automatic_control.py
4954
5055
You should be able to see the self-driving algorithm in action.
56+
5157

52-
If you have issues with the latest CARLA release, try executing it with the following options:
58+
.. note::
5359

54-
.. code-block:: bash
60+
If you have issues with the latest CARLA release, try executing it with the following options:
5561

56-
$ CarlaUE4.exe -dx11 -windowed -quality-level=Low
62+
.. code-block:: bash
5763
58-
If this does not resolve your issues, try downloading an earlier version of CARLA. RAMN scripts should be compatible with release 0.9.12.
59-
If you do so, you will also need to install CARLA's API with the corresponding version, e.g.:
64+
$ CarlaUE4.exe -dx11 -windowed -quality-level=Low
65+
(or)
66+
$ CarlaUnreal.exe -dx11 -windowed -quality-level=Low
67+
68+
If this does not resolve your issues, try downloading an earlier version of CARLA. RAMN scripts should be compatible with release 0.9.12.
69+
If you do so, you will also need to install CARLA's Python API with the corresponding version, for example with:
6070

61-
.. code-block:: bash
71+
.. code-block:: bash
6272
63-
$ pip3 install carla==0.9.12
73+
$ pip3 install carla==0.9.12
74+
75+
.. note::
76+
77+
Recent CARLA releases may not have their Python API available via pip.
78+
If you use a recent CARLA release, you should install its Python API directly from the ``PythonAPI/carla/dist`` folder, for example with:
79+
80+
.. code-block:: bash
81+
82+
$ pip3 install carla-0.10.0-cp312-cp312-win_amd64.whl
83+
6484
6585
From there, you should have a functional environment to experiment with CARLA.
6686
If you encounter problems up to this point, there is a problem with your CARLA installation, not RAMN.
@@ -69,32 +89,39 @@ Check CARLA's `Quickstart guide <https://carla.readthedocs.io/en/latest/start_qu
6989
If you want, you can download additional assets (maps, etc.) by following the `instructions here <https://carla.readthedocs.io/en/latest/start_quickstart/#import-additional-assets>`_.
7090
You can also edit CARLA's default settings (weather, etc.) by following `this page <https://carla.readthedocs.io/en/stable/configuring_the_simulation/>`_.
7191

72-
If you have not already, you also need to install RAMN's scripts (see :ref:`flashing_scripts`).
73-
7492
.. _ramn_carla_scripts:
7593

76-
Configuring your environment
77-
----------------------------
94+
Configuring your RAMN environment
95+
---------------------------------
96+
97+
- If you haven’t already, you first need to install RAMN’s scripts:
98+
99+
1. Download the `RAMN repository <https://github.com/ToyotaInfoTech/RAMN>`_ on your computer (select Code > Download Zip).
100+
2. Open a command prompt in the ``RAMN/scripts`` folder (you can do this by opening the folder in Windows Explorer and typing "cmd" in the address bar) and execute:
101+
102+
.. code-block:: console
103+
104+
$ pip3 install -r requirements.txt
78105
79-
- Open *RAMN/script/settings/CARLA_PATH.txt* and replace its content with the path to the folder where *CARLAUE4.exe* is located.
80-
- (Optional) Modify *0_CARLA_SERVER_start.bat* with your preferred settings (resolution, etc.). Read `CARLA's documentation <https://carla.readthedocs.io/en/latest/adv_rendering_options/>`_ for more information about CARLA's options. Specify the quality of graphics using :code:`-quality-level=Epic` (best graphics) or :code:`-quality-level=Low` (best performances). Specify the resolution of the server using :code:`-windowed -ResX=N -ResY=N`.
106+
- Open ``RAMN/script/settings/CARLA_PATH.txt`` and replace its content with the path to the folder where ``CARLAUE4.exe`` (or ``CarlaUnreal.exe``) is located on your computer.
107+
- (Optional) Modify ``0_CARLA_SERVER_start.bat`` with your preferred settings (resolution, etc.). Read `CARLA's documentation <https://carla.readthedocs.io/en/latest/adv_rendering_options/>`_ for more information about CARLA's options. Specify the quality of graphics using :code:`-quality-level=Epic` (best graphics) or :code:`-quality-level=Low` (best performances). Specify the resolution of the server using :code:`-windowed -ResX=N -ResY=N`.
81108

82-
- (Optional) Modify *CarlaSettings.ini* to edit default settings (weather, etc.)
83-
- (Optional) Modify *1_CARLA_SERVER_config.bat* to provide a shortcut to execute CARLA's *config.py* as you want (e.g., to `load another map <https://carla.readthedocs.io/en/0.9.15/tuto_first_steps/#loading-a-map>`_).
109+
- (Optional) Modify ``CarlaSettings.ini`` to edit default settings (weather, etc.)
110+
- (Optional) Modify ``1_CARLA_SERVER_config.bat`` to provide a shortcut to execute CARLA's ``config.py`` as needed (e.g., to `load a specific map <https://carla.readthedocs.io/en/0.9.15/tuto_first_steps/#loading-a-map>`_).
84111

85112
Executing RAMN's scripts for CARLA
86113
----------------------------------
87114

88115
First, start a CARLA server:
89116

90-
- Execute *0_CARLA_SERVER_start.bat*.
91-
- (Optional) Execute *1_CARLA_SERVER_config.bat* to update the server's configuration.
117+
- Execute ``0_CARLA_SERVER_start.bat``.
118+
- (Optional) Execute ``1_CARLA_SERVER_config.bat`` to update the server's configuration.
92119

93120
You only need to start one server per session. You will be able to execute the following scripts as long as the window stays active.
94121
You can for example execute the basic RAMN examples:
95122

96-
- Execute *2_CARLA_RAMN_manual_serial.bat* to connect RAMN to CARLA and drive the vehicle manually using RAMN's controls.
97-
- Execute *3_CARLA_RAMN_auto_serial.bat* to connect RAMN to CARLA's self-driving algorithm.
123+
- Execute ``2_CARLA_RAMN_manual_serial.bat`` to connect RAMN to CARLA and drive the vehicle manually using RAMN's controls.
124+
- Execute ``3_CARLA_RAMN_auto_serial.bat`` to connect RAMN to CARLA's self-driving algorithm.
98125

99126
If you get an error, verify that your RAMN's serial port is not being used by another application.
100127

@@ -107,10 +134,10 @@ If the LED does not turn off when you center the steering wheel, it may be becau
107134
You can also connect CARLA to RAMN using a CAN adapter (internal or external) instead of the USB serial connection. To do this:
108135

109136
- Modify the scripts' settings to specify your CAN interface (see :ref:`configure_ramn_scripts`)
110-
- Execute *4_CARLA_RAMN_manual_CAN.bat* to connect RAMN to CARLA and drive the vehicle manually.
111-
- Execute *5_CARLA_RAMN_auto_CAN.bat* to connect RAMN to CARLA with the self-driving algorithm.
137+
- Execute ``4_CARLA_RAMN_manual_CAN.bat`` to connect RAMN to CARLA and drive the vehicle manually.
138+
- Execute ``5_CARLA_RAMN_auto_CAN.bat`` to connect RAMN to CARLA with the self-driving algorithm.
112139

113-
The CAN scripts have less features and typically worse performances than the serial one, so avoid using them unless you have a specific use case for them.
140+
The CAN scripts have fewer features and typically worse performances than the serial one, so avoid using them unless you have a specific use case for them.
114141

115142
.. warning::
116143
When using the CARLA scripts, the serial port of RAMN will not be available for other applications. If you want to interact with the CAN bus, it is recommended that you connect an external CAN adapter. On Linux, you can use the :ref:`vcand` script to multiplex the serial port and observe the CAN bus even when the CARLA scripts are in use.

0 commit comments

Comments
 (0)