Binary CAN File Format

Please provide the following info:
Hardware Platform: [DRIVE AGX Pegasus™ Developer Kit]
Software Version: [Example: DRIVE Software 10]
Host Machine Version: [Ubuntu 18.04]
SDK Manager Version: [1.0.1.5538]

I have recorded data using the recorder tool. One of the files produced for the can bus is vehicle_can.bin. I would like to know the format of the CAN data in this file so I can parse the data out.

Thank you,

Shane

Hi @shane.licari,

The format is dependent on your DBW format. Please take a look at below as a starting point to understand how to work on it with DriveWorks APIs.

My intention is to parse the binary can file without using DriveWorks APIs. I am working on automated data analysis and would like to parse the file in python or create a parser in C++.

Thank you,

Shane

I’m checking this and will get back to you. At the same time, May I know why you don’t use DriveWorks APIs?

The development team will be using DriveWorks API for development purposes. In parallel we would like to setup automated data validation pipelines using a cluster and not be dependent on downloading and compiling the DriveWorks API to parse our CAN data from the binary CAN file produced by the DriveWorks recorder tool. That’s is why we seek to understand the format of the binary file so we can setup some pipelines in Python.

Thank you,

Shane

Thanks for let us know!

Here is the format:

Header (32 bytes) | canMsg (N bytes) | canMsg (N bytes) | canMsg (N bytes) | ...

Header is

  : uint32_t  magicnumber -> 0xc5eeeaf2

  : int32_t  fileVersion

 ...

canMsg is

/// Holds a CAN package.
typedef struct dwCANMessage                                                                                                                                                   
{
    /// Timestamp of the message in microseconds (using clock of the context).
    dwTime_t timestamp_us;

    /// CAN ID of the message sender.
    uint32_t id;

    /// Number of bytes of the payload.
    uint16_t size;

    /// Payload.
    uint8_t data[DW_SENSORS_CAN_MAX_MESSAGE_LEN];
} dwCANMessage;

if fileVersion == 1 then

DW_SENSORS_CAN_MAX_MESSAGE_LEN == 8
sizeof(canMsg) == N == 22

else

DW_SENSORS_CAN_MAX_MESSAGE_LEN == 64
sizeof(canMsg) == N == 78

Hope it helps!

Thank you this is exactly what I was looking for!

Best Regards,

Shane Licari

1 Like

Actually quick clarification. How do you get 32 bytes for the header when you show that the header is made up of a struct with two 4 byte data types?

Thanks,

Shane

The other fields aren’t necessary for your parsing so in the previous post we just disclosed the first two fields of the header structure.

Okay thank you for the information!

Shane

1 Like