mirror of
https://github.com/infiniteCable2/openpilot.git
synced 2026-08-04 15:56:05 +08:00
MADS: Rivian support (#936)
* MADS: Tesla and Rivian support
* request lateral if acc is engaged
* try this out
* fix
* make sure we keep the toggle off for tesla
* namedtuple
* disallow steering past 90 degrees for rivian
* whoops
* Revert "Revert "MADS: Steering Mode on Brake Pedal Press (#687)" (#789)"
This reverts commit 8dec4ea5
* both rivian and tesla
* enforce disengage on brake steering mode for Rivian and Tesla
* wrong one
* MADS: Steering Mode on Brake Pedal Press
* bump
* bump
* descriptions
* bump
* bump
* no tesla or rivian yet
* codecov v5
* Revert "codecov v5"
This reverts commit a347e3fb27c0fbf2510b69fe8148b254fa93b8de.
* cleanup
* refactor description
* sync name
* fix
* make sure we don't allow if brake was already being pressed
* no longer needed
* proper ui!
* allow LKAS tx at all times with MADS
* extra
* this ain't right
* try this
* test only
* bring them back
* some dynamic checks
* dynamic description for mads toggle
* one place for limited platforms
* just rivian
* not here
* Revert "not here"
This reverts commit 53271b942839feb706e393254a3516097cc72890.
* get them out
* get them out
* no longer needed
* Revert "get them out"
This reverts commit 532b671bfb8bf76d5b4ef6349e5a1e3cd760dc3e.
* bump
* bump
* less
* Revert "bump"
This reverts commit 05ee4be04f190aaaa61bf18b0884b09accd74522.
This commit is contained in:
+1
-1
Submodule opendbc_repo updated: a051754777...748a84787a
@@ -17,7 +17,14 @@ class MadsSteeringModeOnBrake:
|
||||
DISENGAGE = 2
|
||||
|
||||
|
||||
def read_steering_mode_param(params: Params):
|
||||
def get_mads_limited_brands(CP: structs.CarParams) -> bool:
|
||||
return CP.brand in ("rivian", )
|
||||
|
||||
|
||||
def read_steering_mode_param(CP: structs.CarParams, params: Params):
|
||||
if get_mads_limited_brands(CP):
|
||||
return MadsSteeringModeOnBrake.DISENGAGE
|
||||
|
||||
try:
|
||||
return int(params.get("MadsSteeringMode"))
|
||||
except (ValueError, TypeError):
|
||||
@@ -26,7 +33,7 @@ def read_steering_mode_param(params: Params):
|
||||
|
||||
def set_alternative_experience(CP: structs.CarParams, params: Params):
|
||||
enabled = params.get_bool("Mads")
|
||||
steering_mode = read_steering_mode_param(params)
|
||||
steering_mode = read_steering_mode_param(CP, params)
|
||||
|
||||
if enabled:
|
||||
CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.ENABLE_MADS
|
||||
@@ -49,7 +56,8 @@ def set_car_specific_params(CP: structs.CarParams, CP_SP: structs.CarParamsSP, p
|
||||
# MADS Partial Support
|
||||
# MADS is currently partially supported for these platforms due to lack of consistent states to engage controls
|
||||
# Only MadsSteeringModeOnBrake.DISENGAGE is supported for these platforms
|
||||
mads_partial_support = False
|
||||
# TODO-SP: To enable MADS full support for Rivian, identify consistent signals for MADS toggling
|
||||
mads_partial_support = get_mads_limited_brands(CP)
|
||||
if mads_partial_support:
|
||||
params.put("MadsSteeringMode", "2")
|
||||
params.put_bool("MadsUnifiedEngagementMode", True)
|
||||
@@ -57,6 +65,6 @@ def set_car_specific_params(CP: structs.CarParams, CP_SP: structs.CarParamsSP, p
|
||||
|
||||
# MADS Disabled - No Support
|
||||
# MADS is currently not supported for these platforms due to lack of consistent states to engage controls
|
||||
# TODO-SP: To enable MADS full support for Rivian/Tesla, identify consistent signals for MADS toggling
|
||||
if CP.brand in ("rivian", "tesla"):
|
||||
# TODO-SP: To enable MADS full support for Tesla, identify consistent signals for MADS toggling
|
||||
if CP.brand in ("tesla", ):
|
||||
params.remove("Mads")
|
||||
|
||||
@@ -10,7 +10,7 @@ from cereal import log, custom
|
||||
from opendbc.car import structs
|
||||
from opendbc.car.hyundai.values import HyundaiFlags
|
||||
from opendbc.safety import ALTERNATIVE_EXPERIENCE
|
||||
from openpilot.sunnypilot.mads.helpers import MadsSteeringModeOnBrake, read_steering_mode_param
|
||||
from openpilot.sunnypilot.mads.helpers import MadsSteeringModeOnBrake, read_steering_mode_param, get_mads_limited_brands
|
||||
from openpilot.sunnypilot.mads.state import StateMachine, GEARS_ALLOW_PAUSED_SILENT
|
||||
|
||||
State = custom.ModularAssistiveDrivingSystem.ModularAssistiveDrivingSystemState
|
||||
@@ -45,10 +45,13 @@ class ModularAssistiveDrivingSystem:
|
||||
if self.CP.flags & (HyundaiFlags.HAS_LDA_BUTTON | HyundaiFlags.CANFD):
|
||||
self.allow_always = True
|
||||
|
||||
if get_mads_limited_brands(self.CP):
|
||||
self.no_main_cruise = True
|
||||
|
||||
# read params on init
|
||||
self.enabled_toggle = self.params.get_bool("Mads")
|
||||
self.main_enabled_toggle = self.params.get_bool("MadsMainCruiseAllowed")
|
||||
self.steering_mode_on_brake = read_steering_mode_param(self.params)
|
||||
self.steering_mode_on_brake = read_steering_mode_param(self.CP, self.params)
|
||||
self.unified_engagement_mode = self.params.get_bool("MadsUnifiedEngagementMode")
|
||||
|
||||
def read_params(self):
|
||||
|
||||
Reference in New Issue
Block a user