Simulator: wait for engageable (#30105)

wait for engageable
old-commit-hash: 5c2cbec06ef0577425b0eae7f1bf506c7796c89e
This commit is contained in:
Justin Newberry
2023-09-29 12:18:49 -07:00
committed by GitHub
parent 8dcd04e702
commit 3cd9856fcc

View File

@@ -147,7 +147,8 @@ 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)
self.simulator_state.is_engaged = self.simulated_car.sm['controlsState'].active
controlsState = self.simulated_car.sm['controlsState']
self.simulator_state.is_engaged = controlsState.active
if self.simulator_state.is_engaged:
throttle_op = clip(self.simulated_car.sm['carControl'].actuators.accel / 1.6, 0.0, 1.0)
@@ -155,7 +156,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:
elif not self.past_startup_engaged and controlsState.engageable:
self.simulator_state.cruise_button = CruiseButtons.DECEL_SET # force engagement on startup
throttle_out = throttle_op if self.simulator_state.is_engaged else throttle_manual