Skip to main content

Generates a language-specific data model out of VSS vspec files

Project description

Velocitas Vehicle Model Generator

License: Apache

About

This generator creates a vehicle model from the given vspec specification for the target programming language.

Supported languages

  • Python 3
  • C++

Supported VSS versions

  • 3.0
  • 3.1
  • 3.1.1
  • 4.0

Usage

Invoke the src/velocitas/model_generator/cli.py script with the path to the vspec or json file you wish to generate code for, additionally passing include pathes to directories which contain referenced vspec files. You need a units.yaml in the same directory. If you want to use the default one see here. For stability use release branch with tags. For example branch release/4.0.

python3 src/velocitas/model_generator/cli.py -I <path_to_dir_with_included_vspec_files> <path_to_your_vspec_file>

or

python3 src/velocitas/model_generator/cli.py <path_to_your_json_file>

Example

git clone -b v3.1 https://github.com/COVESA/vehicle_signal_specification.git
python3 src/velocitas/model_generator/cli.py -I ./vehicle_signal_specification/spec ./vehicle_signal_specification/spec/VehicleSignalSpecification.vspec

Or use VSCode Launch: Press F5, select Python or cpp and pass in the include directory and input file path.

Arguments

Argument Description
-h, --help show this help message and exit
-I dir, --include-dir dir Add include directory to search for included vspec files.
-T TARGET_FOLDER, --target-folder TARGET_FOLDER The folder name (with relative path) where the code will be generated into.
-N PACKAGE_NAME, --package-name PACKAGE_NAME Name of the root module/package (Python) or root namespace (C++).
-s, --strict Use strict checking: Terminate when anything not covered or not recommended by the core VSS specs is found.
-l {python}, --language {python} The target language of the generated code.
-o OVERLAY_FILE, --overlays OVERLAY_FILE Add overlays that will be layered on top of the VSS file in the order they appear.
-u UNITS, --units UNITS The file location of units file. If left empty it tries downloading default units file from https://github.com/COVESA/vehicle_signal_specification/blob/v4.0/spec/units.yaml.
-e EXTENDED_ATTRIBUTES,
--extended-attributes EXTENDED_ATTRIBUTES
Whitelisted extended attributes as comma separated list. Note, that extended attributes aren't considered by the generator. This paramter is only for suppressing warnings/errors."

Known issues

VSS v3.0 has a typo in its specification. This clashes with vss tools 4.0 which is needed to support VSS v4.0 because it allows only lower case versions for types of signals. e.g the problem is with 'actuator' instead of 'Actuator' in https://github.com/COVESA/vehicle_signal_specification/blob/525e2bd00ddf061851bdc75e849178e5d3ad5833/spec/Powertrain/Battery.vspec#L229. Json files work just fine. See https://github.com/COVESA/vehicle_signal_specification/releases for getting the json files.

Contribution

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

velocitas_model_generator-0.7.1.tar.gz (43.5 kB view hashes)

Uploaded Source

Built Distribution

velocitas_model_generator-0.7.1-py3-none-any.whl (33.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page