Vehicle Model Creation

Learn how to create a Vehicle Model to access vehicle data or execute remote procedure calls.

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

Prerequisites

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.

  1. Clone the vehicle-model-generator repository in a container volume.

  2. 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.

  3. 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 python and cpp, this creates a sdv_model directory 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 lang:

    lang output
    python python sources and a setup.py ready to be used as python package
    cpp 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.

  4. For python: Change the version of package in setup.py manually (defaults to 0.1.0).

  5. Now the newly generated sdv_model can 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.

Further information


C++ Manual Vehicle Model Creation

Learn how to create a Vehicle Model manually for C++

Python Manual Vehicle Model Creation

Learn how to create a Vehicle Model manually for python

Vehicle Model Distribution

Learn how to distribute a Vehicle Model.

Last modified January 17, 2023: Changed overview picture (#51) (ea5274b)