From b7d3a936708e28e3a7d9546e22cdbe91756c1c79 Mon Sep 17 00:00:00 2001 From: Suchinton Date: Sun, 7 Jul 2024 22:59:56 +0530 Subject: GSoC '24 Add and Update Documentation for CARLA and Demo Control Panel - Update the AGL Demo Control Panel documentation. - Add Documentation for CARLA with AGL. Bug-AGL: SPEC-5161 Change-Id: I33e4b488749959a055183596ec187d1cb01827d6 Signed-off-by: Suchinton Chakravarty Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/documentation/+/30097 Reviewed-by: Jan-Simon Moeller Tested-by: Jan-Simon Moeller --- .../09_AGL_Demo_Control_Panel.md | 22 ++--- .../13_CARLA_with_AGL.md | 104 +++++++++++++++++++++ 2 files changed, 112 insertions(+), 14 deletions(-) create mode 100644 docs/06_Component_Documentation/13_CARLA_with_AGL.md diff --git a/docs/06_Component_Documentation/09_AGL_Demo_Control_Panel.md b/docs/06_Component_Documentation/09_AGL_Demo_Control_Panel.md index af42523..2b99242 100644 --- a/docs/06_Component_Documentation/09_AGL_Demo_Control_Panel.md +++ b/docs/06_Component_Documentation/09_AGL_Demo_Control_Panel.md @@ -5,7 +5,10 @@ title: AGL Demo Control Panel ## Introduction -This document describes the design and usage of the **AGL Demo Control Panel**, a **Qt5-based** tool that allows you to control and interact with various **Automotive Grade Linux (AGL)** demo applications. The tool uses **Kuksa.val** and **CAN frame messages** to communicate with the target machine that runs the AGL image(s). You can use the tool to perform tasks such as starting and stopping scripts, changing the vehicle speed and engine RPM, adjusting the HVAC settings, and providing Steering Inputs. The tool is designed to **demonstrate** the capabilities and features of AGL in a **user-friendly** and **interactive** way. +This document describes the design and usage of the **AGL Demo Control Panel**, a **Qt6-based** tool that allows you to control and interact with various **Automotive Grade Linux (AGL)** demo applications. The tool uses **Kuksa.val** and **CAN frame messages** to communicate with the target machine that runs the AGL image(s). You can use the tool to perform tasks such as starting and stopping scripts, changing the vehicle speed and engine RPM, adjusting the HVAC settings, and providing Steering Inputs. The tool is designed to **demonstrate** the capabilities and features of AGL in a **user-friendly** and **interactive** way. + +It also supports file playback from CARLA based CAN messages. Refer to the [CARLA with AGL](13_CARLA_with_AGL.md) for more information. + ### Application Overview To use the control panel, you need to connect the main machine that runs the control panel to the target machine that runs the AGL image(s) using a **LAN/ethernet cable**. You also need to configure the IP address of the Kuksa server and set your preferences in the tool’s settings menu. @@ -13,16 +16,6 @@ To use the control panel, you need to connect the main machine that runs the con ![Layers_And_Extensions](images/AGL-Demo-Control-Panel/Application-Logic.png) ## Installation - - -- _Note_: - If errors occur in Debian based/Rasbian OS during installation, follow the steps mentioned below and skip to step 2: -```bash -$ nano requirements.txt -# -> Comment pyqt5 dependency using "#" -$ sudo apt install python3-pyqt5 python3-qtpy pyqt5-dev-tools python3-pyqt5.qtsvg -y -``` - - Step 1 ```bash $ python3 -m venv control-panel @@ -32,7 +25,7 @@ $ source control-panel/bin/activate - Step 2 ```bash $ pip3 install -r requirements.txt -$ pyrcc5 assets/res.qrc -o res_rc.py +$ pyside6-rcc assets/res.qrc -o res_rc.py ``` ## Setup @@ -40,8 +33,9 @@ Before using the `AGL Demo Control Panel`, we need to make sure to run the Kuks ### 1. Connect the Machines -First, we need to connect the machines, i.e. the host machine (Running the control panel) and the target machine (running the AGL image) via LAN or a bridged network (QEMU or VM) -### 2. CAN interface (WIP) +First, we need to connect the machines, i.e. the host machine (Running the control panel) and the target machine (running the AGL image) via LAN or a bridged network (QEMU or VM). + +### 2. CAN interface To set up the CAN interface between the Host system and the target machine(s) we use [cannelloni](https://github.com/mguentner/cannelloni), diff --git a/docs/06_Component_Documentation/13_CARLA_with_AGL.md b/docs/06_Component_Documentation/13_CARLA_with_AGL.md new file mode 100644 index 0000000..075da80 --- /dev/null +++ b/docs/06_Component_Documentation/13_CARLA_with_AGL.md @@ -0,0 +1,104 @@ +--- +title: CARLA with AGL +--- +# CARLA with AGL (WIP) + +## 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. + +1. Running the CARLA Server + + ```bash + # Move to the installation directory + $ cd /path/to/CARLA_ + + # Start the CARLA Server + $ ./CarlaUE4.sh + + # To run using minimum resources + $ ./CarlaUE4.sh -quality-level=Low -prefernvidia + ``` + + You may also add the `-RenderOffScreen` flag to start CARLA in off-screen mode. Refer to the various [rendering options](https://carla.readthedocs.io/en/latest/adv_rendering_options/#no-rendering-mode) for more details. + + Another way of running the CARLA server without a display is by using [CARLA in Docker](https://carla.readthedocs.io/en/latest/build_docker/). + +2. Starting a Manual Simulation + + ```bash + # Navigate to directory containing the demo python scripts + # + $ cd /path/to/CARLA_/PythonAPI/examples + ``` + + Create a Python virtual environment and resolve dependencies + ```bash + $ python3 -m venv carlavenv + $ source carlavenv/bin/activate + $ pip3 install -r requirements.txt + + # Start the manual_control.py script + $ python3 manual_control.py + ``` + +## Converting CARLA data into CAN + +The `carla_to_CAN.py` script can be run run alongside an existing CARLA simulation to fetch data and convert it into CAN messages based on the [agl-vcar.dbc](https://git.automotivelinux.org/src/agl-dbc/plain/agl-vcar.dbc) file. + +While the `record_playback.py` script is responsible for recording amd playing back the CAN data for later sessions. + +_NOTE_: This does **not** require the CARLA server to be running. + +To access these scripts, clone the [AGL Demo Control Panel](https://gerrit.automotivelinux.org/gerrit/admin/repos/src/agl-demo-control-panel,general) project. + +```bash +# Move to the Scripts directory +$ cd /path/to//agl-demo-control-panel/Scripts + +# Fetch the agl-vcar.dbc file +$ wget -nd -c "https://git.automotivelinux.org/src/agl-dbc/plain/agl-vcar.dbc" +``` + +Create a Python virtual environment and resolve dependencies +```bash +$ python3 -m venv carlavenv +$ source carlavenv/bin/activate +$ pip3 install -r requirements.txt + +# Optionally, set up the vcan0 interface +$ ./vcan.sh +``` + +1. Converting CARLA Data into CAN + + ```bash + $ python -u carla_to_CAN.py + # OR + $ python -u carla_to_CAN.py --host --port + ``` + +2. Recording and Playback of CAN messages + + ```bash + $ python -u record_playback.py + # OR + $ python -u record_playback.py --interface (or) -i can0 # default vcan0 + ``` + + CLI Options: + + - 1: Captures CAN messages and writes them into 'can_messages.txt' + - 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**. + +**cannelloni** is available in AGL, just add `IMAGE_INSTALL:append = " cannelloni"` to your `conf/local.conf`. + +To set up the CAN interface between the Host system and the target machine(s) refer to the [cannelloni docs](https://github.com/mguentner/cannelloni). -- cgit 1.2.3-korg