Files
StarPilot/openpilot/starpilot/lateral/suburban_policy.py
T
firestar5683 79c8945a41 Lateral
Integrate torque feedback, lane-change smoothing and low-speed Turn Assist through dedicated lateral owners.

Co-authored-by: Dom <168790843+firestar5683@users.noreply.github.com>

Co-authored-by: pharmacomaniac <blittle65@gmail.com>
2026-10-14 20:02:39 -05:00

25 lines
876 B
Python

"""Ordinary Suburban torque selection."""
import math
from opendbc.car.structs import CarParams
from opendbc.car.gm.suburban import supported_cp as supported_profile
from openpilot.starpilot.lateral.gm_ordinary_policy import GMOrdinaryTorquePolicy
def supported_cp(cp):
if not supported_profile(cp):
return False
if cp.steerControlType != CarParams.SteerControlType.torque or cp.lateralTuning.which() != "torque":
return False
tune = cp.lateralTuning.torque
return (math.isfinite(tune.latAccelFactor) and tune.latAccelFactor > 0 and
math.isfinite(tune.latAccelOffset) and math.isfinite(tune.friction) and tune.friction >= 0)
class SuburbanTorquePolicy(GMOrdinaryTorquePolicy):
def __init__(self, parent, cp):
if not supported_cp(cp):
raise ValueError("Unsupported ordinary Suburban torque profile")
super().__init__(parent, cp)