Compare commits

...

6 Commits

Author SHA1 Message Date
Jason Wen
83c18209c8 bump 2025-04-27 02:41:57 -04:00
Jason Wen
0ffa2f846b move to car_specific_sp 2025-04-27 02:41:51 -04:00
Jason Wen
a7114fad7c Merge remote-tracking branch 'sunnypilot/sunnypilot/master-new' into realfast-ram1500
# Conflicts:
#	opendbc_repo
2025-04-26 23:51:00 -04:00
DP
810a067e24 syncing latest opendbc 2025-04-11 09:21:11 -05:00
DP
0d4f363aa0 updating reference to my opendbc 2025-04-06 13:25:57 -05:00
DP
09cf8ef734 FCA: Ram 1500 improvements 2025-04-05 21:54:02 -05:00
3 changed files with 26 additions and 7 deletions

View File

@@ -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:

View File

@@ -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