Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion PID-Analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,11 @@ def plot_all_noise(self, traces, lims): #style='fancy' gives 2d hist for respons
'- all filters: set debug_mode = NOTCH\n'
'- LPF only: set debug_mode = GYRO', horizontalalignment='center', verticalalignment = 'center',
transform = ax1.transAxes,fontdict={'color': 'white'})

if correctdebugmode == False:
ax1.text(0.5, 0.5, 'warning: debug does not contain prefiltered gyro\n'
'set debug_mode = GYRO_SCALED', horizontalalignment='center', verticalalignment = 'center',
transform = ax1.transAxes,fontdict={'color': 'white'})

if i<2:
# dterm plots
Expand Down Expand Up @@ -675,6 +680,7 @@ def __analyze(self):
def readcsv(self, fpath):
logging.info('Reading: Log '+str(self.headdict['logNum']))
datdic = {}
global correctdebugmode
### keycheck for 'usecols' only reads usefull traces, uncommend if needed
wanted = ['time (us)',
'rcCommand[0]', 'rcCommand[1]', 'rcCommand[2]', 'rcCommand[3]',
Expand All @@ -692,6 +698,8 @@ def readcsv(self, fpath):
data = read_csv(fpath, header=0, skipinitialspace=1, usecols=lambda k: k in wanted, dtype=np.float64)
datdic.update({'time_us': data['time (us)'].values * 1e-6})
datdic.update({'throttle': data['rcCommand[3]'].values})

correctdebugmode = not np.any(data['debug[3]']) # if debug[3] contains data, debug_mode is not correct for plotting

for i in ['0', '1', '2']:
datdic.update({'rcCommand' + i: data['rcCommand['+i+']'].values})
Expand Down Expand Up @@ -1031,4 +1039,4 @@ def clean_path(path):
plt.show()
else:
plt.cla()
plt.clf()
plt.clf()