Skip to content

Commit

Permalink
Merge branch 'COVESA:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
UlfBj authored Apr 26, 2024
2 parents afa2a8d + 6a0a007 commit ac5eede
Show file tree
Hide file tree
Showing 93 changed files with 20,469 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,10 @@ logs/
/client/client-1.0/grpc_client/grpc_map_client/static/node_modules/
/client/client-1.0/grpc_client/grpc_client
/client/client-1.0/client-1.0
/server/vissv2server/vss_vissv2_t.binary
/server/vissv2server/atServer/purposelist_t.json
/client/client-1.0/csv_client/csv_client
/client/client-1.0/csv_client/data.csv
/client/client-1.0/csv_client/data_curve_speed_maxerr_2.csv
/client/client-1.0/csv_client/data_curver_speed_maxerr_1.csv
/client/client-1.0/csv_client/data_nocurve.csv
1 change: 1 addition & 0 deletions Dockerfile.rlserver
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ COPY --from=builder /build/server/vissv2server/atServer/scopelist.json atServer/
COPY --from=builder /build/server/vissv2server/uds-registration.docker.json uds-registration.json
COPY --from=builder /build/server/vissv2server/iotdb-config.json iotdb-config.json
COPY --from=builder /build/server/vissv2server/vss_vissv2.binary .
COPY --from=builder /build/server/vissv2server/serviceMgr/signaldimension.json .
COPY --from=builder /build/server/agt_server/agt_public_key.rsa .

ENTRYPOINT ["/app/vissv2server","-s","redis"]
Expand Down
98 changes: 98 additions & 0 deletions client/android/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Integrating VISS towards Android service/application

## What is this application or service enables?
This application/service operates within the native environment of Android Automotive OS (AAOS) and leverages COVESA VISS APIs, employing both gRPC and HTTP protocols, to securely access a predefined set of vehicle sensor datasets. These datasets empower the application to compute a safety score for the driver, aiding in real-time assessment of driving behavior.The primary aim of this service is not to merely excel as an application, but rather to address a prevalent industry challenge: how original equipment manufacturers (OEMs) can securely grant access to specific datasets—be it for reading, writing, or both—to their respective clients or consumers. This is achieved by adhering to Open Vehicle data standards, with VSS (Vehicle Signal Specification) serving as the vehicle data model, and VISS (Vehicle Interface Service Specification) acting as the service for accessing vehicle data.
Android Automotive serves as the standard infotainment system, offering a platform for seamless integration and utilization of these APIs. The purpose of the Android application is to consume these APIs and visualize the data for the audience, facilitating a comprehensive demonstration of the capabilities enabled by the integration of COVESA VISS APIs within the automotive ecosystem.

## How does this concept empowers Digital services for Automotive?
The value of vehicle data inherently increases with its usage, especially when accessible in an open environment without compromising security and privacy. This openness cultivates innovation for digital service providers operating within the automotive sector. Establishing a robust framework for vehicle data consent and privacy, coupled with the adoption of open Vehicle APIs like VISS, holds the potential to empower digital services in the automotive space.

## Why not use Android Automotive Car API/Sensor API which is standard for same purpose?
Purpose of this demo is not to entirely replace AAOS stack but try to address some of limitations that AAOS system have with vehicle data access which is limited to system applications.

VISS/gRPC was also used towards Vehicle HAL that populate entire AAOS Vehicle properties

Following guide provides step-by-step instructions on setting up containerized environment & integrating your Android application with COVESA/VISS gRPC APIs.


## Steps to setup containerized ecosystem environment

### Step 1: Configure RemotiveLabs virtual cloud endpoints towards feeder component
Configure feeder to use RemotiveLabs virtual sensor cloud for Vehicle drive playback support

https://github.com/COVESA/vissr/blob/master/feeder/feeder-rl/README.md

Free access to cloud console : https://cloud.remotivelabs.com

### Step 2: Configure Security policy files for access control in Access token server

Populate purpose list with VSS data points & access control

https://github.com/COVESA/vissr/blob/master/server/vissv2server/atServer/purposelist.json

Use following purpose 'ubi-sensor-status'

{"purposes":
[{"short": "ubi-sensor-status",
"long": "Sensor data for insurance provider to enable Usage Based Insurance premium",
"contexts":[ {"user":"Independent", "app":"OEM", "device":"Vehicle"}],
"signal_access":
[{"path": "Vehicle.Speed", "access_permission": "read-only"},
{"path": "Vehicle.CurrentLocation.Heading", "access_permission": "read-only"},
{"path": "Vehicle.CurrentLocation.Latitude", "access_permission": "read-only"},
{"path": "Vehicle.CurrentLocation.Longitude", "access_permission": "read-only"},
{"path": "Vehicle.Chassis.SteeringWheel.Angle", "access_permission": "read-only"},
{"path": "Vehicle.Driver.IsHandsOnWheel", "access_permission": "read-only"},
{"path": "Vehicle.ADAS.ActiveAutonomyLevel", "access_permission": "read-only"},
{"path": "Vehicle.ADAS.CruiseControl.IsActive", "access_permission": "read-only"},
{"path": "Vehicle.ADAS.LaneDepartureDetection.IsWarning", "access_permission": "read-only"},
{"path": "Vehicle.TraveledDistance", "access_permission": "read-only"},
{"path": "Vehicle.Powertrain.Transmission.CurrentGear", "access_permission": "read-only"},
{"path": "Vehicle.Cabin.Seat.Row1.DriverSide.IsBelted", "access_permission": "read-only"}]
}]
}

### Step 3: Enabled access-control tagging to each VSS nodes & Generate vss_vissv2.binary
For VISS server to support access control, it is essential to tag VSS datapoints with access control mode with 'validate' attribute.

Access control tagging at https://github.com/renjithrajagopal-sudo/vehicle_signal_specification/commit/ccd0475327b057f75fa4a796b9Should 67315bdb6620db

After tagging vss_vissv2.binary shall be generated with tagged VSS by executing $make binary from https://github.com/renjithrajagopal-sudo/vehicle_signal_specification

Copy generated vss_vissv2.binary to location https://github.com/COVESA/vissr/tree/master/server/vissv2server

### Step 4: Build docker for AGT/AT/VISS server

Build AGT docker : https://github.com/COVESA/vissr/blob/master/docker/agt-docker/Readme.md

Build VISS/AT docker : https://github.com/COVESA/vissr/blob/master/docker/README.md

### Step 5: Integrate VISS proto towards Android Application

Download any Android Automotive OS Emulator. E.g Snapp Automotive Emulator available : https://github.com/snappautomotive/README

Android application could leverage VISS protobuf files shared at https://github.com/COVESA/vissr/tree/master/grpc_pb

Build & install the APK using Android Studio by opening project : https://github.com/COVESA/vissr/tree/master/client/android/covesa-vissr-app-demo

Application uses following APIs to get access to Vehicle sensor data

1. Request for Access Grant Token(AGT) using HTTP POST request : https://github.com/COVESA/vissr/blob/master/server/agt_server/README.md
2. Request for Access Token(AT) using HTTP POST request with AGT as input : https://github.com/COVESA/vissr/blob/master/server/vissv2server/atServer/README.md
3. Subscribe for Multiple VSS datapoints with Access Token(AT) : https://www.w3.org/TR/viss2-core/#multiple-signals-request


## Steps to run programs

### Step 1 : Start RemotiveLabs vehicle sensor data drive recording
### Step 2 : Run AGT docker & VISS server docker in local host PC hosted at 127.0.0.1
### Step 3 : Starts Android Emulator & do reverse port forwarding via adb that establish TCP communication between Android device & local host PC

$adb reverse tcp:8887 tcp:8887 -> VISS server
$adb reverse tcp:7500 tcp:7500 -> AGT server
$adb reverse tcp:8600 tcp:8600 -> AT server

### Step 4 : Run the application
### Step 5 : Play RemotiveLabs vehicle drive recording
### Step 6 : Application shall get updates of VSS datapoints subscribed

85 changes: 85 additions & 0 deletions client/android/covesa-vissr-app-demo/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.jetbrainsKotlinAndroid)
}

android {
namespace = "com.vissr.safetyscore"
compileSdk = 34

defaultConfig {
applicationId = "com.vissr.safetyscore"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.1"
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

dependencies {

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)

// Koin
implementation("io.insert-koin:koin-android:3.1.2")

// gRPC dependencies
implementation("io.grpc:grpc-okhttp:1.47.0")
implementation("io.grpc:grpc-protobuf-lite:1.47.0")
implementation("io.grpc:grpc-stub:1.46.0")
implementation("io.grpc:grpc-kotlin-stub:1.3.0")
implementation("com.google.protobuf:protobuf-kotlin-lite:3.21.2")

// Retrofit
implementation(libs.squareup.retrofit)
implementation(libs.squareup.retrofit.converter.gson)
implementation(libs.squareup.retrofit.converter.scalars)

}
21 changes: 21 additions & 0 deletions client/android/covesa-vissr-app-demo/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Loading

0 comments on commit ac5eede

Please sign in to comment.