summaryrefslogtreecommitdiffstats
path: root/recipes-demo/kuksa-vss-init
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2024-01-04 19:26:19 -0500
committerScott Murray <scott.murray@konsulko.com>2024-01-05 16:40:12 +0000
commitae1ebd3ab2b5c3d5ea8ed8fc55915c070e629743 (patch)
tree11ec593ea40e05235f6469161ec609f03c7a9ebd /recipes-demo/kuksa-vss-init
parenta2f890dae4d3b9d49d2921576b04384cef7641d3 (diff)
kuksa-vss-init: rework into agl-vss-helper
Rework/replace the kuksa_vss_init script with a new agl-vss-helper script that uses a configuration file for the list of VSS signals and the values they should be set to. It also will run in daemon mode if the configuration includes a list of signals to perform mocking as an actuator, and push any target values back out as the current value. This avoids needing to perform hacks around directly feeding sensor values from applications for things where we do not have an existing actuator backend (e.g. HMI units values). Bug-AGL: SPEC-5042 Change-Id: I6d1e9d5fb72f7f23a3bb45fcda0a48e1a10c3863 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl-demo/+/29583 ci-image-build: Jenkins Job builder account ci-image-boot-test: Jenkins Job builder account Tested-by: Jenkins Job builder account
Diffstat (limited to 'recipes-demo/kuksa-vss-init')
-rw-r--r--recipes-demo/kuksa-vss-init/files/kuksa_vss_init.py111
-rw-r--r--recipes-demo/kuksa-vss-init/kuksa-vss-init.bb15
2 files changed, 0 insertions, 126 deletions
diff --git a/recipes-demo/kuksa-vss-init/files/kuksa_vss_init.py b/recipes-demo/kuksa-vss-init/files/kuksa_vss_init.py
deleted file mode 100644
index aa7876f6f..000000000
--- a/recipes-demo/kuksa-vss-init/files/kuksa_vss_init.py
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2022 Aakash Solanki, tech2aks@gmail.com
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy of
-# this software and associated documentation files (the "Software"), to deal in
-# the Software without restriction, including without limitation the rights to
-# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-# of the Software, and to permit persons to whom the Software is furnished to do
-# so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in all
-# copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-import kuksa_viss_client
-import time
-
-
-class VSS:
- def __init__(self, client):
- self.client = client
-
- self.speed = "Vehicle.Speed"
- self.engineRPM = "Vehicle.Powertrain.CombustionEngine.Speed"
- self.fuelLevel = "Vehicle.Powertrain.FuelSystem.Level"
- self.coolantTemp = "Vehicle.Powertrain.CombustionEngine.ECT"
- self.leftIndicator = "Vehicle.Body.Lights.IsLeftIndicatorOn"
- self.rightIndicator = "Vehicle.Body.Lights.IsRightIndicatorOn"
- # // Selected Gear output = > 0 = Neutral, 1/2/.. = Forward, -1/.. = Reverse, 126 = Park, 127 = Drive
- self.selectedGear = "Vehicle.Powertrain.Transmission.SelectedGear"
- self.lowBeamOn = "Vehicle.Body.Lights.IsLowBeamOn"
- self.highBeamOn = "Vehicle.Body.Lights.IsHighBeamOn"
- self.parkingLightOn = "Vehicle.Body.Lights.IsParkingOn"
- self.hazardLightOn = "Vehicle.Body.Lights.IsHazardOn"
- self.travelledDistance = "Vehicle.TravelledDistance"
- self.trunkLocked = "Vehicle.Body.Trunk.Rear.IsLocked"
- self.trunkOpen = "Vehicle.Body.Trunk.Rear.IsOpen"
- # // \"normal\", \"sport\", \"economy\", \"snow\", \"rain\"]
- self.performanceMode = "Vehicle.Powertrain.Transmission.PerformanceMode"
- self.ambientAirTemperature = "Vehicle.Exterior.AirTemperature"
- self.mil = "Vehicle.OBD.Status.IsMILOn"
- self.cruiseControlError = "Vehicle.ADAS.CruiseControl.IsError"
- self.cruiseControlSpeedSet = "Vehicle.ADAS.CruiseControl.SpeedSet"
- self.cruiseControlisActive = "Vehicle.ADAS.CruiseControl.IsActive"
- self.batteryChargingStatus = "Vehicle.Powertrain.TractionBattery.Charging.IsCharging"
- #
- self.currLat = "Vehicle.Cabin.CurrentLocation.Latitude"
- self.currLng = "Vehicle.Cabin.CurrentLocation.Longitude"
- self.desLat = "Vehicle.Cabin.Infotainment.Navigation.DestinationSet.Latitude"
- self.desLng = "Vehicle.Cabin.Infotainment.Navigation.DestinationSet.Longitude"
- self.steeringInfo = "Vehicle.Cabin.SteeringWheel.Switches.Info"
-
- def setInitialValues(self):
- print("Setting values")
- self.client.setValue(self.speed, '5')
- self.client.setValue(self.engineRPM, '1000')
- self.client.setValue(self.fuelLevel, '50')
- self.client.setValue(self.coolantTemp, '70')
- self.client.setValue(self.leftIndicator, "false")
- self.client.setValue(self.rightIndicator, "false")
- self.client.setValue(self.selectedGear, '127')
- self.client.setValue(self.lowBeamOn, "true")
- self.client.setValue(self.highBeamOn, "false")
- self.client.setValue(self.parkingLightOn, "true")
- self.client.setValue(self.hazardLightOn, "false")
- self.client.setValue(self.travelledDistance, '100')
- self.client.setValue(self.trunkLocked, "true")
- self.client.setValue(self.trunkOpen, "false")
- self.client.setValue(self.performanceMode, "normal")
- self.client.setValue(self.ambientAirTemperature, '28')
- self.client.setValue(self.mil, "false")
- self.client.setValue(self.cruiseControlError, "false")
- self.client.setValue(self.cruiseControlisActive, "false")
- self.client.setValue(self.cruiseControlSpeedSet, '60')
- self.client.setValue(self.batteryChargingStatus, "true")
- #
- self.client.setValue(self.currLat, "31.708643")
- self.client.setValue(self.currLng, "76.931882")
- self.client.setValue(self.desLat, "31.781456")
- self.client.setValue(self.desLng, "76.997469")
- # Show the map
- self.client.setValue(self.steeringInfo, "false")
- print("All value set succesfully")
-
-
-def main():
- config = {"ip": "localhost", "port": 8090, "insecure": False}
- client = kuksa_viss_client.KuksaClientThread(config)
- client.start()
- token_file = open(
- "/usr/lib/python3.10/site-packages/kuksa_certificates/jwt/all-read-write.json.token", "r")
- token = token_file.read()
- client.authorize(token, timeout=2)
-
- vss = VSS(client)
-
- time.sleep(2)
-
- vss.setInitialValues()
- client.stop()
-
-
-if __name__ == '__main__':
- main()
diff --git a/recipes-demo/kuksa-vss-init/kuksa-vss-init.bb b/recipes-demo/kuksa-vss-init/kuksa-vss-init.bb
deleted file mode 100644
index a2aa949af..000000000
--- a/recipes-demo/kuksa-vss-init/kuksa-vss-init.bb
+++ /dev/null
@@ -1,15 +0,0 @@
-DESCRIPTION = "Initialize the Kuksa VSS data to some constant values"
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://${WORKDIR}/kuksa_vss_init.py;beginline=2;endline=20;md5=afe8bd5e80449c5209495644133c16a8"
-
-SRC_URI = "file://kuksa_vss_init.py"
-
-do_configure[noexec] = "1"
-do_compile[noexec] = "1"
-
-do_install() {
- install -d ${D}${sbindir}
- install -m 0755 ${WORKDIR}/kuksa_vss_init.py ${D}${sbindir}
-}
-
-RDEPENDS:${PN} = "python3"