Deprecate controlsState state fields (#33437)

* Deprecate controlsState state fields

* sim works

* update refs

* one more

* these too

* update sim
old-commit-hash: 3924ac587b735d1e735af4cb77faf6ccf053f656
This commit is contained in:
Adeeb Shihadeh
2024-09-03 14:40:23 -07:00
committed by GitHub
parent 53288d4dbf
commit bd2b09c7b6
18 changed files with 60 additions and 74 deletions
+12 -12
View File
@@ -90,18 +90,18 @@ void LogReader::migrateOldEvents() {
new_evt.setLogMonoTime(old_evt.getLogMonoTime());
auto new_state = new_evt.initSelfdriveState();
new_state.setActive(old_state.getActive());
new_state.setAlertSize(old_state.getAlertSize());
new_state.setAlertSound(old_state.getAlertSound());
new_state.setAlertStatus(old_state.getAlertStatus());
new_state.setAlertText1(old_state.getAlertText1());
new_state.setAlertText2(old_state.getAlertText2());
new_state.setAlertType(old_state.getAlertType());
new_state.setEnabled(old_state.getEnabled());
new_state.setEngageable(old_state.getEngageable());
new_state.setExperimentalMode(old_state.getExperimentalMode());
new_state.setPersonality(old_state.getPersonality());
new_state.setState(old_state.getState());
new_state.setActive(old_state.getActiveDEPRECATED());
new_state.setAlertSize(old_state.getAlertSizeDEPRECATED());
new_state.setAlertSound(old_state.getAlertSound2DEPRECATED());
new_state.setAlertStatus(old_state.getAlertStatusDEPRECATED());
new_state.setAlertText1(old_state.getAlertText1DEPRECATED());
new_state.setAlertText2(old_state.getAlertText2DEPRECATED());
new_state.setAlertType(old_state.getAlertTypeDEPRECATED());
new_state.setEnabled(old_state.getEnabledDEPRECATED());
new_state.setEngageable(old_state.getEngageableDEPRECATED());
new_state.setExperimentalMode(old_state.getExperimentalModeDEPRECATED());
new_state.setPersonality(old_state.getPersonalityDEPRECATED());
new_state.setState(old_state.getStateDEPRECATED());
// Serialize the new event to the buffer
auto buf_size = msg.getSerializedSize();
+2 -3
View File
@@ -167,8 +167,7 @@ Ignition: {self.simulator_state.ignition} Engaged: {self.simulator_state.is_enga
self.simulated_sensors.update(self.simulator_state, self.world)
self.simulated_car.sm.update(0)
controlsState = self.simulated_car.sm['controlsState']
self.simulator_state.is_engaged = controlsState.active
self.simulator_state.is_engaged = self.simulated_car.sm['selfdriveState'].active
if self.simulator_state.is_engaged:
throttle_op = clip(self.simulated_car.sm['carControl'].actuators.accel / 1.6, 0.0, 1.0)
@@ -176,7 +175,7 @@ Ignition: {self.simulator_state.ignition} Engaged: {self.simulator_state.is_enga
steer_op = self.simulated_car.sm['carControl'].actuators.steeringAngleDeg
self.past_startup_engaged = True
elif not self.past_startup_engaged and controlsState.engageable:
elif not self.past_startup_engaged and self.simulated_car.sm['selfdriveState'].engageable:
self.simulator_state.cruise_button = CruiseButtons.DECEL_SET if self.startup_button_prev else CruiseButtons.MAIN # force engagement on startup
self.startup_button_prev = not self.startup_button_prev
+1 -1
View File
@@ -14,7 +14,7 @@ class SimulatedCar:
def __init__(self):
self.pm = messaging.PubMaster(['can', 'pandaStates'])
self.sm = messaging.SubMaster(['carControl', 'controlsState', 'carParams'])
self.sm = messaging.SubMaster(['carControl', 'controlsState', 'carParams', 'selfdriveState'])
self.cp = self.get_car_can_parser()
self.idx = 0
self.params = Params()
+2 -2
View File
@@ -25,7 +25,7 @@ class TestSimBridgeBase:
p_manager = subprocess.Popen("./launch_openpilot.sh", cwd=SIM_DIR)
self.processes.append(p_manager)
sm = messaging.SubMaster(['controlsState', 'onroadEvents', 'managerState'])
sm = messaging.SubMaster(['selfdriveState', 'onroadEvents', 'managerState'])
q = Queue()
bridge = self.create_bridge()
p_bridge = bridge.run(q, retries=10)
@@ -63,7 +63,7 @@ class TestSimBridgeBase:
while time.monotonic() < start_time + max_time_per_step:
sm.update()
if sm.all_alive() and sm['controlsState'].active:
if sm.all_alive() and sm['selfdriveState'].active:
control_active += 1
if control_active == min_counts_control_active: