This commit is contained in:
Your Name
2024-05-11 15:27:31 -05:00
parent bc2a4e2266
commit 4373a0198f
11 changed files with 303 additions and 218 deletions

View File

@@ -18,6 +18,18 @@ from openpilot.selfdrive.car.interfaces import CarInterfaceBase
REPLAY = "REPLAY" in os.environ
# Notes:
# This is a generic class for interfacing between controlsd and specific implementations for a car.
# Variables:
# CI - carInterfaceBase
# CP - carParams
# CS - car state, should be consistent between every type of car
# Methods:
# state_update - calls CI.update, gets a new CS. Read only, this is regenerated every time called.
# state_publish - reads CS, CP, and carOutput.actuatorsOutput and sends via self.pm messaging
# controls_update - reads CI.apply, gets canbus commands, publishes via self.pm, something else executes canbus commands
class CarD:
CI: CarInterfaceBase

View File

@@ -311,8 +311,6 @@ class CarState(CarStateBase):
self.distance_button = self.cruise_buttons[-1] == Buttons.GAP_DIST and self.prev_cruise_buttons == 0
self.lkas_previously_enabled = self.lkas_enabled
# CLEARPILOT fix
lkas_enabled = False
try:
lkas_enabled = cp.vl[self.cruise_btns_msg_canfd]["LFA_BTN"]

View File

@@ -22,6 +22,20 @@ from openpilot.selfdrive.controls.lib.drive_helpers import CRUISE_LONG_PRESS, V_
from openpilot.selfdrive.controls.lib.events import Events
from openpilot.selfdrive.controls.lib.vehicle_model import VehicleModel
# Notes:
# CarInterfaceBase
# Has multiple functions. Haven't figured them all out yet.
# It turns car state into events.
# It passes calls to update() to the specific cars interface.py (get car state)
# It passes calls to apply() to the specific cars interface.py (apply car state, gen canbus commands)
# CarStateBase
# carstate is variable (not event) based tracking of the current properties of the car
# such as which buttons are pressed or if blinkers are enabled. It uses previous frame
# to detect transitions (previous lkas button vs lkas button, if not equal, button just pressed)
# - init - defines default values for carstate.
ButtonType = car.CarState.ButtonEvent.Type
GearShifter = car.CarState.GearShifter
EventName = car.CarEvent.EventName