From 0ac9efaca9eccd4f6db8c6f5b9409b3a34a8b8de Mon Sep 17 00:00:00 2001 From: BogGyver Date: Wed, 21 Apr 2021 15:33:31 -0400 Subject: [PATCH] fixing bodyControls pass through info --- selfdrive/car/tesla/carcontroller.py | 3 ++- selfdrive/car/tesla/carstate.py | 3 +++ selfdrive/car/tesla/teslacan.py | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/selfdrive/car/tesla/carcontroller.py b/selfdrive/car/tesla/carcontroller.py index 44d02907b..afcc38eed 100644 --- a/selfdrive/car/tesla/carcontroller.py +++ b/selfdrive/car/tesla/carcontroller.py @@ -311,7 +311,8 @@ def update(self, enabled, CS, frame, actuators, cruise_cancel, hud_alert, audibl CAN_CHASSIS[self.CP.carFingerprint], 1)) # send DAS_bodyControls - can_sends.append(self.tesla_can.create_body_controls_message(CS.msg_das_body_controls, + if self.IC_integration_counter in [20,70]: + can_sends.append(self.tesla_can.create_body_controls_message(CS.msg_das_body_controls, CS.alca_direction, 1 if CS.needs_hazard else 0 , CAN_CHASSIS[self.CP.carFingerprint], 1)) # send DAS_warningMatrix0 at 1Hz diff --git a/selfdrive/car/tesla/carstate.py b/selfdrive/car/tesla/carstate.py index 91cb8596e..df711391a 100644 --- a/selfdrive/car/tesla/carstate.py +++ b/selfdrive/car/tesla/carstate.py @@ -248,13 +248,16 @@ def update(self, cp, cp_cam): sw_a = copy.copy(cp.vl["STW_ACTN_RQ"]) if sw_a is not None: self.msg_stw_actn_req = sw_a + if (self.CP.carFingerprint != CAR.PREAP_MODELS): ap_s = copy.copy(cp_cam.vl["DAS_status"]) if ap_s is not None: self.msg_autopilot_status = ap_s + bc = copy.copy(cp_cam.vl["DAS_bodyControls"]) if bc is not None: self.msg_das_body_controls = bc + ap_s2 = copy.copy(cp_cam.vl["DAS_status2"]) if ap_s2 is not None: self.msg_autopilot_status2 = ap_s2 diff --git a/selfdrive/car/tesla/teslacan.py b/selfdrive/car/tesla/teslacan.py index 88256e8d5..cd1abfd10 100644 --- a/selfdrive/car/tesla/teslacan.py +++ b/selfdrive/car/tesla/teslacan.py @@ -57,6 +57,8 @@ def create_lead_car_object_message(self, objectId, vType1,vId1,relevant1,dx1,vxr def create_body_controls_message(self,msg_das_body_controls,turn,hazard,bus,counter): if msg_das_body_controls is not None: values = copy.copy(msg_das_body_controls) + values["DAS_bodyControlsCounter"] = counter + values["DAS_bodyControlsChecksum"] = 0 else: values = { "DAS_headlightRequest" : 0,