Skip to content

Commit

Permalink
Revert "Ram HD: locked Steering Ratio (commaai#156)" (commaai#161)
Browse files Browse the repository at this point in the history
This reverts commit 8db81e9.
  • Loading branch information
sunnyhaibin authored Jun 15, 2023
1 parent ea903cc commit 8790419
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
1 change: 0 additions & 1 deletion selfdrive/car/chrysler/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):
ret.mass = 3405. + STD_CARGO_KG
ret.minSteerSpeed = 16
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning, 1.0, False)
ret.flags |= ChryslerFlags.SP_RAM_HD_FIXED_STEERING_RATIO.value

else:
raise ValueError(f"Unsupported car: {candidate}")
Expand Down
2 changes: 0 additions & 2 deletions selfdrive/car/chrysler/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
class ChryslerFlags(IntFlag):
HIGHER_MIN_STEERING_SPEED = 1

SP_RAM_HD_FIXED_STEERING_RATIO = 2


class CAR:
# Chrysler
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/controls/controlsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ def state_control(self, CS):
lp = self.sm['liveParameters']
x = max(lp.stiffnessFactor, 0.1)
sr = max(lp.steerRatio, 0.1)
self.VM.update_params(x, sr, self.CP)
self.VM.update_params(x, sr)

# Update Torque Params
if self.CP.lateralTuning.which() == 'torque':
Expand Down
9 changes: 3 additions & 6 deletions selfdrive/controls/lib/vehicle_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

from cereal import car

from selfdrive.car.chrysler.values import ChryslerFlags

ACCELERATION_DUE_TO_GRAVITY = 9.8


Expand All @@ -40,14 +38,13 @@ def __init__(self, CP: car.CarParams):

self.cF_orig: float = CP.tireStiffnessFront
self.cR_orig: float = CP.tireStiffnessRear
self.chrysler_ram_hd: bool = (CP.carName == "chrysler") and CP.flags & ChryslerFlags.SP_RAM_HD_FIXED_STEERING_RATIO.value
self.update_params(1.0, CP.steerRatio, CP)
self.update_params(1.0, CP.steerRatio)

def update_params(self, stiffness_factor: float, steer_ratio: float, CP: car.CarParams) -> None:
def update_params(self, stiffness_factor: float, steer_ratio: float) -> None:
"""Update the vehicle model with a new stiffness factor and steer ratio"""
self.cF: float = stiffness_factor * self.cF_orig
self.cR: float = stiffness_factor * self.cR_orig
self.sR: float = CP.steerRatio if self.chrysler_ram_hd else steer_ratio
self.sR: float = steer_ratio

def steady_state_sol(self, sa: float, u: float, roll: float) -> np.ndarray:
"""Returns the steady state solution.
Expand Down

0 comments on commit 8790419

Please sign in to comment.