Calibrationd: check size of valid_blocks without current (#23223)

pull/23190/head
HaraldSchafer 2021-12-14 15:14:14 -08:00 committed by GitHub
parent 40dcc63823
commit cd190dc85d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -106,7 +106,7 @@ class Calibrator():
return before_current + after_current
def update_status(self):
if self.valid_blocks > 0:
if len(self.get_valid_idxs()) > 0:
max_rpy_calib = np.array(np.max(self.rpys[self.get_valid_idxs()], axis=0))
min_rpy_calib = np.array(np.min(self.rpys[self.get_valid_idxs()], axis=0))
self.calib_spread = np.abs(max_rpy_calib - min_rpy_calib)
@ -163,7 +163,7 @@ class Calibrator():
self.block_idx += 1
self.valid_blocks = max(self.block_idx, self.valid_blocks)
self.block_idx = self.block_idx % INPUTS_WANTED
if self.valid_blocks > 0:
if len(self.get_valid_idxs()) > 0:
self.rpy = np.mean(self.rpys[self.get_valid_idxs()], axis=0)
self.update_status()