From 71854a36b53eee5e2c8b401ffbee34945b8bb737 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Tue, 8 Oct 2024 20:30:02 -0700 Subject: [PATCH] try something else --- opendbc/car/toyota/carcontroller.py | 3 +++ opendbc/car/toyota/carstate.py | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/opendbc/car/toyota/carcontroller.py b/opendbc/car/toyota/carcontroller.py index ebbf701811..378bd79163 100644 --- a/opendbc/car/toyota/carcontroller.py +++ b/opendbc/car/toyota/carcontroller.py @@ -164,6 +164,9 @@ def update(self, CC, CS, now_nanos): self.pcm_accel_compensation = rate_limit(pcm_accel_compensation, self.pcm_accel_compensation, -0.01, 0.01) pcm_accel_cmd = actuators.accel - self.pcm_accel_compensation + # prevent request from deviating too far from current pcm accel net + pcm_accel_cmd = max(pcm_accel_cmd, CS.pcm_accel_net - 0.5) + # Along with rate limiting positive jerk below, this greatly improves gas response time # Consider the net acceleration request that the PCM should be applying (pitch included) if net_acceleration_request < 0.1: diff --git a/opendbc/car/toyota/carstate.py b/opendbc/car/toyota/carstate.py index a7bbaca8e4..46b962d77a 100644 --- a/opendbc/car/toyota/carstate.py +++ b/opendbc/car/toyota/carstate.py @@ -69,9 +69,10 @@ def update(self, cp, cp_cam, *_) -> structs.CarState: if cp.vl["PCM_CRUISE"]["ACC_BRAKING"]: self.pcm_accel_net += min(cp.vl["PCM_CRUISE"]["ACCEL_NET"], 0.0) - # this 0.8x seems consistent with the pitch compensated accel net, TODO: figure out what this is - if cp.vl["VSC1S29"]["ICBACT"]: - self.pcm_accel_net *= 0.8 + # # this 0.8x seems consistent with the pitch compensated accel net, TODO: figure out what this is + # TODO: no it doesn't, is it request rate based? + # if cp.vl["VSC1S29"]["ICBACT"]: + # self.pcm_accel_net *= 0.8 # add creeping force at low speeds only for braking, CLUTCH->ACCEL_NET already shows this # TODO: with ICBACT maybe we can always add neutral force for engine braking at high speed now!