pid_calibrate: Update for improved python3 compatibility

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2020-09-04 19:30:18 -04:00
parent 9406baf40b
commit 5cce7f4d55
1 changed files with 1 additions and 1 deletions

View File

@ -130,7 +130,7 @@ class ControlAutoTune:
def calc_final_pid(self): def calc_final_pid(self):
cycle_times = [(self.peaks[pos][1] - self.peaks[pos-2][1], pos) cycle_times = [(self.peaks[pos][1] - self.peaks[pos-2][1], pos)
for pos in range(4, len(self.peaks))] for pos in range(4, len(self.peaks))]
midpoint_pos = sorted(cycle_times)[len(cycle_times)/2][1] midpoint_pos = sorted(cycle_times)[len(cycle_times)//2][1]
return self.calc_pid(midpoint_pos) return self.calc_pid(midpoint_pos)
# Offline analysis helper # Offline analysis helper
def write_file(self, filename): def write_file(self, filename):