0

I am using the asammdf library for extracting CAN messages from MF4 files. the function extract_bus_logging called on a mdf object is supposed to extract all possible CAN messages using given CAN database. In my database I have multiple CAN messages containing different signals. Say, I have a message "A" containing signals "1, 2, 3" and message "B" containing signals "4, 5, 6". When I call the extract_bus_logging function, it extracts signals from only one CAN message - I would end up only with signals "1, 2, 3". How do I extract all the signals from all the can messages?

Here is my python sample code:

def convert_mf4(mf4_file: os.path, dbc_set: set) -> pd.DataFrame:
    """Converts and decodes MF4 files to a dataframe using DBC files."""
    # convert MF4 to MDF
    mdf = MDF(mf4_file)
    # extract CAN messages
    extracted_mdf = mdf.extract_bus_logging(database_files=dbc_set)
    # return MDF converted to dataframe
    mdf_df = extracted_mdf.to_dataframe(time_from_zero=False, time_as_date=True)
    mdf_df.index = pd.to_datetime(mdf_df.index)
    return mdf_df

dbc_set is a structure of can database files, as required in the MDF documentation.

I have tried different CAN databases, but the problem was always the same. Only the first message gets extracted.

Andrew
  • 1
  • 1

0 Answers0