Rationale
DBC files are an extremely powerful way of describing CAN data. However, DBC syntax can be quite confusing to decode, making DBC files not the friendliest to read or edit. To prevent unnecessary frustration over editing DBC files, the team is instead using a custom YAML format to define all mars rover CAN data in a human-readable way. YAML is extremely simple to pick up, reads just like English, and is great for storing serializable data, making it the perfect candidate to store descriptions of CAN data. There also exists many tools and libraries for manipulating YAML files in popular scripting languages such as Python, making it very flexible to work with YAML and tailor it to our CAN needs.
How it Works
All the essential DBC information is stored in the YAML CAN YAML file. A python script takes care of generating the DBC file based on the information specified in the YAML file. The script also generates the C header and source files for encoding, decoding, packing, and unpacking CAN data based on the information supplied from the DBC file.
UWRT YAML CAN
...
Format
All descriptions of mars rover CAN messages and signals are stored in a single YAML file located in the UWRT Hardware Bridge GitHub repository. The HW bridge repo is shared between the Firmware and Software teams so CAN descriptions are standardized between teams.
Bus
...
The first entry at the top-most level of the YAML CAN YAML file is the rover CAN bus. The CAN bus entry has the following fields:
...
- List of all CAN messages in the bus
Message
...
Each CAN message entry has the following fields:
...
- List of all signals in the message
Signal
...
Each CAN signal entry has the following fields:
...
- The maximum value of the decoded signal
NOTE:
For each signal, you can provide either the scale/offset fields or the min/max fields, or both. If only one of these pairs is provided, the other pair will be automatically generated based on the signal length and the values of what was provided.
...