Compare commits
No commits in common. "890daa97025f55e0ac01be9f92c2021d8bd9c16a" and "64bd6f79f5d0900145f31d759073c9427752c581" have entirely different histories.
890daa9702
...
64bd6f79f5
|
@ -112,7 +112,7 @@ void led_update(unsigned long loopmillis,ESCSerialComm& escFront, ESCSerialComm&
|
|||
if (loopmillis-last_notidle>5000) {
|
||||
//Standing
|
||||
float vbat=min(escRear.getFeedback_batVoltage(),escFront.getFeedback_batVoltage());
|
||||
led_gauge(loopmillis,vbat,3.3*12,4.2*12,strip.Color(0, 255, 0, 0),strip.Color(100, 0, 0, 0));
|
||||
led_gauge(loopmillis,vbat,3*12,4.2*12,strip.Color(0, 255, 0, 0),strip.Color(100, 0, 0, 0));
|
||||
}else{
|
||||
//Driving
|
||||
float currentMean=escRear.getFiltered_curL()+escRear.getFiltered_curR()+escFront.getFiltered_curL()+escFront.getFiltered_curR();
|
||||
|
|
|
@ -81,7 +81,7 @@ bool initLogging() {
|
|||
|
||||
void loggingLoop(unsigned long loopmillis,ESCSerialComm& escFront, ESCSerialComm& escRear) {
|
||||
|
||||
static unsigned long last_datalogging_write=loopmillis; //initialize with current time to have first log written after one interval
|
||||
static unsigned long last_datalogging_write=0;
|
||||
static boolean logging_headerWritten=false;
|
||||
|
||||
unsigned long logginginterval=LOGGINGINTERVAL;
|
||||
|
|
|
@ -269,6 +269,14 @@ void loop() {
|
|||
|
||||
|
||||
|
||||
loggingLoop(loopmillis,escFront,escRear);
|
||||
if (!armed && !statswritten) { //write stats only once when disarmed
|
||||
statswritten=true;
|
||||
writeTrip(loopmillis,escFront,escRear);
|
||||
}
|
||||
if (statswritten && armed) {
|
||||
statswritten=false;
|
||||
}
|
||||
|
||||
leds();
|
||||
led_update(loopmillis,escFront,escRear); //ws2812 led ring
|
||||
|
@ -319,17 +327,6 @@ void loop() {
|
|||
serialCommandLoop(loopmillis,escFront,escRear);
|
||||
|
||||
|
||||
//Logging
|
||||
loggingLoop(loopmillis,escFront,escRear);
|
||||
if (!armed && !statswritten) { //write stats only once when disarmed
|
||||
statswritten=true;
|
||||
writeTrip(loopmillis,escFront,escRear);
|
||||
}
|
||||
if (statswritten && armed) {
|
||||
statswritten=false;
|
||||
}
|
||||
|
||||
|
||||
looptime_duration_min=min(looptime_duration_min,millis()-loopmillis);
|
||||
looptime_duration_max=max(looptime_duration_max,millis()-loopmillis);
|
||||
|
||||
|
|
|
@ -1,47 +1,52 @@
|
|||
import matplotlib.pyplot as plt
|
||||
#import csv
|
||||
import pandas as pd
|
||||
import csv
|
||||
|
||||
import numpy as np
|
||||
x=[]
|
||||
speed_FrontL=[]
|
||||
speed_FrontR=[]
|
||||
speed_RearL=[]
|
||||
speed_RearR=[]
|
||||
|
||||
fp = open('LOG00203c_replacedFrontLeftWheel.TXT')
|
||||
|
||||
rdr = csv.DictReader(filter(lambda row: row[0]!='#', fp))
|
||||
for row in rdr:
|
||||
#print(row)
|
||||
x.append(float(row['cmd_FrontL']))
|
||||
|
||||
speed_FrontL.append(float(row['speed_FrontL']))
|
||||
speed_FrontR.append(float(row['speed_FrontR']))
|
||||
speed_RearL.append(float(row['speed_RearL']))
|
||||
speed_RearR.append(float(row['speed_RearR']))
|
||||
fp.close()
|
||||
|
||||
|
||||
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
|
||||
#plt.plot(x,y, label='Loaded from file!')
|
||||
scattersize=5
|
||||
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['cmd_FrontL']), c='r', alpha=0.5, label="cmd_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.scatter(x,speed_FrontL, s=scattersize, alpha=scatteralpha, label="speed_FrontL")
|
||||
plt.scatter(x,speed_FrontR, s=scattersize, alpha=scatteralpha, label="speed_FrontR")
|
||||
plt.scatter(x,speed_RearL, s=scattersize, alpha=scatteralpha, label="speed_RearL")
|
||||
plt.scatter(x,speed_RearR, s=scattersize, alpha=scatteralpha, label="speed_RearR")
|
||||
plt.xlabel('cmd')
|
||||
plt.ylabel('speed')
|
||||
plt.title('Interesting Graph\nCheck it out')
|
||||
plt.legend()
|
||||
plt.show()
|
||||
|
||||
|
||||
exit()
|
||||
'''
|
||||
with open(,'r') as csvfile:
|
||||
plots = csv.reader(filter(lambda row: row[0]!='#', csvfile), delimiter=',')
|
||||
for row in plots:
|
||||
x.append(float(row[0]))
|
||||
y.append(float(row[1]))
|
||||
|
||||
plt.plot(x,y, label='Loaded from file!')
|
||||
plt.xlabel('x')
|
||||
plt.ylabel('y')
|
||||
plt.title('Interesting Graph\nCheck it out')
|
||||
plt.legend()
|
||||
plt.show()
|
||||
'''
|
||||
|
||||
|
|
|
@ -148,8 +148,6 @@ def delete_file(filename):
|
|||
exit()
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if serialport.isOpen():
|
||||
|
||||
establish_connection()
|
||||
|
@ -161,7 +159,6 @@ if __name__ == "__main__":
|
|||
|
||||
|
||||
#Copy all Files
|
||||
|
||||
failed=0
|
||||
|
||||
for filename in filenames:
|
||||
|
@ -183,7 +180,6 @@ if __name__ == "__main__":
|
|||
|
||||
|
||||
#Delete all files
|
||||
|
||||
'''
|
||||
log_off()
|
||||
for filename in filenames:
|
||||
|
@ -191,7 +187,12 @@ if __name__ == "__main__":
|
|||
'''
|
||||
|
||||
|
||||
|
||||
|
||||
serialport.write("echo on\n".encode())
|
||||
|
||||
|
||||
|
||||
|
||||
serialport.close()
|
||||
|
||||
|
|
|
@ -107,6 +107,8 @@ if (args.consecutive):
|
|||
|
||||
|
||||
|
||||
print("")
|
||||
print(inputFilenames)
|
||||
|
||||
|
||||
else:
|
||||
|
@ -148,7 +150,7 @@ for inputFilename in inputFilenames:
|
|||
|
||||
linesStarttime+=_linesStarttime
|
||||
|
||||
print("Lines in file="+str(len(inputlines)))
|
||||
print("Line in file="+str(len(inputlines)))
|
||||
|
||||
assert len(lines)==len(linesStarttime), "Length of lines and linesStarttime does not match"
|
||||
|
||||
|
|
Loading…
Reference in New Issue