diff options
author | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2024-04-06 23:55:42 +0200 |
---|---|---|
committer | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2024-04-06 23:58:07 +0200 |
commit | 5f1c3868c5353d89eb8b3396d88d0e70f2e99ab4 (patch) | |
tree | 16a1a1db347b37b232f9b6b8e0fa6cd798a809d4 /recipes-connectivity/kuksa-val | |
parent | 68c88e1854abfa49ed98743398d64bdff7ebb3fa (diff) |
GATEWAY-EW24sandbox/jsmoeller/next-riscv-EW24
Change-Id: Ia4c741323a705692219057174e00a083a97da16d
Signed-off-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
Diffstat (limited to 'recipes-connectivity/kuksa-val')
7 files changed, 295 insertions, 1 deletions
diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0004-Enable-val2dbc-for-sensor-values.patch b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0004-Enable-val2dbc-for-sensor-values.patch new file mode 100644 index 000000000..7f22a90ad --- /dev/null +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0004-Enable-val2dbc-for-sensor-values.patch @@ -0,0 +1,142 @@ +From d6f1aaa7f26aa52f4b219f60e704d5ab2954f082 Mon Sep 17 00:00:00 2001 +From: Scott Murray <scott.murray@konsulko.com> +Date: Wed, 3 Apr 2024 02:09:11 +0900 +Subject: [PATCH] Enable val2dbc for sensor values + +Rework to allow val2dbc mode to write out sensor values in +addition to actuator target values. + +Upstream-Status: pending + +Signed-off-by: Scott Murray <scott.murray@konsulko.com> +--- + dbc2val/dbcfeeder.py | 8 ++++++-- + .../dbcfeederlib/databrokerclientwrapper.py | 18 ++++++++++++------ + dbc2val/dbcfeederlib/dbc2vssmapper.py | 14 +++++++++----- + dbc2val/dbcfeederlib/serverclientwrapper.py | 2 +- + 4 files changed, 28 insertions(+), 14 deletions(-) + +diff --git a/dbc2val/dbcfeeder.py b/dbc2val/dbcfeeder.py +index e7fd319..5e0df2f 100755 +--- a/dbc2val/dbcfeeder.py ++++ b/dbc2val/dbcfeeder.py +@@ -322,15 +322,19 @@ class Feeder: + log.debug("vss-Update callback!") + dbc_ids = set() + for update in updates: ++ value = None + if update.entry.value is not None: +- # This shall currently never happen as we do not subscribe to this + log.warning(f"Current value for {update.entry.path} is now: " + f"{update.entry.value.value} of type {type(update.entry.value.value)}") ++ value = update.entry.value.value + + if update.entry.actuator_target is not None: + log.debug(f"Target value for {update.entry.path} is now: {update.entry.actuator_target} " + f"of type {type(update.entry.actuator_target.value)}") +- new_dbc_ids = self._mapper.handle_update(update.entry.path, update.entry.actuator_target.value) ++ value = update.entry.actuator_target.value ++ ++ if value != None: ++ new_dbc_ids = self._mapper.handle_update(update.entry.path, value) + dbc_ids.update(new_dbc_ids) + + can_ids = set() +diff --git a/dbc2val/dbcfeederlib/databrokerclientwrapper.py b/dbc2val/dbcfeederlib/databrokerclientwrapper.py +index 35836e9..46ae330 100644 +--- a/dbc2val/dbcfeederlib/databrokerclientwrapper.py ++++ b/dbc2val/dbcfeederlib/databrokerclientwrapper.py +@@ -200,14 +200,20 @@ class DatabrokerClientWrapper(clientwrapper.ClientWrapper): + def supports_subscription(self) -> bool: + return True + +- async def subscribe(self, vss_names: List[str], callback): ++ async def subscribe(self, vss_entries: dict[str, str], callback): + """Creates a subscription and calls the callback when data received""" + entries = [] +- for name in vss_names: +- # Always subscribe to target +- subscribe_entry = SubscribeEntry(name, View.FIELDS, [Field.ACTUATOR_TARGET]) +- log.info(f"Subscribe entry: {subscribe_entry}") +- entries.append(subscribe_entry) ++ for name, signal_type in vss_entries.items(): ++ if signal_type == "actuator": ++ subscribe_entry = SubscribeEntry(name, View.FIELDS, [Field.ACTUATOR_TARGET]) ++ log.info(f"Subscribe entry: {subscribe_entry}") ++ entries.append(subscribe_entry) ++ if signal_type == "sensor": ++ subscribe_entry = SubscribeEntry(name, View.FIELDS, [Field.VALUE]) ++ log.info(f"Subscribe entry: {subscribe_entry}") ++ entries.append(subscribe_entry) ++ if not entries: ++ return + + # If there is a path VSSClient will request a secure connection + if self._tls and self._root_ca_path: +diff --git a/dbc2val/dbcfeederlib/dbc2vssmapper.py b/dbc2val/dbcfeederlib/dbc2vssmapper.py +index 5142a5e..8f04cdd 100644 +--- a/dbc2val/dbcfeederlib/dbc2vssmapper.py ++++ b/dbc2val/dbcfeederlib/dbc2vssmapper.py +@@ -61,12 +61,13 @@ class VSSMapping: + parser: Parser = Parser() + + def __init__(self, vss_name: str, dbc_name: str, transform: dict, interval_ms: int, +- on_change: bool, datatype: str, description: str): ++ on_change: bool, signal_type: str, datatype: str, description: str): + self.vss_name = vss_name + self.dbc_name = dbc_name + self.transform = transform + self.interval_ms = interval_ms + self.on_change = on_change ++ self.signal_type = signal_type + self.datatype = datatype + self.description = description + # For time comparison (interval_ms) we store last value used for comparison. Unit seconds. +@@ -282,7 +283,7 @@ class Mapper: + log.info(f"Using default interval 1000 ms for {expanded_name}") + interval = 1000 + mapping_entry = VSSMapping(expanded_name, dbc_name, transform, interval, on_change, +- node["datatype"], node["description"]) ++ node["type"], node["datatype"], node["description"]) + if dbc_name not in self.dbc2val_mapping: + self.dbc2val_mapping[dbc_name] = [] + self.dbc2val_mapping[dbc_name].append(mapping_entry) +@@ -306,7 +307,7 @@ class Mapper: + log.warning(f"interval_ms attribute ignored for {expanded_name}") + + mapping_entry = VSSMapping(expanded_name, dbc_name, transform, interval, on_change, +- node["datatype"], node["description"]) ++ node["type"], node["datatype"], node["description"]) + if dbc_name not in self.val2dbc_mapping: + self.val2dbc_mapping[expanded_name] = [] + self.val2dbc_mapping[expanded_name].append(mapping_entry) +@@ -380,9 +381,12 @@ class Mapper: + """Return a set of all dbc names used for reception""" + return self.dbc2val_mapping.keys() + +- def get_val2dbc_entries(self) -> KeysView: ++ def get_val2dbc_entries(self) -> Dict[str, str]: + """Return a set of all vss names used for reception""" +- return self.val2dbc_mapping.keys() ++ entries: Dict[str, str] = {} ++ for name, mappings in self.val2dbc_mapping.items(): ++ entries[name] = mappings[0].signal_type ++ return entries + + def get_vss_names(self) -> Set[str]: + """Get all VSS names used in mappings, both vss2dbc and dbc2vss""" +diff --git a/dbc2val/dbcfeederlib/serverclientwrapper.py b/dbc2val/dbcfeederlib/serverclientwrapper.py +index 63bc12e..ca11daf 100644 +--- a/dbc2val/dbcfeederlib/serverclientwrapper.py ++++ b/dbc2val/dbcfeederlib/serverclientwrapper.py +@@ -125,6 +125,6 @@ class ServerClientWrapper(clientwrapper.ClientWrapper): + log.info("Feature not implemented") + return False + +- async def subscribe(self, vss_names: List[str], callback): ++ async def subscribe(self, vss_entries: dict[str, str], callback): + log.error("Feature not implemented") + return +-- +2.34.1 + diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/agl-vcar.dbc b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/agl-vcar.dbc index 0d0121398..e638d1287 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/agl-vcar.dbc +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/agl-vcar.dbc @@ -10,6 +10,44 @@ BO_ 985 Vehicle_Status_2: 8 Vector_XXX SG_ PT_EngineSpeed : 23|16@0+ (0.25,0) [0|0] "" Vector_XXX SG_ PT_FuelLevelLow : 55|1@1+ (1,0) [0|1] "" Vector_XXX +BO_ 986 Vehicle_Status_3: 8 Vector_XXX + SG_ PT_HazardOn : 0|1@1+ (1,0) [0|1] "" Vector_XXX + SG_ PT_LeftTurnOn : 1|1@1+ (1,0) [0|1] "" Vector_XXX + SG_ PT_RightTurnOn : 2|1@1+ (1,0) [0|1] "" Vector_XXX + +BO_ 48 HVAC_Control_1: 8 Vector_XXX + SG_ PT_TempLeft : 7|8@0+ (0.4166666667,0) [0|100] "C" Vector_XXX + SG_ PT_TempRight : 15|8@0+ (0.4166666667,0) [0|100] "C" Vector_XXX + SG_ PT_FanSpeed : 39|8@0+ (0.392157,0) [0|100] "%" Vector_XXX + +BO_ 401 Engine: 8 Vector__XXX + SG_ ThrottlePosition : 63|8@0+ (0.392157,0) [0|100.000035] "%" Vector__XXX + +BO_ 381 ABS: 8 Vector__XXX + SG_ VehicleSpeed : 7|12@0+ (0.0625,0) [0|255.9375] "km / h" ECM_HS,BCM_HS + SG_ SteeringPosition : 23|12@0+ (0.0439453125,-90) [-90|89.9560546875] "deg" ECM_HS,BCM_HS + SG_ BrakePressure : 39|8@0+ (75,0) [0|19125] "kPa" ECM_HS,BCM_HS + +BO_ 532 Transmission: 8 Vector__XXX + SG_ Gear : 7|8@0+ (1,-1) [-1|127] "" ECM_HS,BCM_HS + +BO_ 533 Airbag: 8 Vector__XXX + SG_ CollisionIntensity : 7|12@0+ (24.4140625,0) [0|100000] "N" ECM_HS,BCM_HS + +BO_ 534 IMU1: 8 Vector__XXX + SG_ AccelerationX : 7|12@0+ (0.48828125,-1000) [-1000|1000] "m/s^2" ECM_HS,BCM_HS + SG_ AccelerationY : 23|12@0+ (0.48828125,-1000) [-1000|1000] "m/s^2" ECM_HS,BCM_HS + SG_ AccelerationZ : 39|12@0+ (0.48828125,-1000) [-1000|1000] "m/s^2" ECM_HS,BCM_HS + +BO_ 535 IMU2: 8 Vector__XXX + SG_ GyroscopeX : 7|12@0+ (0.48828125,-1000) [-1000|1000] "rad/s" ECM_HS,BCM_HS + SG_ GyroscopeY : 23|12@0+ (0.48828125,-1000) [-1000|1000] "rad/s" ECM_HS,BCM_HS + SG_ GyroscopeZ : 39|12@0+ (0.48828125,-1000) [-1000|1000] "rad/s" ECM_HS,BCM_HS + +BO_ 536 GNSS: 8 Vector__XXX + SG_ Latitude : 7|32@0+ (0.0000000419095158577,-90) [-90|90] "deg" ECM_HS,BCM_HS + SG_ Longitude : 39|32@0+ (0.00000008381903171539,-180) [-180|180] "deg" ECM_HS,BCM_HS + BO_ 33 Steering_Wheel: 8 Vector_XXX SG_ SW_Previous : 39|1@1+ (1,0) [0|1] "" Vector_XXX SG_ SW_VolumeUp : 38|1@1+ (1,0) [0|1] "" Vector_XXX diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/agl-vcar.dbc.bak.20240405 b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/agl-vcar.dbc.bak.20240405 new file mode 100644 index 000000000..1924fade1 --- /dev/null +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/agl-vcar.dbc.bak.20240405 @@ -0,0 +1,64 @@ +VERSION "AGL Virtual Car 1.0" + +BS_: + +BO_ 1001 Vehicle_Status_1: 8 Vector_XXX + SG_ PT_VehicleAvgSpeed : 7|15@0+ (0.015625,0) [0|0] "" Vector_XXX + +BO_ 985 Vehicle_Status_2: 8 Vector_XXX + SG_ PT_FuelLevelPct : 8|8@1+ (0.392157,0) [0|0] "" Vector_XXX + SG_ PT_EngineSpeed : 23|16@0+ (0.25,0) [0|0] "" Vector_XXX + SG_ PT_FuelLevelLow : 55|1@1+ (1,0) [0|1] "" Vector_XXX + +BO_ 48 HVAC_Control_1: 8 Vector_XXX + SG_ PT_TempLeft : 7|8@0+ (0.4166666667,0) [0|100] "C" Vector_XXX + SG_ PT_TempRight : 15|8@0+ (0.4166666667,0) [0|100] "C" Vector_XXX + SG_ PT_FanSpeed : 31|8@0+ (0.392157,0) [0|100] "%" Vector_XXX + +BO_ 401 Engine: 8 Vector__XXX + SG_ ThrottlePosition : 63|8@0+ (0.392157,0) [0|100.000035] "%" Vector__XXX + +BO_ 381 ABS: 8 Vector__XXX + SG_ VehicleSpeed : 7|12@0+ (0.0625,0) [0|255.9375] "km / h" ECM_HS,BCM_HS + SG_ SteeringPosition : 23|12@0+ (0.0439453125,-90) [-90|89.9560546875] "deg" ECM_HS,BCM_HS + SG_ BrakePressure : 39|8@0+ (75,0) [0|19125] "kPa" ECM_HS,BCM_HS + +BO_ 532 Transmission: 8 Vector__XXX + SG_ Gear : 7|8@0+ (1,-1) [-1|127] "" ECM_HS,BCM_HS + +BO_ 533 Airbag: 8 Vector__XXX + SG_ CollisionIntensity : 7|12@0+ (24.4140625,0) [0|100000] "N" ECM_HS,BCM_HS + +BO_ 534 IMU1: 8 Vector__XXX + SG_ AccelerationX : 7|12@0+ (0.48828125,-1000) [-1000|1000] "m/s^2" ECM_HS,BCM_HS + SG_ AccelerationY : 23|12@0+ (0.48828125,-1000) [-1000|1000] "m/s^2" ECM_HS,BCM_HS + SG_ AccelerationZ : 39|12@0+ (0.48828125,-1000) [-1000|1000] "m/s^2" ECM_HS,BCM_HS + +BO_ 535 IMU2: 8 Vector__XXX + SG_ GyroscopeX : 7|12@0+ (0.48828125,-1000) [-1000|1000] "rad/s" ECM_HS,BCM_HS + SG_ GyroscopeY : 23|12@0+ (0.48828125,-1000) [-1000|1000] "rad/s" ECM_HS,BCM_HS + SG_ GyroscopeZ : 39|12@0+ (0.48828125,-1000) [-1000|1000] "rad/s" ECM_HS,BCM_HS + +BO_ 536 GNSS: 8 Vector__XXX + SG_ Latitude : 7|32@0+ (0.0000000419095158577,-90) [-90|90] "deg" ECM_HS,BCM_HS + SG_ Longitude : 39|32@0+ (0.00000008381903171539,-180) [-180|180] "deg" ECM_HS,BCM_HS + +BO_ 33 Steering_Wheel: 8 Vector_XXX + SG_ SW_Previous : 39|1@1+ (1,0) [0|1] "" Vector_XXX + SG_ SW_VolumeUp : 38|1@1+ (1,0) [0|1] "" Vector_XXX + SG_ SW_Mode : 37|1@1+ (1,0) [0|1] "" Vector_XXX + SG_ SW_VolumeDown : 36|1@1+ (1,0) [0|1] "" Vector_XXX + SG_ SW_Next : 35|1@1+ (1,0) [0|1] "" Vector_XXX + SG_ SW_Info : 33|1@1+ (1,0) [0|1] "" Vector_XXX + SG_ SW_VolumeMute : 32|1@1+ (1,0) [0|1] "" Vector_XXX + SG_ SW_Voice : 42|1@1+ (1,0) [0|1] "" Vector_XXX + SG_ SW_PhoneHangup : 41|1@1+ (1,0) [0|1] "" Vector_XXX + SG_ SW_PhoneCall : 40|1@1+ (1,0) [0|1] "" Vector_XXX + SG_ SW_CruiseEnable : 55|1@1+ (1,0) [0|1] "" Vector_XXX + SG_ SW_CruiseResume : 54|1@1+ (1,0) [0|1] "" Vector_XXX + SG_ SW_CruiseSet : 52|1@1+ (1,0) [0|1] "" Vector_XXX + SG_ SW_CruiseCancel : 51|1@1+ (1,0) [0|1] "" Vector_XXX + SG_ SW_CruiseLimit : 49|1@1+ (1,0) [0|1] "" Vector_XXX + SG_ SW_CruiseDistance : 48|1@1+ (1,0) [0|1] "" Vector_XXX + SG_ SW_Horn : 63|1@1+ (1,0) [0|1] "" Vector_XXX + SG_ SW_LaneDepartureWarning : 56|1@1+ (1,0) [0|1] "" Vector_XXX diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/dbc_default_values.json b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/dbc_default_values.json new file mode 100644 index 000000000..0562569db --- /dev/null +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/dbc_default_values.json @@ -0,0 +1,40 @@ +{ + "PT_VehicleAvgSpeed" : 0, + "PT_FuelLevelPct" : 0, + "PT_EngineSpeed" : 0, + "PT_FuelLevelLow" : 0, + "PT_TempLeft" : 0, + "PT_TempRight" : 0, + "PT_FanSpeed" : 0, + "ThrottlePosition" : 0, + "VehicleSpeed" : 0, + "SteeringPosition" : 0, + "BrakePressure" : 0, + "Gear" : 0, + "AccelerationX" : 0, + "AccelerationY" : 0, + "AccelerationZ" : 0, + "GyroscopeX" : 0, + "GyroscopeY" : 0, + "GyroscopeZ" : 0, + "Latitude" : 0, + "Longitude" : 0, + "SW_Previous" : 0, + "SW_VolumeUp" : 0, + "SW_Mode" : 0, + "SW_VolumeDown" : 0, + "SW_Next" : 0, + "SW_Info" : 0, + "SW_VolumeMute" : 0, + "SW_Voice" : 0, + "SW_PhoneHangup" : 0, + "SW_PhoneCall" : 0, + "SW_CruiseEnable" : 0, + "SW_CruiseResume" : 0, + "SW_CruiseSet" : 0, + "SW_CruiseCancel" : 0, + "SW_CruiseLimit" : 0, + "SW_CruiseDistance" : 0, + "SW_Horn" : 0, + "SW_LaneDepartureWarning" : 0 +} diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/kuksa-dbc-feeder.env b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/kuksa-dbc-feeder.env new file mode 100644 index 000000000..5d787158d --- /dev/null +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/kuksa-dbc-feeder.env @@ -0,0 +1,3 @@ +# For output only mode: +#EXTRA_ARGS="--val2dbc --no-dbc2val --dbc-default /etc/kuksa-dbc-feeder/dbc_default_values.json" +#LOG_LEVEL=debug diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/kuksa-dbc-feeder.service b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/kuksa-dbc-feeder.service index a30018c6f..857f5c7d2 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/kuksa-dbc-feeder.service +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/kuksa-dbc-feeder.service @@ -4,7 +4,8 @@ Requires=kuksa-databroker.service can-dev-helper.service After=kuksa-databroker.service can-dev-helper.service [Service] -ExecStart=/usr/bin/dbcfeeder.py +EnvironmentFile=-/etc/default/kuksa-dbc-feeder +ExecStart=/usr/bin/dbcfeeder.py $EXTRA_ARGS Restart=on-failure [Install] diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder_git.bb b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder_git.bb index 809152bb0..e598a23e3 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder_git.bb +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder_git.bb @@ -13,10 +13,13 @@ SRC_URI = "git://github.com/eclipse/kuksa.val.feeders.git;protocol=https;branch= file://0001-dbc2val-add-installation-mechanism.patch \ file://0002-dbc2val-usability-improvements.patch \ file://0003-dbc2val-fix-token-file-configuration-option.patch \ + file://0004-Enable-val2dbc-for-sensor-values.patch \ file://config.ini \ file://dbc_feeder.token \ file://agl-vcar.dbc \ + file://dbc_default_values.json \ file://kuksa-dbc-feeder.service \ + file://kuksa-dbc-feeder.env \ " SRCREV = "5bb52eca8d79f7c05a024f69b1faab81dabacdcd" @@ -36,6 +39,9 @@ do_install:append() { # investigation. install -m 0600 ${WORKDIR}/dbc_feeder.token ${D}${sysconfdir}/kuksa-dbc-feeder/ install -m 0644 ${WORKDIR}/agl-vcar.dbc ${D}${sysconfdir}/kuksa-dbc-feeder/ + install -m 0644 ${WORKDIR}/dbc_default_values.json ${D}${sysconfdir}/kuksa-dbc-feeder/ + install -d ${D}${sysconfdir}/default + install -m 0644 ${WORKDIR}/kuksa-dbc-feeder.env ${D}${sysconfdir}/default/kuksa-dbc-feeder if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then install -d ${D}${systemd_system_unitdir} install -m 0644 ${WORKDIR}/kuksa-dbc-feeder.service ${D}${systemd_system_unitdir} |