solve starting-state a different way

mqb-long
Jason Young 3 years ago
parent 0117986dca
commit d49b5c2786
  1. 2
      selfdrive/car/volkswagen/carcontroller.py
  2. 3
      selfdrive/car/volkswagen/carstate.py
  3. 4
      selfdrive/car/volkswagen/mqbcan.py
  4. 2
      selfdrive/car/volkswagen/pqcan.py
  5. 3
      selfdrive/controls/lib/longcontrol.py

@ -76,7 +76,7 @@ class CarController:
stopping = actuators.longControlState == LongCtrlState.stopping
starting = actuators.longControlState == LongCtrlState.starting
can_sends.extend(self.CCS.create_acc_accel_control(self.packer_pt, CANBUS.pt, CS.acc_type, CC.longActive, accel,
acc_control, stopping, starting, CS.out.cruiseState.standstill))
acc_control, stopping, starting, CS.out.esp_hold_confirmation))
# **** HUD Controls ***************************************************** #

@ -118,7 +118,8 @@ class CarState(CarStateBase):
# ACC okay but disabled (1), or a radar visibility or other fault/disruption (6 or 7)
ret.cruiseState.available = False
ret.cruiseState.enabled = False
ret.cruiseState.standstill = bool(pt_cp.vl["ESP_21"]["ESP_Haltebestaetigung"])
self.esp_hold_confirmation = bool(pt_cp.vl["ESP_21"]["ESP_Haltebestaetigung"])
ret.cruiseState.standstill = self.CP.pcmCruise and self.esp_hold_confirmation
ret.accFaulted = pt_cp.vl["TSK_06"]["TSK_Status"] in (6, 7)
# Update ACC setpoint. When the setpoint is zero or there's an error, the

@ -56,7 +56,7 @@ def acc_hud_status_value(main_switch_on, acc_faulted, long_active):
return acc_control_value(main_switch_on, acc_faulted, long_active)
def create_acc_accel_control(packer, bus, acc_type, enabled, accel, acc_control, stopping, starting, standstill):
def create_acc_accel_control(packer, bus, acc_type, enabled, accel, acc_control, stopping, starting, esp_hold):
commands = []
acc_06_values = {
@ -75,7 +75,7 @@ def create_acc_accel_control(packer, bus, acc_type, enabled, accel, acc_control,
if starting:
acc_hold_type = 4 # hold release / startup
elif standstill:
elif esp_hold:
acc_hold_type = 3 # hold standby
elif stopping:
acc_hold_type = 1 # hold request

@ -59,7 +59,7 @@ def acc_hud_status_value(main_switch_on, acc_faulted, long_active):
return hud_status
def create_acc_accel_control(packer, bus, acc_type, enabled, accel, acc_control, stopping, starting, standstill):
def create_acc_accel_control(packer, bus, acc_type, enabled, accel, acc_control, stopping, starting, esp_hold):
commands = []
values = {

@ -23,6 +23,7 @@ def long_control_state_trans(CP, active, long_control_state, v_ego, v_target,
starting_condition = (v_target_1sec > CP.vEgoStarting and
accelerating and
not cruise_standstill and
not brake_pressed)
started_condition = v_ego > CP.vEgoStarting
@ -44,7 +45,7 @@ def long_control_state_trans(CP, active, long_control_state, v_ego, v_target,
long_control_state = LongCtrlState.pid
elif long_control_state == LongCtrlState.starting:
if planned_stop:
if stopping_condition:
long_control_state = LongCtrlState.stopping
elif started_condition:
long_control_state = LongCtrlState.pid

Loading…
Cancel
Save