1a480005b99ca4f2f5209f1dccf25ba28b3a4560
[AGL/documentation.git] / docs / 06_Component_Documentation / 09_AGL_Demo_Control_Panel.md
1 ---
2 title: AGL Demo Control Panel
3 ---
4
5 # AGL Demo Control Panel
6
7 ## Introduction
8
9 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.
10 ### Application Overview
11
12 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
14 ![Layers_And_Extensions](images/AGL-Deom-Control-Panel/Application-Logic.png)
15
16 ## # Installation  
17
18 Clone the repository
19
20 ```bash
21 git clone "https://gerrit.automotivelinux.org/gerrit/src/agl-demo-control-panel" && cd ./AGL_Demo_Control_Panel
22 ```
23
24 Install the Python dependencies
25
26 ```
27 pip install -r requirements.txt
28 ```
29
30 ## # Setup
31
32 Before using the  `AGL Demo Control Panel`, we need to make sure to run the Kuksa.val server  and also have our `can0` interface set up (Optional).
33
34 ### 1. Connect the Machines
35
36 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) 
37 ### 2. CAN interface (WIP)
38
39 To set up the CAN interface between the Host system and the target machine(s) we use [cannelloni](https://github.com/mguentner/cannelloni),
40
41 1. Create the virtual CAN interface with the command:
42
43         ```bash
44         $ sudo ip link add dev can0 type vcan
45         ```
46
47 2. On both machines, bring the virtual CAN interface online with the command: 
48
49         ```bash
50         $ sudo ip link set up can0
51         ```
52
53 3. Install cannelloni from its [GitHub repository](https://github.com/mguentner/cannelloni) and run cannelloni with the following commands. 
54
55         _Note_: `cannelloni` is available in AGL, just add `IMAGE_INSTALL:append = " cannelloni"`       to your `conf/local.conf`
56
57         Host Machine (Running `AGL Demo Control Panel`)
58         ```bash
59         cannelloni -I can0 -R <target-ip> -r 20000 -l 20000
60         ```
61          Target Machine (Running AGL image)
62         ```bash
63         cannelloni -I can0 -R <host-ip> -r 20000 -l 20000 -p
64         ```
65
66         You should now be able to send and receive CAN messages between the two machines using the vcan interface and cannelloni.
67
68 ### 3. Kuksa-val-server
69
70 Restart AGL's `kuksa-val-server`
71
72 ```bash
73 $ pkill kuksa
74 $ kuksa-val-server --address 0.0.0.0
75 ```
76
77 _Note_: if you are testing on a local build (or) docker image of kuksa.val server, make sure to remove  `cacertificate` and `tls_server_name` arguments from `extras/config.py`.
78         
79 ```python
80 KUKSA_CONFIG = {
81 "ip": '<default-kuksa-ip>',
82 "port": "8090",
83 'protocol': 'ws',
84 'insecure': False,
85 }
86 ```
87
88 ### 4. Start AGL Demo Control Panel
89
90 1. To use the control panel
91         ```
92         cd /Path/to/agl-demo-control-panel
93         python -u main.py
94         ```
95
96 ![Layers_And_Extensions](images/AGL-Deom-Control-Panel/Dashboard.png)
97
98 2. Go to settings
99         - Start (load default config)
100         -  Configure
101                 - Ip-Address ("local" if running kuksa server on host)
102                 - JWT Token path 
103                 - CA certificate path
104                 - Insecure mode (default off)
105         - Reconnect (Status will be updated accordingly)
106         - Page settings: Configure the visibility of pages and switch between CAN and Kuksa messages by using the toggle for the same.
107
108 ![Layers_And_Extensions](images/AGL-Deom-Control-Panel/Settings_Page.png)
109
110 3. Navigate to the desired page using the provided buttons at the bottom
111
112 |  |
113 |---|
114 | ![Layers_And_Extensions](images/AGL-Deom-Control-Panel/IC.png) |
115
116 |  |  |
117 |---|---|
118 | ![Layers_And_Extensions](images/AGL-Deom-Control-Panel/HVAC.png) | ![Layers_And_Extensions](images/AGL-Deom-Control-Panel/SC.png) |
119
120
121
122