Skip to content

Commit

Permalink
max steering angle for nissan
Browse files Browse the repository at this point in the history
  • Loading branch information
bongbui321 committed Jul 19, 2024
1 parent 0f58e96 commit 894e653
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions selfdrive/car/nissan/carcontroller.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
from cereal import car
from opendbc.can.packer import CANPacker
from openpilot.common.numpy_fast import clip
from openpilot.selfdrive.car import apply_std_steer_angle_limits
from openpilot.selfdrive.car.interfaces import CarControllerBase
from openpilot.selfdrive.car.nissan import nissancan
from openpilot.selfdrive.car.nissan.values import CAR, CarControllerParams

VisualAlert = car.CarControl.HUDControl.VisualAlert

# When output steering Angle not within range -1311 and 1310,
# CANPacker packs wrong angle output to be decoded by panda
MAX_STEER_ANGLE = 1310

class CarController(CarControllerBase):
def __init__(self, dbc_name, CP, VM):
Expand Down Expand Up @@ -49,6 +53,7 @@ def update(self, CC, CS, now_nanos):
apply_angle = CS.out.steeringAngleDeg
self.lkas_max_torque = 0

apply_angle = clip(apply_angle, -MAX_STEER_ANGLE, MAX_STEER_ANGLE)
self.apply_angle_last = apply_angle

if self.CP.carFingerprint in (CAR.NISSAN_ROGUE, CAR.NISSAN_XTRAIL, CAR.NISSAN_ALTIMA) and pcm_cancel_cmd:
Expand Down

0 comments on commit 894e653

Please sign in to comment.