Skip to content

Commit

Permalink
use LP pitch
Browse files Browse the repository at this point in the history
  • Loading branch information
sshane committed Oct 18, 2024
1 parent 0512004 commit 9a206ed
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion opendbc/car/toyota/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ def update(self, CC, CS, now_nanos):
# TODO: sometimes when switching from brake to gas quickly, CLUTCH->ACCEL_NET shows a slow unwind. make it go to 0 immediately
if self.CP.flags & ToyotaFlags.RAISED_ACCEL_LIMIT and CC.longActive and not CS.out.cruiseState.standstill:
# calculate amount of acceleration PCM should apply to reach target, given pitch
accel_due_to_pitch = math.sin(CS.slope_angle) * ACCELERATION_DUE_TO_GRAVITY
if len(CC.orientationNED) == 3:
accel_due_to_pitch = math.sin(CC.orientationNED[1]) * ACCELERATION_DUE_TO_GRAVITY
else:
accel_due_to_pitch = 0.0
net_acceleration_request = actuators.accel + accel_due_to_pitch

# let PCM handle stopping for now
Expand Down

0 comments on commit 9a206ed

Please sign in to comment.