-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #214 from boschresearch/feature/dbcfeedertransforms
Transfromations and better error logging for DBC feeder
- Loading branch information
Showing
7 changed files
with
116 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,36 @@ | ||
# Map OBD values to tree | ||
|
||
# Mapping Speed | ||
UIspeed_signed257: | ||
minupdatedelay: 100 | ||
targets: | ||
- Vehicle.OBD.Speed | ||
Vehicle.Speed: {} | ||
Vehicle.OBD.Speed: {} | ||
|
||
|
||
#RearPower266: | ||
# minupdatedelay: 100 | ||
# targets: | ||
# - Vehicle.OBD.EngineLoad | ||
#this is kW, do some magic to get in 0-100 int range | ||
RearPower266: | ||
minupdatedelay: 100 | ||
targets: | ||
Vehicle.OBD.EngineLoad: | ||
transform: | ||
math: "floor(abs(x/5))" | ||
|
||
#Change this to type string in VSS file to work with M3 DBC | ||
#Mapping to numeriv VSS gears, and extract parking state | ||
DIgear118: | ||
minupdatedelay: 100 | ||
targets: | ||
- Vehicle.Drivetrain.Transmission.Gear | ||
Vehicle.Powertrain.Transmission.Gear: | ||
transform: | ||
fullmapping: | ||
Neutral: 0 | ||
Idle: 0 | ||
Park: 0 | ||
Reverse: -1 | ||
Drive: 1 | ||
Vehicle.Chassis.ParkingBrake.IsEngaged: | ||
transform: | ||
fullmapping: | ||
Neutral: "false" | ||
Idle: "false" | ||
Park: "true" | ||
Reverse: "false" | ||
Drive: "false" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ cantools | |
python-can | ||
pyyaml | ||
j1939 | ||
py_expression_eval | ||
kuksa-viss-client |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/python3 | ||
|
||
######################################################################## | ||
# Copyright (c) 2021 Robert Bosch GmbH | ||
# | ||
# This program and the accompanying materials are made | ||
# available under the terms of the Eclipse Public License 2.0 | ||
# which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 | ||
######################################################################## | ||
|
||
|
||
class mapping: | ||
|
||
# setting discard_non_matching_items to true will return "None" if a value | ||
# is not found in the mapping table. This can be used to only add | ||
# a subset of possible values to VSS | ||
# setting discard_non_matching_items to false will return values for | ||
# which no match exists unmodified | ||
def __init__(self, discard_non_matching_items): | ||
self.discard_non_matching_items=discard_non_matching_items | ||
|
||
def transform(self, spec, value): | ||
for k,v in spec.items(): | ||
if value==k: | ||
return v | ||
#no match | ||
if self.discard_non_matching_items: | ||
return None | ||
else: | ||
return value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/python3 | ||
|
||
######################################################################## | ||
# Copyright (c) 2021 Robert Bosch GmbH | ||
# | ||
# This program and the accompanying materials are made | ||
# available under the terms of the Eclipse Public License 2.0 | ||
# which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 | ||
######################################################################## | ||
|
||
from py_expression_eval import Parser | ||
|
||
class math: | ||
|
||
def __init__(self): | ||
self.parser=Parser() | ||
|
||
def transform(self, spec, value): | ||
return self.parser.parse(spec).evaluate({'x': value}) | ||
|