aws / aws-iot-fleetwise-edge

Reference Implementation for AWS IoT FleetWise
https://aws.amazon.com/iot-fleetwise/
Apache License 2.0
61 stars 44 forks source link

Branch node deduplication in dbc-to-nodes.py #77

Closed binchoo closed 9 months ago

binchoo commented 10 months ago

Issues:

  1. dbc-to-nodes.py may print duplicated nodes when a dbc contains two messages with the same name. Deduplication logic is required.
  2. The cantools library may cause an exception when handling CAN multiplexing, allowing two signals to have an overlapping bit range.
    Traceback (most recent call last):
    File "/Users/mzc01-jaebin.joo/MZC/repositories/aws-iot-fleetwise-edge/tools/cloud/dbc-to-decoders.py", line 14, in <module>
    db = cantools.database.load_file(sys.argv[1])
    File "/Users/mzc01-jaebin.joo/.pyenv/versions/ddd/lib/python3.10/site-packages/cantools/database/__init__.py", line 188, in load_file
    return load(fin,
    File "/Users/mzc01-jaebin.joo/.pyenv/versions/ddd/lib/python3.10/site-packages/cantools/database/__init__.py", line 282, in load
    return load_string(fp.read(),
    File "/Users/mzc01-jaebin.joo/.pyenv/versions/ddd/lib/python3.10/site-packages/cantools/database/__init__.py", line 398, in load_string
    raise UnsupportedDatabaseFormatError(e_arxml,
    cantools.database.UnsupportedDatabaseFormatError: DBC: "The signals CCC_CumulativeChargeCurrent and BatteryFanFeedback are overlapping in message Battery."

Fixes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

binchoo commented 10 months ago

demo.sh leverages the output of dbc-to-nodes.py and dbc-to-decoders.py, so any print should be removed as it will corrupt the script.

olgaakulinushkina commented 9 months ago

Hi @binchoo, thank you for submitting this MR. Could you please provide us an example DBC file so we can further test the demo script and maybe extend our documentation / scripts?

binchoo commented 9 months ago

Hey @olgaakulinushkina.

Yes for sure. Here is the DBC file that I'd like to share.

Please download this and you may remove the .txt in its name. It is one of the files that I've been testing on, which is actually from a website. This file contains CAN bus data for KIA EV6 vehicle model.

hefroy commented 9 months ago

@binchoo Please can you test #80 to see if this also fixes your problem, it adds a --permissive option to the scripts to set strict=False rather than always having strict mode disabled. When multiple frames have the same name, they add the frame id of the subsequent frames as a suffix to avoid the name clash.

hefroy commented 9 months ago

Closing in favour of #80