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

Allow permissive DBC parsing #80

Closed hefroy closed 9 months ago

hefroy commented 9 months ago

If multiple frames have the same name, add the frame ID as a suffix

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 9 months ago

@hefroy Thank you for an awesome work. It is well processing the duplicated messages letting the nodes have different names with a suffix.

Test result with dbc-to-nodes.py

python dbc-to-nodes.py -p ev6-gps.dbc

[
    ...
    {
        "branch": {
            "fullyQualifiedName": "Vehicle.gnss_pos"
        }
    },
    {
        "sensor": {
            "dataType": "DOUBLE",
            "description": "Longitude",
            "fullyQualifiedName": "Vehicle.gnss_pos.Longitude",
            "max": 180,
            "min": -180,
            "unit": "deg"
        }
    },
    ...
    {
        "branch": {
            "fullyQualifiedName": "Vehicle.gnss_pos_19"
        }
    },
    {
        "sensor": {
            "dataType": "DOUBLE",
            "description": "Longitude",
            "fullyQualifiedName": "Vehicle.gnss_pos_19.Longitude",
            "max": 180,
            "min": -180,
            "unit": "deg"
        }
    },
    ...
]

But I guess we should be able to select those signals with extended name in our vehicle model to pair with decoder signals.

Test result with dbc-to-decoders.py

python dbc-to-decoders.py -p ev6-gps.dbc

[
    ...
    {
        "canSignal": {
            "factor": 1e-06,
            "isBigEndian": false,
            "isSigned": false,
            "length": 29,
            "messageId": 19, // should be 8
            "name": "Longitude",
            "offset": -180,
            "startBit": 29
        },
        "fullyQualifiedName": "Vehicle.gnss_pos.Longitude",
        "interfaceId": "1",
        "type": "CAN_SIGNAL"
    },

    // An item for "Vehicle.gnss_pos_19.Longitude" may be required
    ...
]
hefroy commented 9 months ago

@binchoo: Thanks for testing and finding that bug, it should have been using gnss_pos_19 as the message name like the following. I've pushed another commit to fix this.

[
    ...
    {
        "canSignal": {
            "factor": 1e-06,
            "isBigEndian": false,
            "isSigned": false,
            "length": 29,
            "messageId": 3,
            "name": "Longitude",
            "offset": -180,
            "startBit": 29
        },
        "fullyQualifiedName": "Vehicle.gnss_pos.Longitude",
        "interfaceId": "1",
        "type": "CAN_SIGNAL"
    },
    ...
    {
        "canSignal": {
            "factor": 1e-06,
            "isBigEndian": false,
            "isSigned": false,
            "length": 29,
            "messageId": 19, // 19 is correct here for the `gnss_pos_19` message
            "name": "Longitude",
            "offset": -180,
            "startBit": 29
        },
        "fullyQualifiedName": "Vehicle.gnss_pos_19.Longitude",
        "interfaceId": "1",
        "type": "CAN_SIGNAL"
    },
    ...
]