C
Qt Quick Ultralite Automotive Cluster Demo
Demonstrates integrating QML and C++, and also using 3rd party libraries.
Overview
This is a complex application that demonstrates many aspects of applications built with Qt Quick Ultralite:
- Integrating C++ business logic with QML applications
- Handling complex user interfaces by splitting into multiple QML components
- Using complex animations for best user experience without sacrificing performance
The central portion of the screen can switch between four different pages:
- Media Player
- Phone
- Turn-by-turn navigation
- Configuration
The pages and menus can be controlled by key input, using a keyboard on a desktop computer. They can also be controlled using the physical HMI knob and 4-way directional switch on the Renesas Mango main board:
Action | Desktop | RH850-D1M1A |
---|---|---|
Navigate up | Up key | Switch up |
Navigate down | Down key | Switch down |
Navigate left | Left key | Switch left |
Navigate right | Right key | Switch right |
Navigate next | Space key | Switch center press |
Next page | Page Up key | Knob right |
Previous page | Page Down key | Knob left |
Validate | Enter key | Knob press |
Controlling the demo using the simulation controller
The demo can also be controlled using the C linkage API from automotive/src/simulationcontroller.h
.
Each key has a corresponding API function with the qul_application_control_
prefix. Call the function with pressed
as true
and then with pressed
as false
to trigger a key press for the application.
To disable automatic page, menu and mode changes, call qul_application_force_interactive_mode
with force_interactive_mode
as true
.
To disable simulated drive data, call qul_application_show_simulated_drive_data
once with simulated_drive_data
as false
. After this, call the setter function, for example qul_application_set_speed
to set the speed value.
To disable lane assistant animation, call qul_application_set_lane_assistant_enabled
with enabled
as false
.
To disable simulated light indicators, call qul_application_show_simulated_light_indicators
once with simulated_light_indicators
as false
. After this, call the setter function, for example, qul_application_set_left_blinker_on
with left_blinker_on
as true
to set the left blinker on.
File variants
The automotive demo uses file variants and selectors to customize the application to different demo regions.
If no selectors are applied, the demo region will be set to Germany, using metric units and German street names and signage. It is possible to build the demo with file variants displaying imperial units and/or US localized street names and speed limit signage. Apply the "imperial"
file selector for imperial units, and the "usa"
selector for US localized street names and signage.
qmlprojectexporter demos/automotive/qmlproject/automotive.qmlproject --outdir=<output_dir> --selector=imperial,usa
When building the demo using CMake, set the DEMO_REGION
variable to "usa"
also adds the "imperial"
selector to simplify building the application for a US audience:
cmake -DDEMO_REGION="usa" <additional args>
Target platforms
- MCIMX93
- RH850-D1M1A
- STM32F769i
- Infineon TRAVEO T2G
Screenshots
Normal mode
Sport mode
Benchmark mode
In the Benchmark mode, the application runs for a predefined time of 30 seconds and the performance metrics are displayed on the screen at the end of 30-seconds interval. If the Qt Quick Ultralite Core library is built with QUL_ENABLE_PERFORMANCE_CONSOLE_OUTPUT=ON
, the same results are also displayed on the serial console.
The following performance metrics are displayed at the end of the test:
Parameter | Description | |
---|---|---|
1 | Total frames | Total number of frames in the recording interval. |
2 | Average FPS | Average frames per second value measured during the recording interval. |
3 | Minimum FPS | Minimum frames per second value captured during the recording. |
4 | Maximum heap usage | Maximum heap usage in bytes recorded since the application was started. |
5 | Maximum stack usage | Maximum stack usage in bytes recorded since the application was started. |
6 | Average CPU load | CPU Load in percentage value averaged over the recording interval. |
The Bechmark mode is provided as an independent CMake target with the name automotive_benchmark
. To run the Benchmark mode, build and flash the target automotive_benchmark
.
The automotive_benchmark
target requires adding the compile definition, QUL_DEMO_BENCHMARK_MODE
.
target_compile_definitions(automotive_benchmark PRIVATE QUL_DEMO_BENCHMARK_MODE )
The automotive.qmlproject
file includes the benchmark_module.qmlproject
file as shown below:
ModuleFiles { files: [ "benchmark/benchmark_module.qmlproject" ] }
Import the following modules in the root QML file.
import QtQuickUltralite.Extras 2.0 import Benchmark 1.0 import QtQuickUltralite.Profiling
- Qt Quick Ultralite Extras module provides QulPerf object which allows starting and stopping the measurements.
Benchmark
module is provided bybenchmark_module.qmlproject
file. It provides methods for simulating touch gesture for flick control.- Qt Quick Ultralite Profiling module provides the screen overlay QulPerfOverlay for displaying performance metrics on top of the application user interface.
Add the QulPerfOverlay
QML object for benchmark results in root qml. This overlay becomes visible when benchmarkTimer
is triggered after 30 seconds.
QulPerfOverlay { id: benchmarkResult anchors.horizontalCenter: parent.horizontalCenter; anchors.verticalCenter: parent.verticalCenter; visible: false }
Start the recording in the root QML item when the root object is instantiated and Component.onCompleted
signal is triggered.
Component.onCompleted: { QulPerf.recording = true }
The application runs for 30 seconds. The recording is stopped after 30 seconds and benchmark results screen overlay is made visible.
Timer { id: benchmarkTimer interval: 30000 running: true repeat: false onTriggered: { QulPerf.recording = false; benchmarkResult.visible = true } }
Note: The Benchmark mode requires Qt Quick Ultralite Core and Platform libraries to be built with QUL_ENABLE_PERFORMANCE_LOGGING=ON
and QUL_ENABLE_HARDWARE_PERFORMANCE_LOGGING=ON
.
Files:
- automotive/+imperial/SpeedLimitImage.qml
- automotive/+imperial/SpeedLimitValues.qml
- automotive/+imperial/Units.qml
- automotive/BaseGauge.qml
- automotive/CMakeLists.txt
- automotive/CarStatus.qml
- automotive/DriveModeSelector.qml
- automotive/Gauge.qml
- automotive/GuideArrow.qml
- automotive/GuideArrowItem.qml
- automotive/LaneAssist.qml
- automotive/LaneAssistWhiteLine.qml
- automotive/LinearGauge.qml
- automotive/MediaPlayer.qml
- automotive/Menu.qml
- automotive/MiddleGauge.qml
- automotive/Navi.qml
- automotive/NormalMode.qml
- automotive/NormalModeContentItem.qml
- automotive/Phone.qml
- automotive/SpeedLimitImage.qml
- automotive/SpeedLimitValues.qml
- automotive/SpeedWarningIndicator.qml
- automotive/SportGauge.qml
- automotive/SportMode.qml
- automotive/TellTales.qml
- automotive/TellTalesIndicator.qml
- automotive/TempGauge.qml
- automotive/Units.qml
- automotive/automotive.qml
- automotive/benchmark/benchmark_module.qmlproject
- automotive/benchmark/benchmarkmode.h
- automotive/imports/Automotive/MainModel.qml
- automotive/imports/Automotive/MathAPI.qml
- automotive/imports/Automotive/MediaPlayerModel.qml
- automotive/imports/Automotive/NaviModel.qml
- automotive/imports/Automotive/NormalModeModel.qml
- automotive/imports/Automotive/PhoneModel.qml
- automotive/imports/Automotive/SettingsMenuModel.qml
- automotive/imports/Automotive/SportModeModel.qml
- automotive/imports/Automotive/Style.qml
- automotive/imports/Automotive/TellTalesModel.qml
- automotive/imports/Automotive/qmldir
- automotive/qmlproject/automotive.qmlproject
- automotive/qmlproject/automotive_module.qmlproject
- automotive/qmlproject/automotive_traveo_t2g.qmlproject
- automotive/region/+usa/Region.qml
- automotive/region/Region.qml
- automotive/src/3rdparty/etl/CMakeLists.txt
- automotive/src/canbus/CMakeLists.txt
- automotive/src/canbus/qt/CMakeLists.txt
- automotive/src/canbus/rh850-d1m1a-baremetal/CMakeLists.txt
- automotive/src/connectivityservice.cpp
- automotive/src/connectivityservice.h
- automotive/src/hmi_input/CMakeLists.txt
- automotive/src/hmi_input/hmi_input.cpp
- automotive/src/hmi_input/hmi_input.h
- automotive/src/hmi_input/hmi_input_event.h
- automotive/src/hmi_input/rh850-d1m1a-baremetal/CMakeLists.txt
- automotive/src/hmi_input/rh850-d1m1a-baremetal/rh850.cpp
- automotive/src/mathutils.h
- automotive/src/platform/baremetal/main.cpp
- automotive/src/simulation/drivestates.cpp
- automotive/src/simulation/drivestates.h
- automotive/src/simulation/drivetrain.cpp
- automotive/src/simulation/drivetrain.h
- automotive/src/simulation/lights.cpp
- automotive/src/simulation/lights.h
- automotive/src/simulation/smfwd.h
- automotive/src/simulation/speedlimits.cpp
- automotive/src/simulation/speedlimits.h
- automotive/src/simulation/stateid.h
- automotive/src/simulation/states.cpp
- automotive/src/simulation/states.h
- automotive/src/simulationcontroller.cpp
- automotive/src/simulationcontroller.h
- automotive/src/statemachine.h
Images:
- automotive/images/airbag.png
- automotive/images/albums/ak.png
- automotive/images/albums/juno.png
- automotive/images/albums/phazz.png
- automotive/images/albums/thievery-corp.png
- automotive/images/albums/tycho.png
- automotive/images/arrow-0.png
- automotive/images/arrow-45.png
- automotive/images/arrow-90.png
- automotive/images/arrow-round.png
- automotive/images/assets-phone-list-pseudo-mask.png
- automotive/images/battery.png
- automotive/images/bg-mask.png
- automotive/images/car-highlights.png
- automotive/images/clock.png
- automotive/images/fuel.png
- automotive/images/gauge-gauge-frame-sport-center.png
- automotive/images/gauge-gauge-frame-sport-side.png
- automotive/images/gauge-gauge-frame.png
- automotive/images/gauge-normal.png
- automotive/images/highlight-big-sport.png
- automotive/images/highlight-normal.png
- automotive/images/highlight-standard-sport.png
- automotive/images/leaf.png
- automotive/images/low-beam-headlights.png
- automotive/images/navi.png
- automotive/images/needle-normal.png
- automotive/images/needle-standard-sport.png
- automotive/images/oil-temp.png
- automotive/images/parked.png
- automotive/images/parking-lights.png
- automotive/images/phone.png
- automotive/images/photos/aryn.png
- automotive/images/photos/beatriz.png
- automotive/images/photos/caspar.png
- automotive/images/photos/hirini.png
- automotive/images/photos/joslin.png
- automotive/images/play.png
- automotive/images/pseudo-mask-vertical.png
- automotive/images/ready.png
- automotive/images/red-border-left.png
- automotive/images/red-border-right.png
- automotive/images/road.png
- automotive/images/setup.png
- automotive/images/speed-limit-warning.png
- automotive/images/speed-limit-warnings/140.png
- automotive/images/speed-limit-warnings/20mph.png
- automotive/images/speed-limit-warnings/30.png
- automotive/images/speed-limit-warnings/35mph.png
- automotive/images/speed-limit-warnings/45mph.png
- automotive/images/speed-limit-warnings/50.png
- automotive/images/speed-limit-warnings/55mph.png
- automotive/images/speed-limit-warnings/70.png
- automotive/images/speed-limit-warnings/85mph.png
- automotive/images/speed-limit-warnings/90.png
- automotive/images/sport.png
- automotive/images/top-line.png
- automotive/images/turn_left.png
- automotive/images/turn_right.png
- automotive/images/white-line-left.png
- automotive/images/white-line-right.png
Available under certain Qt licenses.
Find out more.