diff --git a/selfdrive/car/card.py b/selfdrive/car/card.py index 8c3ece0e..72f3e631 100644 --- a/selfdrive/car/card.py +++ b/selfdrive/car/card.py @@ -164,9 +164,9 @@ class Car: self.is_metric = self.params.get_bool("IsMetric") self.experimental_mode = self.params.get_bool("ExperimentalMode") - #self.t1 = time.monotonic() - #self.t2 = self.t1 - #self.t3 = self.t2 + self.t1 = time.monotonic() + self.t2 = self.t1 + self.t3 = self.t2 # card is driven by can recv, expected at 100Hz self.rk = Ratekeeper(100, print_delay_threshold=None) @@ -187,7 +187,7 @@ class Car: #RD: structs.RadarDataT | None = self.RI.update_carrot(CS.vEgo, can_list) self.sm.update(0) - #self.t1 = time.monotonic() + self.t1 = time.monotonic() can_rcv_valid = len(can_strs) > 0 @@ -199,11 +199,11 @@ class Car: self.can_log_mono_time = messaging.log_from_bytes(can_strs[0]).logMonoTime RD: structs.RadarDataT | None = self.RI.update_carrot(CS.vEgo, rcv_time, can_list) - #self.t2 = time.monotonic() + self.t2 = time.monotonic() #self.v_cruise_helper.update_v_cruise(CS, self.sm['carControl'].enabled, self.is_metric) self.v_cruise_helper.update_v_cruise(CS, self.sm, self.is_metric) - #self.t3 = time.monotonic() + self.t3 = time.monotonic() if self.sm['carControl'].enabled and not self.CC_prev.enabled: # Use CarState w/ buttons from the step selfdrived enables on self.v_cruise_helper.initialize_v_cruise(self.CS_prev, self.experimental_mode) @@ -300,10 +300,10 @@ class Car: try: t.start() while True: - #start = time.monotonic() + start = time.monotonic() self.step() - #if self.sm.frame % 100 == 0: - # print(f"elapsed time = {(self.t1 - start)*1000.:.2f}, {(self.t2 - self.t1)*1000.:.2f}, {(self.t3 - self.t1)*1000.:.2f}, {(time.monotonic() - self.t1)*1000.:.2f}") + if self.sm.frame % 100 == 0: + print(f"elapsed time = {(self.t1 - start)*1000.:.2f}, {(self.t2 - self.t1)*1000.:.2f}, {(self.t3 - self.t1)*1000.:.2f}, {(time.monotonic() - self.t1)*1000.:.2f}") self.rk.monitor_time() finally: e.set()