Skip to content

Begin creating script that converts YAML file to DBC file.#21

Draft
jackiezeng01 wants to merge 13 commits intoolin-electric-motorsports:mainfrom
jackiezeng01:main
Draft

Begin creating script that converts YAML file to DBC file.#21
jackiezeng01 wants to merge 13 commits intoolin-electric-motorsports:mainfrom
jackiezeng01:main

Conversation

@jackiezeng01
Copy link
Contributor

No description provided.

@wsh32 wsh32 self-requested a review October 24, 2020 05:04
@jackiezeng01 jackiezeng01 changed the title Created script that converts YAML file to DBC file Begin creating script that converts YAML file to DBC file. Oct 24, 2020
@jackiezeng01 jackiezeng01 marked this pull request as draft October 24, 2020 05:15

def dbcSignalGenerator(signals_dict, dbc_file):
'''
Input: DBC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doc string could be better


yaml_dict = loadYaml(yaml_filename)
messagesTX_dict = yaml_dict["Messages-TX"]
messagesRX_dict = yaml_dict["Messages-RX"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment out if not using for now

@ljordan51
Copy link
Contributor

ljordan51 commented Nov 9, 2020

nice work! only major comment is that it would be nice if you put some thought into error catching, generally better to have functions return a success/error code rather than have them just run and write something to a file
Also you could add a command line message with information on how many messages were written or something for quick user validation


# Parse signal dict and set variables to be used to generate DBC
SIGNAL_NAME = signal
global BIT_START

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any particular reason why we need this to be global instead of just initializing it as BIT_START=0 at the top of function?

# lets start by just extracting the info thats therews
output = {}
for index, row in data.iterrows():
if index > 16 or index < 11:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magic numbers? please leave a comment for this

row_out['purpose'] = row['Purpose'].strip()

signal_names = []
for i in range(8):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are there always 8 signals? can we make this a flexible range instead of hard-coded?

@jack-greenberg
Copy link
Contributor

Is this still being worked on?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants