48 lines
1.2 KiB
Python
48 lines
1.2 KiB
Python
import matplotlib.pyplot as plt
|
|
#import csv
|
|
import pandas as pd
|
|
|
|
import numpy as np
|
|
|
|
|
|
import argparse
|
|
|
|
parser = argparse.ArgumentParser(description='Analyzes fixed csv logs from bobbycar')
|
|
parser.add_argument('-i', '--input', type=argparse.FileType('r'), required=True, help="input csv log file")
|
|
args = parser.parse_args()
|
|
|
|
df = pd.read_csv(args.input.name)
|
|
|
|
x = df['timestamp']
|
|
x = [i-x[0] for i in x] #offset time by starttime
|
|
|
|
|
|
scattersize=1
|
|
scatteralpha=0.1
|
|
|
|
|
|
fig, ax1 = plt.subplots()
|
|
|
|
ax2 = ax1.twinx()
|
|
|
|
|
|
#plt.scatter(x,df['rpm_FrontL'], s=scattersize, alpha=scatteralpha, label="rpm_FrontL")
|
|
ax1.plot(x,np.array(df['vbat_Front']), c='b', alpha=0.5, label="vbat_Front")
|
|
ax1.plot(x,np.array(df['vbat_Rear']), c='r', alpha=0.5, label="vbat_Rear")
|
|
ax2.plot(x,np.array(df['rpm_FrontL']), c='g', alpha=0.5, label="rpm_FrontL")
|
|
#plt.plot(x,np.array(df['currentConsumed']), c='g', alpha=0.5, label="currentConsumed")
|
|
|
|
#plt.scatter(x,df['rpm_FrontR'], s=scattersize, alpha=scatteralpha, label="rpm_FrontR")
|
|
|
|
ax1.set_xlabel('timestamp')
|
|
#plt.ylabel('data')
|
|
ax1.set_ylabel('first axis')
|
|
ax2.set_ylabel('second axis')
|
|
#plt.title('')
|
|
ax1.legend(loc='upper left')
|
|
ax2.legend(loc='upper right')
|
|
plt.show()
|
|
|
|
|
|
exit()
|