CSS-Electronics / can_decoder

API module for decoding raw CAN bus data to physical values
MIT License
74 stars 14 forks source link

Question: How can the can_decoder return the names of the CAN frames as well? #4

Closed stoyan-SLN closed 3 years ago

stoyan-SLN commented 3 years ago

Hello Team,

I am working with the can_decoder recently and I have the following use case:

I have more than 1 CAN signals with the same names on the same CAN channel, however these signals are from different CAN frames, but the current decoder dataframe returns only the names of the Signals.

I need to get also the names of the CAN frames from the can_decoder( decoded from a DBC) so that I can push these CAN signals to InfluxDB, with a prefix of the CAN frame name in front of the signal and in that way to differentiate which CAN signal is part of which CAN frame.

Thanks.

MatinF commented 3 years ago

Hi Stoyan, thanks for reaching out. The df_phys output contains the CAN ID, meaning you can use this as a prefix to your signal names in order to ensure uniqueness in cases where signal names are not globally unique. We have an example of how this can be done in another context, I believe you can replicate the logic of this class in the dashboard-writer script as well:

https://github.com/CSS-Electronics/api-examples/blob/master/examples/data-processing/utils.py#L71

I'll close this issue, but let me know if this does not resolve it.