From de975d5af9413a36fcb8c3b28be03b85a4296278 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sat, 20 Dec 2025 15:04:13 -0800 Subject: [PATCH] card: remove MockCarstate (#36941) --- selfdrive/car/car_specific.py | 16 ---------------- selfdrive/car/card.py | 4 ---- 2 files changed, 20 deletions(-) diff --git a/selfdrive/car/car_specific.py b/selfdrive/car/car_specific.py index 6210983d9..307132e78 100644 --- a/selfdrive/car/car_specific.py +++ b/selfdrive/car/car_specific.py @@ -1,5 +1,4 @@ from cereal import car, log -import cereal.messaging as messaging from opendbc.car import DT_CTRL, structs from opendbc.car.interfaces import MAX_CTRL_SPEED @@ -11,21 +10,6 @@ EventName = log.OnroadEvent.EventName NetworkLocation = structs.CarParams.NetworkLocation -# TODO: the goal is to abstract this file into the CarState struct and make events generic -class MockCarState: - def __init__(self): - self.sm = messaging.SubMaster(['gpsLocation', 'gpsLocationExternal']) - - def update(self, CS: car.CarState): - self.sm.update(0) - gps_sock = 'gpsLocationExternal' if self.sm.recv_frame['gpsLocationExternal'] > 1 else 'gpsLocation' - - CS.vEgo = self.sm[gps_sock].speed - CS.vEgoRaw = self.sm[gps_sock].speed - - return CS - - BRAND_EXTRA_GEARS = { 'ford': [GearShifter.low, GearShifter.manumatic], 'nissan': [GearShifter.brake], diff --git a/selfdrive/car/card.py b/selfdrive/car/card.py index 27b04ae65..aa0d12e96 100755 --- a/selfdrive/car/card.py +++ b/selfdrive/car/card.py @@ -19,7 +19,6 @@ from opendbc.car.car_helpers import get_car, interfaces from opendbc.car.interfaces import CarInterfaceBase, RadarInterfaceBase from openpilot.selfdrive.pandad import can_capnp_to_list, can_list_to_can_capnp from openpilot.selfdrive.car.cruise import VCruiseHelper -from openpilot.selfdrive.car.car_specific import MockCarState REPLAY = "REPLAY" in os.environ @@ -150,7 +149,6 @@ class Car: self.params.put_nonblocking("CarParamsCache", cp_bytes) self.params.put_nonblocking("CarParamsPersistent", cp_bytes) - self.mock_carstate = MockCarState() self.v_cruise_helper = VCruiseHelper(self.CP) self.is_metric = self.params.get_bool("IsMetric") @@ -167,8 +165,6 @@ class Car: # Update carState from CAN CS = self.CI.update(can_list) - if self.CP.brand == 'mock': - CS = self.mock_carstate.update(CS) # Update radar tracks from CAN RD: structs.RadarDataT | None = self.RI.update(can_list)