Skip to content

Commit

Permalink
Calibrationd: check size of valid_blocks without current (commaai#23223)
Browse files Browse the repository at this point in the history
  • Loading branch information
haraschax committed Dec 14, 2021
1 parent 40dcc63 commit cd190dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions selfdrive/locationd/calibrationd.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def get_valid_idxs(self, ):
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)
Expand Down Expand Up @@ -163,7 +163,7 @@ def handle_cam_odom(self, trans, rot, trans_std, rot_std):
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()
Expand Down

0 comments on commit cd190dc

Please sign in to comment.