Automated Vehicle Model Lifecycle

Learn how to refer a model source and how the automated model lifecycle is working.

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"
}

Model Creation

The generation of the model is taking place:

  • through a onPostInit hook when velocitas init is called:
  • when you trigger the VS Code task (Re-)generate vehicle model explicitly.

The model generation is a three step process:

  1. The model generator is installed as a Python package (if not already present)
  2. The referenced model specification is downloaded (if no local reference)
  3. The model code is generated and installed.

Model lifecycle overview

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

Last modified September 12, 2024: Remove kuksa.val and VSC references (#128) (e8ca8f3)