Add vss and vss-agl recipes 88/28888/2
authorScott Murray <scott.murray@konsulko.com>
Fri, 12 May 2023 19:13:15 +0000 (15:13 -0400)
committerScott Murray <scott.murray@konsulko.com>
Tue, 16 May 2023 14:03:44 +0000 (14:03 +0000)
Add recipes that use the VSS tools to generate the stock VSS 3.1.1
JSON as well as a version with the extra AGL signals and DBC
configuration for the KUKSA.val CAN feeder.  The latter has the
additional benefit of serving as a working example of using VSS
vspec overlays at build time.

Bug-AGL: SPEC-4761

Change-Id: I6358a8f0a8b64a857dc22cfbd91190ae05546cc0
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
recipes-connectivity/vss/vss-agl/agl_vss_overlay.vspec [new file with mode: 0644]
recipes-connectivity/vss/vss-agl_3.1.1.bb [new file with mode: 0644]
recipes-connectivity/vss/vss.inc [new file with mode: 0644]
recipes-connectivity/vss/vss_3.1.1.bb [new file with mode: 0644]

diff --git a/recipes-connectivity/vss/vss-agl/agl_vss_overlay.vspec b/recipes-connectivity/vss/vss-agl/agl_vss_overlay.vspec
new file mode 100644 (file)
index 0000000..6e02648
--- /dev/null
@@ -0,0 +1,287 @@
+# Define DBC mappings for vehicle and engine speeds
+
+Vehicle.Speed:
+  datatype: float
+  type: sensor
+  dbc:
+    signal: PT_VehicleAvgSpeed
+    interval_ms: 100
+
+Vehicle.Powertrain.CombustionEngine.Speed:
+  datatype: float
+  type: sensor
+  dbc:
+    signal: PT_EngineSpeed
+    interval_ms: 100
+    transform:
+      math: "floor(x+0.5)"
+
+
+# Define extra navigation state signals
+
+Vehicle.Cabin.Infotainment.Navigation.State:
+  datatype: string
+  type: sensor
+  allowed: [ 'UNKNOWN', 'ACTIVE', 'ARRIVED', 'STOPPED' ]
+  description: Navigation state.
+
+Vehicle.Cabin.Infotainment.Navigation.ElapsedDistance:
+  datatype: float
+  type: sensor
+  unit: km
+  description: Navigation elapsed distance.
+
+
+# Define extra steering wheel switch signals, including DBC mappings
+
+Vehicle.Cabin.SteeringWheel.Switches.VolumeUp:
+  datatype: boolean
+  type: sensor
+  description: Steering wheel volume up switch engaged.
+  dbc:
+    signal: SW_VolumeUp
+    on_change: true
+    transform:
+      mapping:
+        - from: 0
+          to: false
+        - from: 1
+          to: true
+
+Vehicle.Cabin.SteeringWheel.Switches.VolumeDown:
+  datatype: boolean
+  type: sensor
+  description: Steering wheel volume down switch engaged.
+  dbc:
+    signal: SW_VolumeDown
+    on_change: true
+    transform:
+      mapping:
+        - from: 0
+          to: false
+        - from: 1
+          to: true
+
+Vehicle.Cabin.SteeringWheel.Switches.VolumeMute:
+  datatype: boolean
+  type: sensor
+  description: Steering wheel volume mute switch engaged.
+  dbc:
+    signal: SW_VolumeMute
+    on_change: true
+    transform:
+      mapping:
+        - from: 0
+          to: false
+        - from: 1
+          to: true
+
+Vehicle.Cabin.SteeringWheel.Switches.Next:
+  datatype: boolean
+  type: sensor
+  description: Steering wheel next switch engaged.
+  dbc:
+    signal: SW_Next
+    on_change: true
+    transform:
+      mapping:
+        - from: 0
+          to: false
+        - from: 1
+          to: true
+
+Vehicle.Cabin.SteeringWheel.Switches.Previous:
+  datatype: boolean
+  type: sensor
+  description: Steering wheel previous switch engaged.
+  dbc:
+    signal: SW_Previous
+    on_change: true
+    transform:
+      mapping:
+        - from: 0
+          to: false
+        - from: 1
+          to: true
+
+Vehicle.Cabin.SteeringWheel.Switches.Mode:
+  datatype: boolean
+  type: sensor
+  description: Steering wheel mode switch engaged.
+  dbc:
+    signal: SW_Mode
+    on_change: true
+    transform:
+      mapping:
+        - from: 0
+          to: false
+        - from: 1
+          to: true
+
+Vehicle.Cabin.SteeringWheel.Switches.Info:
+  datatype: boolean
+  type: sensor
+  description: Steering wheel info switch engaged.
+  dbc:
+    signal: SW_Info
+    on_change: true
+    transform:
+      mapping:
+        - from: 0
+          to: false
+        - from: 1
+          to: true
+
+Vehicle.Cabin.SteeringWheel.Switches.CruiseEnable:
+  datatype: boolean
+  type: sensor
+  description: Steering wheel cruise enable switch engaged.
+  dbc:
+    signal: SW_CruiseEnable
+    on_change: true
+    transform:
+      mapping:
+        - from: 0
+          to: false
+        - from: 1
+          to: true
+
+Vehicle.Cabin.SteeringWheel.Switches.CruiseSet:
+  datatype: boolean
+  type: sensor
+  description: Steering wheel cruise set switch engaged.
+  dbc:
+    signal: SW_CruiseSet
+    on_change: true
+    transform:
+      mapping:
+        - from: 0
+          to: false
+        - from: 1
+          to: true
+
+Vehicle.Cabin.SteeringWheel.Switches.CruiseResume:
+  datatype: boolean
+  type: sensor
+  description: Steering wheel cruise resume switch engaged.
+  dbc:
+    signal: SW_CruiseResume
+    on_change: true
+    transform:
+      mapping:
+        - from: 0
+          to: false
+        - from: 1
+          to: true
+
+Vehicle.Cabin.SteeringWheel.Switches.CruiseCancel:
+  datatype: boolean
+  type: sensor
+  description: Steering wheel cruise cancel switch engaged.
+  dbc:
+    signal: SW_CruiseCancel
+    on_change: true
+    transform:
+      mapping:
+        - from: 0
+          to: false
+        - from: 1
+          to: true
+
+Vehicle.Cabin.SteeringWheel.Switches.CruiseLimit:
+  datatype: boolean
+  type: sensor
+  description: Steering wheel cruise limit switch engaged.
+  dbc:
+    signal: SW_CruiseLimit
+    on_change: true
+    transform:
+      mapping:
+        - from: 0
+          to: false
+        - from: 1
+          to: true
+
+Vehicle.Cabin.SteeringWheel.Switches.CruiseDistance:
+  datatype: boolean
+  type: sensor
+  description: Steering wheel cruise distance switch engaged.
+  dbc:
+    signal: SW_CruiseDistance
+    on_change: true
+    transform:
+      mapping:
+        - from: 0
+          to: false
+        - from: 1
+          to: true
+
+Vehicle.Cabin.SteeringWheel.Switches.Voice:
+  datatype: boolean
+  type: sensor
+  description: Steering wheel voice switch engaged.
+  dbc:
+    signal: SW_Voice
+    on_change: true
+    transform:
+      mapping:
+        - from: 0
+          to: false
+        - from: 1
+          to: true
+
+Vehicle.Cabin.SteeringWheel.Switches.PhoneCall:
+  datatype: boolean
+  type: sensor
+  description: Steering wheel phone call switch engaged.
+  dbc:
+    signal: SW_PhoneCall
+    on_change: true
+    transform:
+      mapping:
+        - from: 0
+          to: false
+        - from: 1
+          to: true
+
+Vehicle.Cabin.SteeringWheel.Switches.PhoneHangup:
+  datatype: boolean
+  type: sensor
+  description: Steering wheel phone hangup switch engaged.
+  dbc:
+    signal: SW_PhoneHangup
+    on_change: true
+    transform:
+      mapping:
+        - from: 0
+          to: false
+        - from: 1
+          to: true
+
+Vehicle.Cabin.SteeringWheel.Switches.Horn:
+  datatype: boolean
+  type: sensor
+  description: Steering wheel horn switch engaged.
+  dbc:
+    signal: SW_Horn
+    on_change: true
+    transform:
+      mapping:
+        - from: 0
+          to: false
+        - from: 1
+          to: true
+
+Vehicle.Cabin.SteeringWheel.Switches.LaneDepartureWarning:
+  datatype: boolean
+  type: sensor
+  description: Steering wheel lane departure warning switch engaged.
+  dbc:
+    signal: SW_LaneDepartureWarning
+    on_change: true
+    transform:
+      mapping:
+        - from: 0
+          to: false
+        - from: 1
+          to: true
diff --git a/recipes-connectivity/vss/vss-agl_3.1.1.bb b/recipes-connectivity/vss/vss-agl_3.1.1.bb
new file mode 100644 (file)
index 0000000..83fb4b1
--- /dev/null
@@ -0,0 +1,36 @@
+SUMMARY = "Vehicle Signal Specification with AGL overlays"
+LICENSE = "MPL-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=9741c346eef56131163e13b9db1241b3"
+
+DEPENDS = "vss-tools-native"
+
+inherit allarch update-alternatives
+
+require vss.inc
+
+SRC_URI += "file://agl_vss_overlay.vspec"
+
+# Since we're not relying on the simple upstream repo Makefile, use
+# best practices and output into a separate directory.
+B = "${WORKDIR}/build"
+
+do_configure[noexec] = "1"
+
+VSPEC2JSON_OPTS = "-e dbc -o ${WORKDIR}/agl_vss_overlay.vspec --no-uuid --json-pretty"
+
+do_compile() {
+    vspec2json.py -I ${S}/spec ${VSPEC2JSON_OPTS} -u ${S}/spec/units.yaml ${S}/spec/VehicleSignalSpecification.vspec vss_rel_${PV}-agl.json
+}
+
+do_install() {
+    install -d ${D}${datadir}/vss
+    install -m 0644 vss_rel_${PV}-agl.json ${D}${datadir}/vss/
+}
+
+ALTERNATIVE_LINK_NAME[vss.json] = "${datadir}/vss/vss.json"
+
+ALTERNATIVE_PRIORITY = "20"
+ALTERNATIVE:${PN} = "vss.json"
+ALTERNATIVE_TARGET_${PN} = "${datadir}/vss/vss_rel_${PV}-agl.json"
+
+FILES:${PN} += "${datadir}/vss/"
diff --git a/recipes-connectivity/vss/vss.inc b/recipes-connectivity/vss/vss.inc
new file mode 100644 (file)
index 0000000..eb8f31c
--- /dev/null
@@ -0,0 +1,5 @@
+SRC_URI = "git://github.com/COVESA/vehicle_signal_specification.git;branch=release/3.1;protocol=https"
+# v3.1.1
+SRCREV = "af4f6a4a67aa8e7bc87421bd90db7a2d99ea8856"
+
+S = "${WORKDIR}/git"
diff --git a/recipes-connectivity/vss/vss_3.1.1.bb b/recipes-connectivity/vss/vss_3.1.1.bb
new file mode 100644 (file)
index 0000000..0535166
--- /dev/null
@@ -0,0 +1,43 @@
+SUMMARY = "Vehicle Signal Specification"
+LICENSE = "MPL-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=9741c346eef56131163e13b9db1241b3"
+
+DEPENDS = "vss-tools-native"
+
+inherit allarch update-alternatives
+
+require vss.inc
+
+UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)"
+
+S = "${WORKDIR}/git"
+
+do_configure[noexec] = "1"
+
+EXTRA_OEMAKE = "TOOLSDIR=${STAGING_BINDIR_NATIVE}"
+
+do_compile() {
+    oe_runmake json
+}
+
+do_install() {
+    # Cannot use the "install" target in the project Makefile, as it is
+    # intended for setting the repo up for builds.
+    # For now, just the generated JSON is installed. It is possible that
+    # installing the vspec files somewhere as a development package may
+    # be useful, but for now things will be kept simple.
+    install -d ${D}${datadir}/vss
+    install -m 0644 ${S}/vss_rel_${PV}.json ${D}${datadir}/vss/
+}
+
+# NOTE:
+# A virtual RPROVIDES is not used for now, as packages such as KUKSA.val
+# provide their own copies of the VSS JSON, so we can install this one
+# and any alternatives in parallel and point e.g. KUKSA.val at the desired
+# file with a configuration change. This may be worth revisiting down the
+# road.
+
+ALTERNATIVE_LINK_NAME[vss.json] = "${datadir}/vss/vss.json"
+
+ALTERNATIVE:${PN} = "vss.json"
+ALTERNATIVE_TARGET_${PN} = "${datadir}/vss/vss_rel_${PV}.json"