eclipse-kuksa / kuksa.val.services

Repository for Vehicle Service Related implementations for Eclipse SDV
Apache License 2.0
15 stars 17 forks source link

KUKSA.VAL.services

Use of this repository is deprecated

Parts of this repository has been migrated to the eclipse-kuksa Github organization as described below. This repository is planned to be archived in the long term. Note that not everything in this repository has been migrated, some parts are considered obsolete and are not planned for migration. If you are missing something please add an issue here or in the new repositories.

Service New Location
HVAC Service https://github.com/eclipse-kuksa/kuksa-incubation/hvac_service
Seat Service https://github.com/eclipse-kuksa/kuksa-incubation/seat_service
Mock Service https://github.com/eclipse-kuksa/kuksa-mock-provider

Content

Overview

This repository provides you a set of example vehicle services showing how to define and implement these important pieces of the Eclipse KUKSA Vehicle Abstraction Layer (VAL). KUKSA.val is offering a Vehicle API, which is an abstraction of vehicle data and functions to be used by Vehicle Apps. Vehicle data is provided in form of a data model, which is accessible via the KUKSA.val Databroker. Vehicle functions are made available by a set of so-called vehicle services (short: vservice).

You'll find a more detailed overview here.

This repository contains examples of vservices and their implementations to show, how a Vehicle API and the underlying abstraction layer could be realized. It currently consists of

More elaborate or completely differing implementations are target of "real world grown" projects.

Contribution

For contribution guidelines see CONTRIBUTING.md

If you want to define and implement your own vehicle services, there are two guidelines/how-tos available:

Build Seat Service Containers

:construction_worker_woman: :construction: This section may be a bit outdated. So, please take care! :construction: :construction_worker_man:

NOTE: Following steps are tested on Ubuntu 20.04 and x86_64. Building on aarch64 host is not supported. For other options check Seat Service README.md

The image creation may take around 2 minutes.

Running Seat Service / Data Broker Containers

To directly run the containers following commands can be used:

  1. Seat Service container

    By default the container will execute the ./val_start.sh script, that sets default environment variables for seat service. It needs CAN environment variable with special value cansim (to use simulated socketcan calls) or any valid can device within the container.

    # executes ./va_start.sh
    docker run --rm -it -p 50051:50051/tcp seat-service

    To run any specific command in the container, just append you command (e.g. bash) at the end.

    docker run --rm -it -p 50051:50051/tcp seat-service <command>

For accessing data broker from seat service container there are two ways of running the containers.

  1. The simplest way to run the containers is to sacrifice the isolation a bit and run all the containers in the host's network namespace with docker run --network host

    #By default the container will execute the ./vehicle-data-broker command as entrypoint.
    docker run --rm -it --network host -e 'RUST_LOG=info,vehicle_data_broker=debug' databroker
    #By default the container will execute the ./val_start.sh command as entrypoint
    docker run --rm -it --network host seat-service
  2. There is a more subtle way to share a single network namespace between multiple containers. So, we can start a sandbox container that will do nothing but sleep and reusing a network namespace of an this existing container:

    #Run sandbox container
    docker run -d --rm --name sandbox -p 55555:55555 alpine sleep infinity
    #Run databroker container
    docker run --rm -it --network container:sandbox -e HOST=0.0.0.0 -e PORT=55555 databroker
    #Run seat-service container
    docker run --rm -it --network container:sandbox -e HOST=0.0.0.0 -e PORT=55555 -e PORT=50051  seat-service
  3. Another option is to use <container-name>:<port> and bind to 0.0.0.0 inside containers

KUKSA.val and VSS version dependency

The service examples and related tests in this repository use VSS signals. VSS signals may change over time, and backward incompatible changes may be introduced as part of major releases. Some of the tests in this repository relies on using latest version of KUKSA.val Databroker and KUKSA.val DBC Feeder. Some code in the repository (like Proto definitions) have been copied from KUKSA.val.

This means that regressions may occur when KUKSA.val or KUKSA.val Feeders are updated. The intention for other KUKSA.val repositories is to use the latest official VSS release as default. There is a script for manual updating of KUKSA.val proto files: update-protobuf.sh.

cd integration_test/
./update-protobuf.sh --force

Seat Service currently supports 2 modes: (VSS 3.X and 4.0). As part of VSS 4.0 the instance scheme for seat positions was changed to be based on DriverSide/Middle/PassengerSide rather than Pos1, Pos2, Pos3.

By default Seat Service uses VSS 4.0 seat position, but for older dependencies it can be changed to VSS 3.X compatible by setting Environment variable VSS=3 for seat service container / cmdline.

Known locations where an explicit VSS or KUKSA.val version is mentioned

NOTE: Above mentioned locations should be checked for breaking VSS changes on master.