Info
This article describes our new model lifecycle approach released on Friday, 2023-03-03. With that, the model is now automatically generated with the instantiation of the devContainer. It is generated from the vehicle model source file referenced in the AppManifest.
For the time being, the integration of services is not supported by the new approach.
The previous approach, using pre-generated model repositories, is now deprecated. But it is still available and
This tutorial will show you how:
- the vehicle API used as the source to generate the model is referenced in the app manifest,
- the automatic generation of the model works,
- you can trigger manual recreation of the model (after adding extensions to the API required by your project)
How to Reference a Model Specification
The model specification defines the vehicle API to be used by your project. It is referenced in the AppManifest.json
via a URI or local file path like this:
"vehicleModel": {
"src": "<https://github.com/COVESA/vehicle_signal_specification/releases/download/v3.0/vss_rel_3.0.json>"
}
"vehicleModel": {
"src": "./my_model/my_model.json"
}
Info
The reference must point to a JSON file containing the model specification as VSS vspec. References to a VSS.vspec
file hierarchy are not supported as of now.
Model Creation
The generation of the model is taking place:
- through a
onPostInit hook
when
velocitas init
is called:- either triggered manually or
- automatically during the instantiation of the devContainer through our Velocitas Lifecycle Management , or
- when you trigger the VS Code task
(Re-)generate vehicle model
explicitly.
The model generation is a three step process:
- The model generator is installed as a Python package (if not already present)
- The referenced model specification is downloaded (if no local reference)
- The model code is generated and installed.
The model is generated using our
Velocitas vehicle-model-generator
.
The used version and also the repository of the generator can be altered via the variables
section of the project configuration in the .velocitas.json
.
The default values for those are defined in the
manifest.json
of the
devContainer setup package
.
Also, the target folder for the generated model source code is specified here:
{
"variables": {
"modelGeneratorGitRepo": "https://github.com/eclipse-velocitas/vehicle-model-generator.git",
"modelGeneratorGitRef": "v0.3.0",
"generatedModelPath": "./gen/vehicle_model"
}
}
In Python template based projects the generated model is finally installed in the site-packages folder, while in C++ projects it is made available as a CMake include folder.
Further information
- Concept: SDK Overview
- Tutorial: Quickstart
- Tutorial: Create a Vehicle App