Learn how to create a Vehicle Model manually for C++
Vehicle Model Creation
A Vehicle Model makes it possible to easily get vehicle data from the KUKSA Data Broker and to execute remote procedure calls over gRPC against Vehicle Services and other Vehicle Apps. It is generated from the underlying semantic models for a concrete programming language as a graph-based, strongly-typed, intellisense-enabled library.
This tutorial will show you how to:
- Create a Vehicle Model
- Add a Vehicle Service to the Vehicle Model
- Distribute your Python Vehicle Model
A Vehicle Model should be defined in its own package. This makes it possible to distribute the Vehicle Model later as a standalone package and to use it in different Vehicle App projects.
The creation of a new vehicle model is only required if the vehicle signals (like sensors and actuators) defined in the current version of the COVESA Vehicle Signal Specification (VSS) is not sufficient for the definition of your vehicle API. Otherwise you could use the default vehicle model we geneated for you, see Python Vehicle Model and C++ Vehicle Model.
- Visual Studio Code with the Python extension installed. For information on how to install extensions on Visual Studio Code, see VS Code Extension Marketplace.
Create a Vehicle Model from VSS specification
A Vehicle Model can be generated from a COVESA Vehicle Signal Specification (VSS). VSS introduces a domain taxonomy for vehicle signals, in the sense of classical attributes, sensors and actuators with the raw data communicated over vehicle buses and data. The Velocitas vehicle-model-generator creates a Vehicle Model from the given specification and generates a package for use in Vehicle App projects.
Follow the steps to generate a Vehicle Model.
Clone the vehicle-model-generator repository in a container volume.
In this container volume, clone the vehicle-signal-specification repository and if required checkout a particular branch:
git clone https://github.com/COVESA/vehicle_signal_specification cd vehicle_signal_specification git checkout <branch-name>
In case the VSS vspec doesn’t contain the required signals, you can create a vspec using the VSS Rule Set.
Execute the command
python3 gen_vehicle_model.py -I ./vehicle_signal_specification/spec ./vehicle_signal_specification/spec/VehicleSignalSpecification.vspec -l <lang> -T sdv_model -N sdv_model
Depending on the value of
lang, which can assume the values
cpp, this creates a
sdv_modeldirectory in the root of repository along with all generated source files for the given programming language.
Here is an overview of what is generated for every available value of
python sources and a
setup.pyready to be used as python package
c++ sources, headers and a CMakeLists.txt ready to be used as a CMake project
To have a custom model name, refer to README of vehicle-model-generator repository.
For python: Change the version of package in
setup.pymanually (defaults to 0.1.0).
Now the newly generated
sdv_modelcan be used for distribution. (See Distributing your Vehicle Model)
Create a Vehicle Model Manually
Alternative to the generation from a VSS specification you could create the Vehicle Model manually. The following sections describing the required steps.
Distributing your Vehicle Model
Once you have created your Vehicle Model either manually or via the Vehicle Model Generator, you need to distribute your model to use it in an application. Follow the links below for language specific tutorials on how to distribute your freshly created Vehicle Model.
- Concept: SDK Overview
- Tutorial: Setup and Explore Development Enviroment
- Tutorial: Create a Vehicle App
Learn how to create a Vehicle Model manually for python
Learn how to distribute a Vehicle Model.