mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-07 04:53:47 +08:00
200632aabd
Learn bounded feed-forward corrections on eligible torque controllers behind Use StarPilot Auto Learn, preserving installed tunes and native safety limits. Co-authored-by: Danny <dannyirwin31@yahoo.com> Co-authored-by: Dom <168790843+firestar5683@users.noreply.github.com> Co-authored-by: Harald Schäfer <harald.the.engineer@gmail.com> Co-authored-by: Prabhaav Pillai <prabhaav@msu.edu> Co-authored-by: dirwin31 <83434411+dirwin31@users.noreply.github.com> Co-authored-by: firestarsdog <229254897+firestarsdog@users.noreply.github.com> Co-authored-by: Intelli <contact@intelli.software> Co-authored-by: haraschax <6804392+haraschax@users.noreply.github.com> Co-authored-by: pharmacomaniac <blittle65@gmail.com> Co-authored-by: whoisdomi <dcantu83@gmail.com>
20 lines
998 B
Python
20 lines
998 B
Python
"""The production lateral-controller selection, shared with independent replay."""
|
|
|
|
from opendbc.car import structs
|
|
from openpilot.selfdrive.controls.lib.latcontrol_angle import LatControlAngle
|
|
from openpilot.selfdrive.controls.lib.latcontrol_curvature import LatControlCurvature
|
|
from openpilot.selfdrive.controls.lib.latcontrol_pid import LatControlPID
|
|
from openpilot.selfdrive.controls.lib.latcontrol_torque import LatControlTorque
|
|
|
|
|
|
def create_lateral_controller(cp, ci, dt, *, mode, turn_assist=False):
|
|
if cp.steerControlType == structs.CarParams.SteerControlType.angle:
|
|
return LatControlAngle(cp, ci, dt)
|
|
if cp.steerControlType == structs.CarParams.SteerControlType.curvature:
|
|
return LatControlCurvature(cp, ci, dt)
|
|
if cp.lateralTuning.which() == 'pid':
|
|
return LatControlPID(cp, ci, dt)
|
|
if cp.lateralTuning.which() == 'torque':
|
|
return LatControlTorque(cp, ci, dt, controller_mode=mode, turn_assist=turn_assist)
|
|
raise ValueError('No lateral controller for CarParams')
|