diff options
author | Scott Murray <scott.murray@konsulko.com> | 2022-06-12 12:58:47 -0400 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2022-06-13 13:06:50 -0400 |
commit | ea285aba8248385a841b7f4feb1b41b2f506407d (patch) | |
tree | 6f1c5f91ce1889d5e161627df6f8c2f862409d2c | |
parent | 7af88ec157f047981e45afef7c945c0370932f51 (diff) |
Update demo KUKSA.val configuration
In practice mapping multiple CAN signals from the LIN polling to a
smaller number of VIS signals does not work well with the behavior
of the CAN feeder from KUKSA.val when testing on the actual demo
hardware. To improve the behavior:
- update the VSS schema overlay and DBC feeder mapping configuration
to use new AGL custom steering wheel switch signals instead of the
previous signals and mappings.
- add a patch to the DBC feeder to add a per-target duplicate signal
filtering option, and enable it for all the steering wheel signals
in the mapping configuration.
The DBC feeder performance issues stemming from synchronous VIS server
updates will be discussed with upstream, but these changes should
yield behavior similar to the previous combination of the low-can and
signal-composer bindings. With respect to the switch signals, this
should be revisited if implementing a custom LIN signal feeder becomes
an option, as overall it would be better to leverage the standard VSS
schema signals if possible.
Bug-AGL: SPEC-4405
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: I702a631d79c4365cb262e9d3a15b9c6be24c8eeb
4 files changed, 266 insertions, 75 deletions
diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0003-dbc2val-add-duplicate-filtering-option.patch b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0003-dbc2val-add-duplicate-filtering-option.patch new file mode 100644 index 000000000..1709ac1e4 --- /dev/null +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/0003-dbc2val-add-duplicate-filtering-option.patch @@ -0,0 +1,61 @@ +From a22d972bc497ab46d99c1d118bd40b9471fef3a7 Mon Sep 17 00:00:00 2001 +From: Scott Murray <scott.murray@konsulko.com> +Date: Mon, 13 Jun 2022 12:54:54 -0400 +Subject: [PATCH] dbc2val: add duplicate filtering option + +To avoid generating a lot of duplicated signal events from the +CAN messages generated by LIN polling, add a per-target +"filter-duplicates" option that can be used for signals where +only changes should be pushed toi the VIS server. This is +required with the current performance of the DBC feeder to avoid +ending up with an increasing backlog of signal commands to the +server. This will be investigated with upstream. + +Upstream-Status: pending +Signed-off-by: Scott Murray <scott.murray@konsulko.com> +--- + kuksa_feeders/dbc2val/dbc2vssmapper.py | 27 +++++++++++++++++++------- + 1 file changed, 20 insertions(+), 7 deletions(-) + +diff --git a/kuksa_feeders/dbc2val/dbc2vssmapper.py b/kuksa_feeders/dbc2val/dbc2vssmapper.py +index 1718154..2feb572 100644 +--- a/kuksa_feeders/dbc2val/dbc2vssmapper.py ++++ b/kuksa_feeders/dbc2val/dbc2vssmapper.py +@@ -48,14 +48,27 @@ class mapper: + # Check whether there are transforms defined to map DBC signal "signal" to + # VSS path "target". Returns the (potentially) transformed values + def transform(self,signal, target, value): +- if "transform" not in self.mapping[signal]["targets"][target].keys(): #no transform defined, return as is +- return value +- for transform in self.mapping[signal]["targets"][target]["transform"]: +- if transform in self.transforms.keys(): #found a known transform and apply +- value=self.transforms[transform].transform(self.mapping[signal]["targets"][target]["transform"][transform],value) ++ result = value ++ if "transform" in self.mapping[signal]["targets"][target].keys(): ++ for transform in self.mapping[signal]["targets"][target]["transform"]: ++ if transform in self.transforms.keys(): #found a known transform and apply ++ result = self.transforms[transform].transform(self.mapping[signal]["targets"][target]["transform"][transform],value) ++ else: ++ print(f"Warning: Unknown transform {transform} for {signal}->{target}") ++ # else no transform defined, return as is ++ ++ if (("filter-duplicates" in self.mapping[signal]["targets"][target]) and ++ self.mapping[signal]["targets"][target]["filter-duplicates"] == "true"): ++ if "last" in self.mapping[signal]["targets"][target]: ++ if self.mapping[signal]["targets"][target]["last"] == result: ++ # ignore duplicate value ++ result = None ++ else: ++ self.mapping[signal]["targets"][target]["last"] = result + else: +- print(f"Warning: Unknown transform {transform} for {signal}->{target}") +- return value ++ self.mapping[signal]["targets"][target]["last"] = result ++ ++ return result + + def __contains__(self,key): + return key in self.mapping.keys() +-- +2.35.1 + diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/mapping.yml b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/mapping.yml index f8a561d27..ee970a32d 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/mapping.yml +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder/mapping.yml @@ -11,85 +11,142 @@ PT_EngineSpeed: transform: math: "floor(x+0.5)" +# +# NOTE: +# +# The following mappings depend on the AGL-specific VSS overlay +# that adds the extra Vehicle.Cabin.SteeringWheel.Switches sensors. +# Since the CAN events are coming from LIN polling, applications +# need to filter/debounce themselves. The minupdatedelay of 0 is +# intentional to avoid missing events. +# + SW_Next: - minupdatedelay: 500 + minupdatedelay: 0 targets: - Vehicle.Cabin.Infotainment.Media.Action: + Vehicle.Cabin.SteeringWheel.Switches.Next: + filter-duplicates: "true" transform: fullmapping: - 1: "SkipForward" + 0: "false" + 1: "true" SW_Previous: - minupdatedelay: 500 + minupdatedelay: 0 targets: - Vehicle.Cabin.Infotainment.Media.Action: + Vehicle.Cabin.SteeringWheel.Switches.Previous: + filter-duplicates: "true" transform: fullmapping: - 1: "SkipBackward" + 0: "false" + 1: "true" -# NOTE: Dependent on AGL-specific VSS overlay adding the extra action SW_Mode: - minupdatedelay: 500 + minupdatedelay: 0 targets: - Vehicle.Cabin.Infotainment.Media.Action: + Vehicle.Cabin.SteeringWheel.Switches.Mode: + filter-duplicates: "true" transform: fullmapping: - 1: "NextSource" + 0: "false" + 1: "true" -# NOTE: Dependent on AGL-specific VSS overlay adding the signal SW_Info: - minupdatedelay: 500 + minupdatedelay: 0 targets: - Vehicle.Cabin.Infotainment.Cluster.Mode: + Vehicle.Cabin.SteeringWheel.Switches.Info: + filter-duplicates: "true" transform: fullmapping: + 0: "false" 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 + minupdatedelay: 0 targets: - Vehicle.ADAS.CruiseControl.IsActive: + Vehicle.Cabin.SteeringWheel.Switches.CruiseEnable: + filter-duplicates: "true" transform: fullmapping: + 0: "false" 1: "true" SW_CruiseSet: - minupdatedelay: 500 + minupdatedelay: 0 targets: - Vehicle.ADAS.CruiseControl.IsSet: + Vehicle.Cabin.SteeringWheel.Switches.CruiseSet: + filter-duplicates: "true" transform: fullmapping: + 0: "false" 1: "true" SW_CruiseResume: - minupdatedelay: 500 + minupdatedelay: 0 targets: - Vehicle.ADAS.CruiseControl.IsSet: + Vehicle.Cabin.SteeringWheel.Switches.CruiseResume: + filter-duplicates: "true" transform: fullmapping: + 0: "false" 1: "true" SW_CruiseCancel: - minupdatedelay: 500 + minupdatedelay: 0 + targets: + Vehicle.Cabin.SteeringWheel.Switches.CruiseCancel: + filter-duplicates: "true" + transform: + fullmapping: + 0: "false" + 1: "true" + +SW_VolumeUp: + minupdatedelay: 0 targets: - Vehicle.ADAS.CruiseControl.IsSet: + Vehicle.Cabin.SteeringWheel.Switches.VolumeUp: + filter-duplicates: "true" transform: fullmapping: - 1: "false" + 0: "false" + 1: "true" + +SW_VolumeDown: + minupdatedelay: 0 + targets: + Vehicle.Cabin.SteeringWheel.Switches.VolumeDown: + filter-duplicates: "true" + transform: + fullmapping: + 0: "false" + 1: "true" + +SW_VolumeMute: + minupdatedelay: 0 + targets: + Vehicle.Cabin.SteeringWheel.Switches.VolumeMute: + filter-duplicates: "true" + transform: + fullmapping: + 0: "false" + 1: "true" + +SW_Horn: + minupdatedelay: 0 + targets: + Vehicle.Cabin.SteeringWheel.Switches.Horn: + filter-duplicates: "true" + transform: + fullmapping: + 0: "false" + 1: "true" SW_LaneDepartureWarning: - minupdatedelay: 500 + minupdatedelay: 0 targets: - Vehicle.ADAS.LaneDepartureDetection.IsActive: + Vehicle.Cabin.SteeringWheel.Switches.LaneDepartureWarning: + filter-duplicates: "true" transform: fullmapping: + 0: "false" 1: "true" diff --git a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder_git.bb b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder_git.bb index ed3663502..815c4d2bc 100644 --- a/recipes-connectivity/kuksa-val/kuksa-dbc-feeder_git.bb +++ b/recipes-connectivity/kuksa-val/kuksa-dbc-feeder_git.bb @@ -11,6 +11,7 @@ require kuksa-val.inc SRC_URI += "file://0001-dbc2val-add-installation-mechanism.patch \ file://0002-dbc2val-usability-improvements.patch \ + file://0003-dbc2val-add-duplicate-filtering-option.patch \ file://config.ini \ file://dbc_feeder.json.token \ file://mapping.yml \ diff --git a/recipes-connectivity/kuksa-val/kuksa-val-agl/00-agl_vss_overlay_2.2.json b/recipes-connectivity/kuksa-val/kuksa-val-agl/00-agl_vss_overlay_2.2.json index 6cfdf5eee..423d32385 100644 --- a/recipes-connectivity/kuksa-val/kuksa-val-agl/00-agl_vss_overlay_2.2.json +++ b/recipes-connectivity/kuksa-val/kuksa-val-agl/00-agl_vss_overlay_2.2.json @@ -1,44 +1,126 @@ { "Vehicle": { "children": { - "ADAS": { - "children": { - "CruiseControl": { - "children": { - "IsSet": { - "datatype": "boolean", - "description": "Indicates if cruise control speed is set. True = Enabled. False = Disabled.", - "type": "sensor", - "uuid": "65444a5d94dd45c59187f4179bf541ad" - } - } - } - } - }, "Cabin": { "children": { - "Infotainment": { + "SteeringWheel": { "children": { - "Media": { + "Switches": { "children": { - "Action": { - "datatype": "string", - "description": "Tells if the media was", - "enum": [ - "unknown", - "Stop", - "Play", - "FastForward", - "FastBackward", - "SkipForward", - "SkipBackward", - "NextSource" - ], - "type": "actuator", - "uuid": "0357aea525bf505981a14e4fc720094e" + "VolumeUp": { + "datatype": "boolean", + "description": "Steering wheel volume up switch engaged", + "type": "sensor", + "uuid": "b1b71c0d19684170bbf9fc40eb4d0d0e" + }, + "VolumeDown": { + "datatype": "boolean", + "description": "Steering wheel volume down switch engaged", + "type": "sensor", + "uuid": "03ff9703a5604ab190cf518eec08ba07" + }, + "VolumeMute": { + "datatype": "boolean", + "description": "Steering wheel volume mute switch engaged", + "type": "sensor", + "uuid": "c20467086cf846dc9f27da93d611af12" + }, + "Next": { + "datatype": "boolean", + "description": "Steering wheel next switch engaged", + "type": "sensor", + "uuid": "a2a997e5e6a848d0be1bf8b8bc45e215" + }, + "Previous": { + "datatype": "boolean", + "description": "Steering wheel previous switch engaged", + "type": "sensor", + "uuid": "1505a53421044bccb249f08c270e3912" + }, + "Mode": { + "datatype": "boolean", + "description": "Steering wheel mode switch engaged", + "type": "sensor", + "uuid": "6cba659f06ae4809adb5de53786ab0b6" + }, + "Info": { + "datatype": "boolean", + "description": "Steering wheel info switch engaged", + "type": "sensor", + "uuid": "5dd6d297edfb4cb99ab2ed7723877cd0" + }, + "CruiseEnable": { + "datatype": "boolean", + "description": "Steering wheel cruise enable switch engaged", + "type": "sensor", + "uuid": "f4f383fbf3ff4a7b99ea71203cd8a446" + }, + "CruiseSet": { + "datatype": "boolean", + "description": "Steering wheel cruise set switch engaged", + "type": "sensor", + "uuid": "14bd5c2326a043b79898df4e80403a93" + }, + "CruiseResume": { + "datatype": "boolean", + "description": "Steering wheel cruise resume switch engaged", + "type": "sensor", + "uuid": "000cc121e98345f2976615f550b91639" + }, + "CruiseCancel": { + "datatype": "boolean", + "description": "Steering wheel cruise cancel switch engaged", + "type": "sensor", + "uuid": "b953dac89a2b40fdace6c74bb212afb8" + }, + "CruiseLimit": { + "datatype": "boolean", + "description": "Steering wheel cruise limit switch engaged", + "type": "sensor", + "uuid": "1c211ac5dd4d42249d7e1c104ef81df9" + }, + "CruiseDistance": { + "datatype": "boolean", + "description": "Steering wheel cruise distance switch engaged", + "type": "sensor", + "uuid": "744c8913afe641d0903c44932879ab43" + }, + "Voice": { + "datatype": "boolean", + "description": "Steering wheel voice switch engaged", + "type": "sensor", + "uuid": "9d78ab3889d74209acf6974e070d9d57" + }, + "PhoneCall": { + "datatype": "boolean", + "description": "Steering wheel phone call switch engaged", + "type": "sensor", + "uuid": "3b505e5d962546c7a03509a5c14cfd60" + }, + "PhoneSwitch": { + "datatype": "boolean", + "description": "Steering wheel phone call switch engaged", + "type": "sensor", + "uuid": "f19d7c584f2f4f0080a10f773e472359" + }, + "Horn": { + "datatype": "boolean", + "description": "Steering wheel horn switch engaged", + "type": "sensor", + "uuid": "e025a116b74a41a0a283815621a41fb2" + }, + "LaneDepartureWarning": { + "datatype": "boolean", + "description": "Steering wheel lane departure warning switch engaged", + "type": "sensor", + "uuid": "6dd9c149da8449df885e6250e912e986" } } - }, + } + } + }, + "Infotainment": { + "children": { "Navigation": { "children": { "State": { @@ -61,16 +143,6 @@ "uuid": "0bef606dcf5b4a75bfd7e5f3c68359ec" } } - }, - "Cluster": { - "children": { - "Mode": { - "datatype": "boolean", - "description": "Cluster mode switch engaged", - "type": "actuator", - "uuid": "7df1649ebed447ef81bb6e92786514d9" - } - } } } } |