Skip to content

Commit

Permalink
Lexus ES TSS2: compensate for creeping force (commaai#1271)
Browse files Browse the repository at this point in the history
* compensate for creeping force

* better comp

* not needed yet
  • Loading branch information
sshane authored Sep 27, 2024
1 parent 97f519b commit f4b30bc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion opendbc/car/toyota/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,17 @@ def update(self, cp, cp_cam, *_) -> structs.CarState:
# CLUTCH->ACCEL_NET is only accurate for gas, PCM_CRUISE->ACCEL_NET is only accurate for brake
# These signals only have meaning when ACC is active
if self.CP.flags & ToyotaFlags.RAISED_ACCEL_LIMIT:
# Sometimes ACC_BRAKING can be 1 while showing we're applying gas already
self.pcm_accel_net = max(cp.vl["CLUTCH"]["ACCEL_NET"], 0.0)

# Sometimes ACC_BRAKING can be 1 while showing we're applying gas already
if cp.vl["PCM_CRUISE"]["ACC_BRAKING"]:
self.pcm_accel_net += min(cp.vl["PCM_CRUISE"]["ACCEL_NET"], 0.0)

# add creeping force at low speeds only for braking, CLUTCH->ACCEL_NET already shows this
neutral_accel = max(cp.vl["PCM_CRUISE"]["NEUTRAL_FORCE"] / self.CP.mass, 0.0)
if self.pcm_accel_net + neutral_accel < 0.0:
self.pcm_accel_net += neutral_accel

# filtered pitch estimate from the car, negative is a downward slope
self.slope_angle = cp.vl["VSC1S07"]["ASLP"] * CV.DEG_TO_RAD

Expand Down

0 comments on commit f4b30bc

Please sign in to comment.