|
|
@ -63,7 +63,7 @@ class CarController: |
|
|
|
# Gas/regen and brakes - all at 25Hz |
|
|
|
# Gas/regen and brakes - all at 25Hz |
|
|
|
if (self.frame % 4) == 0: |
|
|
|
if (self.frame % 4) == 0: |
|
|
|
if not CC.longActive: |
|
|
|
if not CC.longActive: |
|
|
|
# Stock ECU sends max regen when not enabled. |
|
|
|
# Stock ECU sends max regen when not enabled |
|
|
|
self.apply_gas = self.params.MAX_ACC_REGEN |
|
|
|
self.apply_gas = self.params.MAX_ACC_REGEN |
|
|
|
self.apply_brake = 0 |
|
|
|
self.apply_brake = 0 |
|
|
|
else: |
|
|
|
else: |
|
|
@ -74,13 +74,14 @@ class CarController: |
|
|
|
|
|
|
|
|
|
|
|
at_full_stop = CC.longActive and CS.out.standstill |
|
|
|
at_full_stop = CC.longActive and CS.out.standstill |
|
|
|
near_stop = CC.longActive and (CS.out.vEgo < self.params.NEAR_STOP_BRAKE_PHASE) |
|
|
|
near_stop = CC.longActive and (CS.out.vEgo < self.params.NEAR_STOP_BRAKE_PHASE) |
|
|
|
|
|
|
|
# GasRegenCmdActive needs to be 1 to avoid cruise faults. It describes the ACC state, not actuation |
|
|
|
|
|
|
|
can_sends.append(gmcan.create_gas_regen_command(self.packer_pt, CanBus.POWERTRAIN, self.apply_gas, idx, CC.enabled, at_full_stop)) |
|
|
|
can_sends.append(gmcan.create_friction_brake_command(self.packer_ch, CanBus.CHASSIS, self.apply_brake, idx, near_stop, at_full_stop)) |
|
|
|
can_sends.append(gmcan.create_friction_brake_command(self.packer_ch, CanBus.CHASSIS, self.apply_brake, idx, near_stop, at_full_stop)) |
|
|
|
can_sends.append(gmcan.create_gas_regen_command(self.packer_pt, CanBus.POWERTRAIN, self.apply_gas, idx, CC.longActive, at_full_stop)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Send dashboard UI commands (ACC status), 25hz |
|
|
|
# Send dashboard UI commands (ACC status), 25hz |
|
|
|
if (self.frame % 4) == 0: |
|
|
|
if (self.frame % 4) == 0: |
|
|
|
send_fcw = hud_alert == VisualAlert.fcw |
|
|
|
send_fcw = hud_alert == VisualAlert.fcw |
|
|
|
can_sends.append(gmcan.create_acc_dashboard_command(self.packer_pt, CanBus.POWERTRAIN, CC.longActive, |
|
|
|
can_sends.append(gmcan.create_acc_dashboard_command(self.packer_pt, CanBus.POWERTRAIN, CC.enabled, |
|
|
|
hud_v_cruise * CV.MS_TO_KPH, hud_control.leadVisible, send_fcw)) |
|
|
|
hud_v_cruise * CV.MS_TO_KPH, hud_control.leadVisible, send_fcw)) |
|
|
|
|
|
|
|
|
|
|
|
# Radar needs to know current speed and yaw rate (50hz), |
|
|
|
# Radar needs to know current speed and yaw rate (50hz), |
|
|
|