- Step 2
```bash
$ pip3 install -r requirements.txt
+$ /usr/lib64/qt6/libexec/rcc -g python assets/res.qrc | sed '0,/PySide6/s//PyQt6/' > res_rc.py
+# OR
$ pyside6-rcc assets/res.qrc -o res_rc.py
```
## Setup
You should now be able to send and receive CAN messages between the two machines using the vcan interface and cannelloni.
-### 3. Configuration for Kuksa-val-server/ Kuksa databroker
+### 3. Configuring the Demo Control Panel
Run the `kuksa-val-server`/`databroker` on `0.0.0.0` by either restarting the server, editing `/etc/default/kuksa-databroker` or add the `agl-demo-preload` as a feature to your build of AGL. The server should be started using the `--address 0.0.0.0` argument.
```python
[default]
-preferred-config=AGL-kuksa-val-server
-
-# [cutom-config-template]
-# ip=<ip address>
-# port=<port number>
-# protocol=<ws|grpc> # ws/grpc -> kuksa-val-server, grpc -> databroker
-# insecure=<true|false>
-# cacert=<default|/path/to/CA.pem>
-# token=<default|/path/to/token>
-# tls_server_name=<name>
-
-[kuksa-val-server]
-ip=localhost
-port=8090
-protocol=ws
-insecure=false
-token=default
-tls_server_name=
+fullscreen-mode = true # launches app in fullscreen mode
+hvac-enabled = true
+steering-wheel-enabled = true
+file-playback-enabled = true # if not, vcar simulator will be used instead
+file-playback-path = # Add path to can_messages.txt file generated (Refer Step 4. Playback)
+dbc-file-path =
+can-interface =
+
+[keypad-feature]
+enabled = true # If false, keypad UI is not shown
+keypad-only = false # only Keypad page is shown
+ip =
+port =
+keys-to-hide = 3 # hide keys by specifying 1,2,3,4
+
+[vss-server]
+ip = localhost
+port = 55555
+protocol = grpc
+insecure = False
+token = default
+cacert = default
+tls_server_name = Server
```
-### 4. Start AGL Demo Control Panel
+### 4. Playback (Demo mode)
+
+This mode is configured via the `config.ini` file as shown above, using the `file-playback-enabled` and `file-playback-enabled` fields.
+
+![Playback Demo](images/AGL-Demo-Control-Panel/PlaybackDemo.gif)
+
+The playback Mode runs in two ways:
+
+1. CARLA File Playback: In this mode, a pre-recorded sequence of CAN messages is used to feed values into the Demo apps.
+
+Follow the [CARLA with AGL](13_CARLA_with_AGL.md) steps to generate the **can_messages.txt** file, which is populated during a CARLA session.
+
+_Note_: While generating the playback file, it is recommended to run both **record_playback** and **carla_to_CAN** scripts with a python version supported by CARLA.
+
+### 5. Start AGL Demo Control Panel
1. To start the control panel
```
- Reconnect
- Page settings: Configure the visibility of pages and switch between CAN and Kuksa messages by using the toggle for the same.
-![Layers_And_Extensions](images/AGL-Demo-Control-Panel/Settings_Page.png)
-
1. Navigate to the desired page using the provided buttons at the bottom
-| |
-|---|
-| ![Layers_And_Extensions](images/AGL-Demo-Control-Panel/IC.png) |
-
| | |
|---|---|
-| ![Layers_And_Extensions](images/AGL-Demo-Control-Panel/HVAC.png) | ![Layers_And_Extensions](images/AGL-Demo-Control-Panel/SC.png) |
+| ![Layers_And_Extensions](images/AGL-Demo-Control-Panel/IC1.png) | ![Layers_And_Extensions](images/AGL-Demo-Control-Panel/IC2.png) |
+| ![Layers_And_Extensions](images/AGL-Demo-Control-Panel/HVAC.png) | ![Layers_And_Extensions](images/AGL-Demo-Control-Panel/Keypad.png) |
+| ![Layers_And_Extensions](images/AGL-Demo-Control-Panel/SC.png) | ![Layers_And_Extensions](images/AGL-Demo-Control-Panel/Settings_Page.png) |
\ No newline at end of file
---
title: CARLA with AGL
---
-# CARLA with AGL (WIP)
+# CARLA with AGL
+
+![Playback Demo](images/AGL-Demo-Control-Panel/CARLA_CAN.gif)
+
+As part of the [agl-demo-control-panel](https://gerrit.automotivelinux.org/gerrit/admin/repos/src/agl-demo-control-panel,general) application, `carla_to_CAN` and `record_playback.py` scripts provide a way to record CAN messages generated during a CARLA simulation. The `can_messages.txt` playback file generated, can then be used to to playback the messages via CLI or GUI.
+
+![Playback Demo](images/AGL-Demo-Control-Panel/PlaybackDemo.gif)
## Setting up CARLA
You can follow the steps provided in the [CARLA documentation](https://carla.readthedocs.io/en/latest/start_quickstart/#carla-installation) for installing CARLA.
-We recommend using the [latest release](https://github.com/carla-simulator/carla/releases/), and using the supported Python version to run the `carla_to_CAN.py` Script.
+We recommend using the [CARLA V0.9.15](https://github.com/carla-simulator/carla/releases/tag/0.9.15), and using the supported Python version to run the `carla_to_CAN.py` script (Other releases have not been validated).
+
+_Note_: Use a version of python compatible with CARLA to create the venv **(Python 3.9 tested with CARLA V0.9.15)**
1. Running the CARLA Server
# Start the manual_control.py script
$ python3 manual_control.py
```
+_Tip_: If facing issues running the `manual_control.py` script, you may try removing `numpy` version from `requirements.txt` and comment out line `385` from the script.
+```python
+.
+.
+.
+
+class KeyboardControl(object):
+ """Class that handles keyboard input."""
+ def __init__(self, world, start_in_autopilot):
+ self._autopilot_enabled = start_in_autopilot
+ self._ackermann_enabled = False
+ self._ackermann_reverse = 1
+ if isinstance(world.player, carla.Vehicle):
+ self._control = carla.VehicleControl()
+ self._ackermann_control = carla.VehicleAckermannControl()
+ self._lights = carla.VehicleLightState.NONE
+ # world.player.set_autopilot(self._autopilot_enabled) <<------ # disable autopilot
+ world.player.set_light_state(self._lights)
+ elif isinstance(world.player, carla.Walker):
+.
+.
+.
+```
## Converting CARLA data into CAN
```bash
# Move to the Scripts directory
-$ cd /path/to//agl-demo-control-panel/Scripts
+$ cd /path/to/agl-demo-control-panel/
# Fetch the agl-vcar.dbc file
-$ wget -nd -c "https://git.automotivelinux.org/src/agl-dbc/plain/agl-vcar.dbc"
+$ wget -nd -c -P Scripts "https://git.automotivelinux.org/src/agl-dbc/plain/agl-vcar.dbc"
+$ cd Scripts/
```
-Create a Python virtual environment and resolve dependencies
+Create a Python (3.9) virtual environment and resolve dependencies.
```bash
$ python3 -m venv carlavenv
$ source carlavenv/bin/activate
1. Converting CARLA Data into CAN
```bash
- $ python -u carla_to_CAN.py
+ $ python -u carla_to_CAN.py --interface vcan0
# OR
- $ python -u carla_to_CAN.py --host <carla_server_ip> --port <carla_server_port>
+ $ python -u carla_to_CAN.py --interface vcan0 --host <carla_server_ip> --port <carla_server_port>
```
2. Recording and Playback of CAN messages
- 2: Replays captured CAN messages
- 3: Exit
-
## CAN interface to AGL Demo Platform
To use the **`carla_to_CAN.py`** and **`record_playback.py`** scripts to send messages on the CAN interface, one can use the CAN bus or use CAN over Ethernet using **cannelloni**.