DallasFormulaRacing / PowertrainLib

This library will consist of various methods to visualize and analyze data to support our powertrain team's needs.
10 stars 2 forks source link

Wheel Speed Decoding #55

Closed Squidtoon99 closed 5 months ago

Squidtoon99 commented 5 months ago

Write parsers in the data deserializer file for all datapoints with a red dot next to it in the attached pdf. Once decorators are created you can test their usage with

datasheet.pdf

You can use the following code snippet to turn it into a pandas dataframe for plotting. DM me for a csv file with CAN Messages.

from can import CSVReader
from data_deserializer import MessageData
import pandas as pd
from tqdm import tqdm

file = '<csv file>'

df = pd.DataFrame()

for msg in tqdm(CSVReader(file)):    
    data = MessageData(msg)

    new_df = pd.DataFrame({"timestamp": msg.timestamp, **data.to_dict()}, index=[0])
    df = pd.concat([df, new_df])

df.ffill(inplace=True)
df.to_csv(f'dashboard/ecu_data.csv', index=False)

Once plotting is done, plot wheel speed over time for the provided csv file.

Squidtoon99 commented 5 months ago

@DeepSeaDelight Here ya go

Squidtoon99 commented 5 months ago

Make sure you match up signed/unsigned when you're decoding your int from bytes.

P.S. Make sure your function argument is called data. You

DeepSeaDelight commented 5 months ago

Forked the repo now. Will attempt to work on it for as long as my brain works for this evening and then continue during the day between classes.

DeepSeaDelight commented 5 months ago

@Squidtoon99 FYI, the invite for me to collab on this project expired. My mistake on not clicking on it sooner. Are you able to send a new one so I can upload the changes to the data deseralizer file?

DeepSeaDelight commented 5 months ago

Parsers completed!

Squidtoon99 commented 5 months ago

Sounds good, I'll merge it for you