From 34507cc363eb04bfae36f9a1e9606c32ad5f719c Mon Sep 17 00:00:00 2001 From: Scott Murray Date: Mon, 6 Jun 2022 20:02:33 -0400 Subject: [PATCH] kuksa-dbc-feeder-sllin: add recipe Add kuksa-dbc-feeder-sllin recipe to install systemd unit and configuration file to run a second copy of the KUKSA.val DBC feeder against the demo setup's sllin0 interface. The systemd unit will bring up the sllin0 interface by a call to the can-dev-helper.sh script if run on hardware that lacks the LIN adapter. Additionally, the DBC feeder mapping configuration has been updated with the mappings for the steering wheel LIN events, and kuksa-dbc-feeder-sllin has been added to the agl-demo-preload packagegroup for the full AGL demo setup. Bug-AGL: SPEC-4405 Signed-off-by: Scott Murray Change-Id: Ief38c4dcccda899cdef24881b292928e607dda14 --- .../kuksa-val/can-dev-helper/can-dev-helper.sh | 3 + .../kuksa-val/kuksa-dbc-feeder-sllin.bb | 34 +++++++++ .../kuksa-dbc-feeder-sllin/config-sllin.ini | 15 ++++ .../kuksa-dbc-feeder-sllin.service | 12 ++++ .../kuksa-val/kuksa-dbc-feeder/mapping.yml | 83 ++++++++++++++++++++++ .../packagegroups/packagegroup-agl-demo-preload.bb | 5 ++ 6 files changed, 152 insertions(+) create mode 100644 recipes-connectivity/kuksa-val/kuksa-dbc-feeder-sllin.bb create mode 100644 recipes-connectivity/kuksa-val/kuksa-dbc-feeder-sllin/config-sllin.ini create mode 100644 recipes-connectivity/kuksa-val/kuksa-dbc-feeder-sllin/kuksa-dbc-feeder-sllin.service diff --git a/recipes-connectivity/kuksa-val/can-dev-helper/can-dev-helper.sh b/recipes-connectivity/kuksa-val/can-dev-helper/can-dev-helper.sh index de9894d76..69dc62831 100644 --- a/recipes-connectivity/kuksa-val/can-dev-helper/can-dev-helper.sh +++ b/recipes-connectivity/kuksa-val/can-dev-helper/can-dev-helper.sh @@ -15,6 +15,9 @@ vcan_up() { } CONF=/etc/kuksa-dbc-feeder/config.ini +if [ $# -gt 0 ]; then + CONF=$1 +fi if [ ! -f $CONF ]; then exit 0 diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-sllin.bb b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-sllin.bb new file mode 100644 index 000000000..0a86cbbb9 --- /dev/null +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-sllin.bb @@ -0,0 +1,34 @@ +SUMMARY = "Demo LIN configuration for DBC feeder for KUKSA.val" +HOMEPAGE = "https://github.com/eclipse/kuksa.val" +BUGTRACKER = "https://github.com/eclipse/kuksa.val/issues" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +SRC_URI += "file://config-sllin.ini \ + file://kuksa-dbc-feeder-sllin.service \ +" + +inherit allarch systemd + +SYSTEMD_SERVICE:${PN} = "${BPN}.service" + +do_install() { + # NOTE: Installing into same /etc directory as the main configuration for now, + # this may be worth re-evaluating at some point (e.g. splitting the DBC + # files, having a dedicated token, etc.). + install -d ${D}${sysconfdir}/kuksa-dbc-feeder + install -m 0644 ${WORKDIR}/config-sllin.ini ${D}${sysconfdir}/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-sllin.service ${D}${systemd_system_unitdir} + fi +} + +FILES:${PN} += "${systemd_system_unitdir}" + +RDEPENDS:${PN} += " \ + kuksa-dbc-feeder \ + can-dev-helper \ + sllin-demo \ +" diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-sllin/config-sllin.ini b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-sllin/config-sllin.ini new file mode 100644 index 000000000..66980cb58 --- /dev/null +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-sllin/config-sllin.ini @@ -0,0 +1,15 @@ +[kuksa_val] +# kuksa VSS server address +server=wss://localhost:8090 +# JWT security token file +token=/etc/kuksa-dbc-feeder/dbc_feeder.json.token +# VSS mapping file +mapping=/etc/kuksa-dbc-feeder/mapping.yml + +[can] +# CAN port +port=sllin0 +#Enable SAE-J1939 Mode. False: ignore +j1939=False +# DBC file used to parse CAN messages +dbcfile=/etc/kuksa-dbc-feeder/agl-vcar.dbc diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-sllin/kuksa-dbc-feeder-sllin.service b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-sllin/kuksa-dbc-feeder-sllin.service new file mode 100644 index 000000000..8f830de79 --- /dev/null +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder-sllin/kuksa-dbc-feeder-sllin.service @@ -0,0 +1,12 @@ +[Unit] +Description=Eclipse KUKSA.val DBC feeder (sllin0) +Requires=kuksa-val.service sllin-demo.service +After=kuksa-val.service sllin-demo.service + +[Service] +ExecStartPre=/usr/sbin/can-dev-helper.sh /etc/kuksa-dbc-feeder/config-sllin.ini +ExecStart=/usr/bin/dbcfeeder.py --config /etc/kuksa-dbc-feeder/config-sllin.ini +Restart=on-failure + +[Install] +WantedBy=multi-user.target diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/mapping.yml b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/mapping.yml index a493168d4..f8a561d27 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/mapping.yml +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/mapping.yml @@ -10,3 +10,86 @@ PT_EngineSpeed: Vehicle.Powertrain.CombustionEngine.Engine.Speed: transform: math: "floor(x+0.5)" + +SW_Next: + minupdatedelay: 500 + targets: + Vehicle.Cabin.Infotainment.Media.Action: + transform: + fullmapping: + 1: "SkipForward" + +SW_Previous: + minupdatedelay: 500 + targets: + Vehicle.Cabin.Infotainment.Media.Action: + transform: + fullmapping: + 1: "SkipBackward" + +# NOTE: Dependent on AGL-specific VSS overlay adding the extra action +SW_Mode: + minupdatedelay: 500 + targets: + Vehicle.Cabin.Infotainment.Media.Action: + transform: + fullmapping: + 1: "NextSource" + +# NOTE: Dependent on AGL-specific VSS overlay adding the signal +SW_Info: + minupdatedelay: 500 + targets: + Vehicle.Cabin.Infotainment.Cluster.Mode: + transform: + fullmapping: + 1: "true" + +# +# The following is a little hackish, due to relying on the +# application to treat IsActive and IsSet = "true" as toggles, and +# being dependent on the AGL-specific VSS overlay to add IsSet. +# A standalone LIN feeder with some state knowledge would maybe +# be cleaner. Another possible option would be the addition of +# another type of transform that has state to the DBC feeder. +# + +SW_CruiseEnable: + minupdatedelay: 500 + targets: + Vehicle.ADAS.CruiseControl.IsActive: + transform: + fullmapping: + 1: "true" + +SW_CruiseSet: + minupdatedelay: 500 + targets: + Vehicle.ADAS.CruiseControl.IsSet: + transform: + fullmapping: + 1: "true" + +SW_CruiseResume: + minupdatedelay: 500 + targets: + Vehicle.ADAS.CruiseControl.IsSet: + transform: + fullmapping: + 1: "true" + +SW_CruiseCancel: + minupdatedelay: 500 + targets: + Vehicle.ADAS.CruiseControl.IsSet: + transform: + fullmapping: + 1: "false" + +SW_LaneDepartureWarning: + minupdatedelay: 500 + targets: + Vehicle.ADAS.LaneDepartureDetection.IsActive: + transform: + fullmapping: + 1: "true" diff --git a/recipes-platform/packagegroups/packagegroup-agl-demo-preload.bb b/recipes-platform/packagegroups/packagegroup-agl-demo-preload.bb index 5a9178afd..25a379508 100644 --- a/recipes-platform/packagegroups/packagegroup-agl-demo-preload.bb +++ b/recipes-platform/packagegroups/packagegroup-agl-demo-preload.bb @@ -16,6 +16,10 @@ PACKAGES = " \ # Adds systemd unit and scripting to drive configuring sllin # driver with lin-config utility, enabling HVAC fan control and # steering wheel controls in the demo. +# - kuksa-dbc-feeder-sllin: +# Adds configuration and systemd unit to run a second instance of +# the DBC feeder against the sllin0 interface to connect the +# steering wheel controls into VIS. # - simple-can-simulator: # CAN message simulator for vehicle and engine speed message # generation, with some support for the cruise control events from @@ -25,5 +29,6 @@ RDEPENDS:${PN} = "\ packagegroup-agl-demo-platform \ demo-i2c-udev-conf \ sllin-demo \ + kuksa-dbc-feeder-sllin \ simple-can-simulator \ " -- 2.16.6