don't run long state/actuators unless sending message

pull/23257/head
Jason Young 4 years ago
parent 0275de0737
commit 2db099a179
  1. 13
      selfdrive/car/volkswagen/carcontroller.py

@ -35,6 +35,7 @@ class CarController():
# **** Acceleration and Braking Controls ******************************** # # **** Acceleration and Braking Controls ******************************** #
if CS.CP.openpilotLongitudinalControl: if CS.CP.openpilotLongitudinalControl:
if frame % P.ACC_CONTROL_STEP == 0:
if CS.tsk_status in [2, 3, 4, 5]: if CS.tsk_status in [2, 3, 4, 5]:
acc_status = 3 if enabled else 2 acc_status = 3 if enabled else 2
else: else:
@ -68,7 +69,6 @@ class CarController():
else: else:
weird_value = 0x7F weird_value = 0x7F
if frame % P.ACC_CONTROL_STEP == 0:
idx = (frame / P.ACC_CONTROL_STEP) % 16 idx = (frame / P.ACC_CONTROL_STEP) % 16
can_sends.append(volkswagencan.create_mqb_acc_06_control(self.packer_pt, CANBUS.pt, enabled, acc_status, can_sends.append(volkswagencan.create_mqb_acc_06_control(self.packer_pt, CANBUS.pt, enabled, acc_status,
accel, self.acc_stopping, self.acc_starting, accel, self.acc_stopping, self.acc_starting,
@ -77,6 +77,11 @@ class CarController():
accel, self.acc_stopping, self.acc_starting, accel, self.acc_stopping, self.acc_starting,
acc_hold_request, acc_hold_release, weird_value, idx)) acc_hold_request, acc_hold_release, weird_value, idx))
if frame % P.ACC_HUD_STEP == 0:
idx = (frame / P.ACC_HUD_STEP) % 16
can_sends.append(volkswagencan.create_mqb_acc_hud_control(self.packer_pt, CANBUS.pt, CS.tsk_status,
set_speed * CV.MS_TO_KPH, idx))
# **** Steering Controls ************************************************ # # **** Steering Controls ************************************************ #
if frame % P.HCA_STEP == 0: if frame % P.HCA_STEP == 0:
@ -133,12 +138,6 @@ class CarController():
right_lane_visible, CS.ldw_stock_values, right_lane_visible, CS.ldw_stock_values,
left_lane_depart, right_lane_depart)) left_lane_depart, right_lane_depart))
if CS.CP.openpilotLongitudinalControl:
if frame % P.ACC_HUD_STEP == 0:
idx = (frame / P.ACC_HUD_STEP) % 16
can_sends.append(volkswagencan.create_mqb_acc_hud_control(self.packer_pt, CANBUS.pt, CS.tsk_status,
set_speed * CV.MS_TO_KPH, idx))
# **** ACC Button Controls ********************************************** # # **** ACC Button Controls ********************************************** #
# FIXME: this entire section is in desperate need of refactoring # FIXME: this entire section is in desperate need of refactoring

Loading…
Cancel
Save