mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-08 11:25:51 +08:00
Compare commits
6 Commits
67e5bd3c1e
...
realfast-r
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83c18209c8 | ||
|
|
0ffa2f846b | ||
|
|
a7114fad7c | ||
|
|
810a067e24 | ||
|
|
0d4f363aa0 | ||
|
|
09cf8ef734 |
Submodule opendbc_repo updated: 44072d996c...2e30aa37b3
@@ -198,7 +198,7 @@ class SelfdriveD(CruiseHelper):
|
||||
car_events = self.car_events.update(CS, self.CS_prev, self.sm['carControl']).to_msg()
|
||||
self.events.add_from_msg(car_events)
|
||||
|
||||
car_events_sp = self.car_events_sp.update().to_msg()
|
||||
car_events_sp = self.car_events_sp.update(CS, self.events).to_msg()
|
||||
self.events_sp.add_from_msg(car_events_sp)
|
||||
|
||||
if self.CP.notCar:
|
||||
|
||||
@@ -5,12 +5,16 @@ This file is part of sunnypilot and is licensed under the MIT License.
|
||||
See the LICENSE.md file in the root directory for more details.
|
||||
"""
|
||||
|
||||
from cereal import custom
|
||||
from cereal import log, custom
|
||||
from opendbc.car import structs
|
||||
|
||||
from opendbc.car.chrysler.values import RAM_DT
|
||||
from openpilot.selfdrive.selfdrived.events import Events
|
||||
from openpilot.sunnypilot.selfdrive.selfdrived.events import EventsSP
|
||||
|
||||
EventName = log.OnroadEvent.EventName
|
||||
EventNameSP = custom.OnroadEventSP.EventName
|
||||
GearShifter = structs.CarState.GearShifter
|
||||
|
||||
|
||||
class CarSpecificEventsSP:
|
||||
@@ -18,6 +22,7 @@ class CarSpecificEventsSP:
|
||||
self.CP = CP
|
||||
self.params = params
|
||||
|
||||
self.low_speed_alert = False
|
||||
self.hyundai_radar_tracks = self.params.get_bool("HyundaiRadarTracks")
|
||||
self.hyundai_radar_tracks_confirmed = self.params.get_bool("HyundaiRadarTracksConfirmed")
|
||||
|
||||
@@ -25,10 +30,24 @@ class CarSpecificEventsSP:
|
||||
self.hyundai_radar_tracks = self.params.get_bool("HyundaiRadarTracks")
|
||||
self.hyundai_radar_tracks_confirmed = self.params.get_bool("HyundaiRadarTracksConfirmed")
|
||||
|
||||
def update(self):
|
||||
events = EventsSP()
|
||||
def update(self, CS: structs.CarState, events: Events):
|
||||
events_sp = EventsSP()
|
||||
|
||||
if self.CP.brand == 'chrysler':
|
||||
if self.CP.carFingerprint in RAM_DT:
|
||||
# remove belowSteerSpeed event from CarSpecificEvents as RAM_DT uses a different logic
|
||||
if events.has(EventName.belowSteerSpeed):
|
||||
events.remove(EventName.belowSteerSpeed)
|
||||
|
||||
if CS.vEgo >= self.CP.minEnableSpeed:
|
||||
self.low_speed_alert = False
|
||||
if (self.CP.minEnableSpeed >= 14.5) and (CS.gearShifter != GearShifter.drive):
|
||||
self.low_speed_alert = True
|
||||
if self.low_speed_alert:
|
||||
events.add(EventNameSP.belowSteerSpeed)
|
||||
|
||||
if self.CP.brand == 'hyundai':
|
||||
if self.hyundai_radar_tracks and not self.hyundai_radar_tracks_confirmed:
|
||||
events.add(EventNameSP.hyundaiRadarTracksConfirmed)
|
||||
events_sp.add(EventNameSP.hyundaiRadarTracksConfirmed)
|
||||
|
||||
return events
|
||||
return events_sp
|
||||
|
||||
Reference in New Issue
Block a user