mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-05 16:26:14 +08:00
Conditional Chill
This commit is contained in:
@@ -17,7 +17,7 @@ def get_repo_root() -> str:
|
||||
|
||||
# Constants
|
||||
REPO_ROOT = get_repo_root()
|
||||
PARAMS_CC_PATH = os.path.join(REPO_ROOT, 'common/params.cc')
|
||||
PARAMS_KEYS_PATH = os.path.join(REPO_ROOT, 'common/params_keys.h')
|
||||
UI_DIRECTORIES = [
|
||||
os.path.join(REPO_ROOT, 'selfdrive/ui'),
|
||||
os.path.join(REPO_ROOT, 'starpilot/ui')
|
||||
@@ -27,6 +27,7 @@ UI_DIRECTORIES = [
|
||||
# rather than user-toggled configurations.
|
||||
KNOWN_READ_ONLY = {
|
||||
"ApiCache_Device", "ApiCache_DriveStats", "ApiCache_NavDestinations",
|
||||
"CCStatus", "CEStatus",
|
||||
"CarMake", "CarModel", "CarModelName", "CarParamsPersistent", "CarVin",
|
||||
"ClusterOffset", "Compass", "DeveloperSidebarMetric1", "DeveloperSidebarMetric2",
|
||||
"DeveloperSidebarMetric3", "DeveloperSidebarMetric4", "DeveloperSidebarMetric5",
|
||||
@@ -36,25 +37,26 @@ KNOWN_READ_ONLY = {
|
||||
"GitRemote", "GithubSshKeys", "GithubUsername", "HardwareSerial", "IMEI",
|
||||
"InstallDate", "IsRhdDetected", "KonikMinutes", "LastGPSPosition",
|
||||
"LastMapsUpdate", "LastUpdateTime", "ModelDrivesAndScores", "ModelReleasedDates",
|
||||
"ModelVersions", "PrimeType", "TermsVersion", "TrainingVersion", "Version",
|
||||
"ModelVersions", "PersistedCCStatus", "PersistedCEStatus", "PrimeType",
|
||||
"TermsVersion", "TrainingVersion", "Version",
|
||||
"openpilotMinutes", "CompletedTrainingVersion"
|
||||
}
|
||||
|
||||
def extract_registered_keys(params_path: str) -> set:
|
||||
"""Extracts all legally registered parameter keys from common/params.cc"""
|
||||
"""Extracts all legally registered parameter keys from common/params_keys.h"""
|
||||
registered_keys = set()
|
||||
try:
|
||||
with open(params_path, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
# Isolate the keys `unordered_map` block
|
||||
keys_block_match = re.search(r'unordered_map<std::string, uint32_t> keys = \{(.*?)\};', content, re.DOTALL)
|
||||
# Isolate the registered keys block.
|
||||
keys_block_match = re.search(r'keys\s*=\s*\{(.*?)\n\};', content, re.DOTALL)
|
||||
if not keys_block_match:
|
||||
print("Error: Could not locate 'keys' map in params.cc")
|
||||
print("Error: Could not locate 'keys' map in params_keys.h")
|
||||
return registered_keys
|
||||
|
||||
# Extract {"KeyName", FLAG} entries
|
||||
for match in re.finditer(r'\{"([A-Za-z0-9_]+)",\s*([^}]+)\}', keys_block_match.group(1)):
|
||||
# Extract {"KeyName", {FLAGS...}} entries.
|
||||
for match in re.finditer(r'\{"([A-Za-z0-9_]+)",\s*\{([^}]*)\}\s*\}', keys_block_match.group(1)):
|
||||
key, flag = match.group(1), match.group(2)
|
||||
# Remove keys that are strictly internal ephemeral states
|
||||
if 'CLEAR_ON_MANAGER_START' not in flag:
|
||||
@@ -90,7 +92,7 @@ def main():
|
||||
print(f"Starting parameter derivation inside {REPO_ROOT}...")
|
||||
|
||||
# 1. Fetch
|
||||
registered_keys = extract_registered_keys(PARAMS_CC_PATH)
|
||||
registered_keys = extract_registered_keys(PARAMS_KEYS_PATH)
|
||||
ui_strings = extract_ui_string_literals(UI_DIRECTORIES)
|
||||
|
||||
# 2. Intersect
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
Dynamically Derived Feasible Param Candidates (The Golden List)
|
||||
===============================================================
|
||||
|
||||
Total globally registered C++ keys: 417
|
||||
Total explicit UI string references: 369
|
||||
Total Editable/Toggleable targets: 331
|
||||
Total globally registered C++ keys: 507
|
||||
Total explicit UI string references: 415
|
||||
Total Editable/Toggleable targets: 378
|
||||
|
||||
AMapKey1
|
||||
AMapKey2
|
||||
AccelerationPath
|
||||
AccelerationProfile
|
||||
AdbEnabled
|
||||
AdjacentLeadsUI
|
||||
AdjacentPath
|
||||
AdjacentPathMetrics
|
||||
@@ -24,55 +23,52 @@ AggressiveJerkSpeed
|
||||
AggressiveJerkSpeedDecrease
|
||||
AggressivePersonalityProfile
|
||||
AlertVolumeControl
|
||||
AlphaLongitudinalEnabled
|
||||
AlwaysOnDM
|
||||
AlwaysOnLateral
|
||||
AlwaysOnLateralLKAS
|
||||
AlwaysOnLateralMain
|
||||
AutomaticUpdates
|
||||
AutomaticallyDownloadModels
|
||||
AvailableModelNames
|
||||
AvailableModelSeries
|
||||
AvailableModels
|
||||
BigMap
|
||||
BelowSteerSpeedVolume
|
||||
BlacklistedModels
|
||||
BlindSpotMetrics
|
||||
BlindSpotPath
|
||||
BootLogo
|
||||
BorderMetrics
|
||||
BorderWidth
|
||||
CCMLead
|
||||
CCMSetSpeedMargin
|
||||
CCMSpeed
|
||||
CCMSpeedLead
|
||||
CECurves
|
||||
CECurvesLead
|
||||
CELead
|
||||
CEModelStopTime
|
||||
CENavigation
|
||||
CENavigationIntersections
|
||||
CENavigationLead
|
||||
CENavigationTurns
|
||||
CESignalLaneDetection
|
||||
CESignalSpeed
|
||||
CESlowerLead
|
||||
CESpeed
|
||||
CESpeedLead
|
||||
CEStatus
|
||||
CEStopLights
|
||||
CEStoppedLead
|
||||
CalibratedLateralAcceleration
|
||||
CalibrationParams
|
||||
CalibrationProgress
|
||||
CameraView
|
||||
CancelButtonControl
|
||||
CoastUpToLeads
|
||||
ColorScheme
|
||||
CommunityFavorites
|
||||
ConditionalChill
|
||||
ConditionalExperimental
|
||||
CurvatureData
|
||||
CurveSpeedController
|
||||
CustomAlerts
|
||||
CustomColors
|
||||
CustomCruise
|
||||
CustomCruiseLong
|
||||
CustomDistanceIcons
|
||||
CustomIcons
|
||||
CustomPersonalities
|
||||
CustomSignals
|
||||
CustomSounds
|
||||
CustomThemes
|
||||
CustomUI
|
||||
CancelButtonControl
|
||||
DebugMode
|
||||
DecelerationProfile
|
||||
DeveloperMetrics
|
||||
@@ -83,12 +79,12 @@ DeviceManagement
|
||||
DeviceShutdown
|
||||
DisableOnroadUploads
|
||||
DisableOpenpilotLongitudinal
|
||||
DisableWideRoad
|
||||
DiscordUsername
|
||||
DisengageOnAccelerator
|
||||
DisengageVolume
|
||||
DistanceButtonControl
|
||||
DoToggleReset
|
||||
DoToggleResetStock
|
||||
DistanceIconPack
|
||||
DownloadableBootLogos
|
||||
DownloadableColors
|
||||
DownloadableDistanceIcons
|
||||
@@ -97,98 +93,118 @@ DownloadableSignals
|
||||
DownloadableSounds
|
||||
DownloadableWheels
|
||||
DriverCamera
|
||||
DrivingModel
|
||||
DrivingModelName
|
||||
DrivingModelVersion
|
||||
DynamicPathWidth
|
||||
DynamicPedalsOnUI
|
||||
EVTuning
|
||||
EngageVolume
|
||||
ExperimentalLongitudinalEnabled
|
||||
ExperimentalMode
|
||||
ExperimentalModeConfirmed
|
||||
FPSCounter
|
||||
Fahrenheit
|
||||
FavoriteDestinations
|
||||
ForceAutoTune
|
||||
ForceAutoTuneOff
|
||||
ForceFingerprint
|
||||
ForceMPHDashboard
|
||||
ForceStandstill
|
||||
ForceStopDistanceOffset
|
||||
ForceStops
|
||||
ForceTorqueController
|
||||
StarPilotStats
|
||||
FrogsGoMoosTweak
|
||||
FullMap
|
||||
GMDashSpoofOffsets
|
||||
GMPedalLongitudinal
|
||||
GoatScream
|
||||
GoatScreamCriticalAlerts
|
||||
GreenLightAlert
|
||||
GsmApn
|
||||
GsmMetered
|
||||
GsmRoaming
|
||||
HasAcceptedTerms
|
||||
HideAlerts
|
||||
HideChangingLanesBanner
|
||||
HideDMIcon
|
||||
HideDistanceProfileBanner
|
||||
HideLeadMarker
|
||||
HideMap
|
||||
HideMapIcon
|
||||
HideMaxSpeed
|
||||
HideSpeed
|
||||
HideSpeedLimit
|
||||
HideTurningBanner
|
||||
HigherBitrate
|
||||
HolidayThemes
|
||||
HumanAcceleration
|
||||
HumanLaneChanges
|
||||
IconPack
|
||||
IncreaseFollowingLowVisibility
|
||||
IncreaseFollowingRain
|
||||
IncreaseFollowingRainStorm
|
||||
IncreaseFollowingSnow
|
||||
IncreaseThermalLimits
|
||||
IncreasedStoppedDistance
|
||||
IsDriverViewEnabled
|
||||
IncreasedStoppedDistanceLowVisibility
|
||||
IncreasedStoppedDistanceRain
|
||||
IncreasedStoppedDistanceRainStorm
|
||||
IncreasedStoppedDistanceSnow
|
||||
IsLdwEnabled
|
||||
IsMetric
|
||||
IsRHD
|
||||
IsRHDOverride
|
||||
KonikDongleId
|
||||
LKASButtonControl
|
||||
LaneChangeSmoothing
|
||||
LaneChangeTime
|
||||
LaneChanges
|
||||
LaneDetectionWidth
|
||||
LaneLinesColor
|
||||
LaneLinesWidth
|
||||
LanguageSetting
|
||||
LateralResumeDelay
|
||||
LateralTune
|
||||
LeadDepartingAlert
|
||||
LeadDetectionThreshold
|
||||
LeadIndicator
|
||||
LeadInfo
|
||||
LiveDelay
|
||||
LiveParameters
|
||||
LiveParametersV2
|
||||
LiveTorqueParameters
|
||||
LockDoors
|
||||
LockDoorsTimer
|
||||
LongCancelButtonControl
|
||||
LongDistanceButtonControl
|
||||
LongModeButtonControl
|
||||
LongPitch
|
||||
LongStarButtonControl
|
||||
LongitudinalActuatorDelay
|
||||
LongitudinalActuatorDelayStock
|
||||
LongitudinalPersonality
|
||||
LongitudinalTune
|
||||
LoudBlindspotAlert
|
||||
LowVoltageShutdown
|
||||
MainCruiseButtonControl
|
||||
MapAcceleration
|
||||
MapDeceleration
|
||||
MapGears
|
||||
MapStyle
|
||||
MapboxPublicKey
|
||||
MapboxSecretKey
|
||||
MapsSelected
|
||||
MaxDesiredAcceleration
|
||||
MinimumLaneChangeSpeed
|
||||
ModeButtonControl
|
||||
Model
|
||||
ModelRandomizer
|
||||
ModelSortMode
|
||||
ModelUI
|
||||
ModelVersion
|
||||
NNFF
|
||||
NNFFLite
|
||||
NavPastDestinations
|
||||
NavSettingLeftSide
|
||||
NavSettingTime24h
|
||||
NavDesiresAllowed
|
||||
NavLongitudinalAllowed
|
||||
NavigationUI
|
||||
NewLongAPI
|
||||
NoLogging
|
||||
NoUploads
|
||||
NostalgiaMode
|
||||
NudgelessLaneChange
|
||||
NumericalTemp
|
||||
OSMDownloadLocations
|
||||
Offroad_ExcessiveActuation
|
||||
Offset1
|
||||
Offset2
|
||||
Offset3
|
||||
@@ -199,30 +215,38 @@ Offset7
|
||||
OneLaneChange
|
||||
OnroadDistanceButton
|
||||
OpenpilotEnabledToggle
|
||||
OverpassRequests
|
||||
PathColor
|
||||
PathEdgesColor
|
||||
PathEdgeWidth
|
||||
PathWidth
|
||||
PauseAOLOnBrake
|
||||
PauseLateralOnSignal
|
||||
PauseLateralSpeed
|
||||
PedalsOnUI
|
||||
PersonalizeOpenpilot
|
||||
PersistChillState
|
||||
PersistExperimentalState
|
||||
PreferredSchedule
|
||||
PromptDistractedVolume
|
||||
PromptVolume
|
||||
QOLLateral
|
||||
QOLLongitudinal
|
||||
QOLVisuals
|
||||
RadarTakeoffs
|
||||
RadarTracksUI
|
||||
RainbowPath
|
||||
RandomEvents
|
||||
RandomThemes
|
||||
RandomThemesHolidays
|
||||
RecordAudio
|
||||
RecordFront
|
||||
RecordFrontLock
|
||||
RecoveryPower
|
||||
RedPanda
|
||||
ReduceAccelerationLowVisibility
|
||||
ReduceAccelerationRain
|
||||
ReduceAccelerationRainStorm
|
||||
ReduceAccelerationSnow
|
||||
ReduceLateralAccelerationLowVisibility
|
||||
ReduceLateralAccelerationRain
|
||||
ReduceLateralAccelerationRainStorm
|
||||
ReduceLateralAccelerationSnow
|
||||
RefuseVolume
|
||||
RelaxedFollow
|
||||
RelaxedFollowHigh
|
||||
@@ -232,11 +256,14 @@ RelaxedJerkDeceleration
|
||||
RelaxedJerkSpeed
|
||||
RelaxedJerkSpeedDecrease
|
||||
RelaxedPersonalityProfile
|
||||
RemapCancelToDistance
|
||||
RemoteStartBootsComma
|
||||
ReverseCruise
|
||||
RoadEdgesWidth
|
||||
RoadNameUI
|
||||
RotatingWheel
|
||||
SLCAbbreviatedSources
|
||||
SLCActiveSourcesOnly
|
||||
SLCConfirmation
|
||||
SLCConfirmationHigher
|
||||
SLCConfirmationLower
|
||||
@@ -245,23 +272,26 @@ SLCLookaheadHigher
|
||||
SLCLookaheadLower
|
||||
SLCMapboxFiller
|
||||
SLCOverride
|
||||
SLCPriority
|
||||
SLCPriority2
|
||||
SNGHack
|
||||
SafeMode
|
||||
ScreenBrightness
|
||||
ScreenBrightnessOnroad
|
||||
ScreenManagement
|
||||
ScreenRecorder
|
||||
ScreenTimeout
|
||||
ScreenTimeoutOnroad
|
||||
SearchInput
|
||||
SetSpeedLimit
|
||||
SetSpeedOffset
|
||||
ShowAllToggles
|
||||
ShowCCMStatus
|
||||
ShowCEMStatus
|
||||
ShowCPU
|
||||
ShowCSCStatus
|
||||
ShowGPU
|
||||
ShowIP
|
||||
ShowMemoryUsage
|
||||
ShowModeStatusBanner
|
||||
ShowSLCOffset
|
||||
ShowSpeedLimits
|
||||
ShowSteering
|
||||
@@ -269,13 +299,18 @@ ShowStoppingPoint
|
||||
ShowStoppingPointMetrics
|
||||
ShowStorageLeft
|
||||
ShowStorageUsed
|
||||
ShownToggleDescriptions
|
||||
Sidebar
|
||||
SidebarMetrics
|
||||
SidebarOpen
|
||||
SignalAnimation
|
||||
SignalMetrics
|
||||
SimpleMode
|
||||
SoundPack
|
||||
SpeedLimitChangedAlert
|
||||
SpeedLimitController
|
||||
SpeedLimitFiller
|
||||
SpeedLimitSources
|
||||
SpeedLimits
|
||||
SpeedLimitsFiltered
|
||||
SshEnabled
|
||||
StandardFollow
|
||||
StandardFollowHigh
|
||||
@@ -286,6 +321,7 @@ StandardJerkSpeed
|
||||
StandardJerkSpeedDecrease
|
||||
StandardPersonalityProfile
|
||||
StandbyMode
|
||||
StarButtonControl
|
||||
StartAccel
|
||||
StartAccelStock
|
||||
StartupMessageBottom
|
||||
@@ -299,8 +335,6 @@ SteerKP
|
||||
SteerKPStock
|
||||
SteerLatAccel
|
||||
SteerLatAccelStock
|
||||
SteerOffset
|
||||
SteerOffsetStock
|
||||
SteerRatio
|
||||
SteerRatioStock
|
||||
StopAccel
|
||||
@@ -309,6 +343,9 @@ StopDistance
|
||||
StoppedTimer
|
||||
StoppingDecelRate
|
||||
StoppingDecelRateStock
|
||||
SubaruSNG
|
||||
SwitchbackModeCooldown
|
||||
SwitchbackModeEnabled
|
||||
TacoTune
|
||||
TetheringEnabled
|
||||
ToyotaDoors
|
||||
@@ -319,15 +356,14 @@ TrafficJerkDeceleration
|
||||
TrafficJerkSpeed
|
||||
TrafficJerkSpeedDecrease
|
||||
TrafficPersonalityProfile
|
||||
TrailerLoad
|
||||
TruckTuning
|
||||
TuningLevel
|
||||
TuningLevelConfirmed
|
||||
TurnDesires
|
||||
UnlimitedLength
|
||||
UnlockDoors
|
||||
UpdaterAvailableBranches
|
||||
UseKonikServer
|
||||
UsePrebuilt
|
||||
UseSI
|
||||
UseVienna
|
||||
UserFavorites
|
||||
@@ -337,8 +373,13 @@ VEgoStopping
|
||||
VEgoStoppingStock
|
||||
VeryLongCancelButtonControl
|
||||
VeryLongDistanceButtonControl
|
||||
VeryLongModeButtonControl
|
||||
VeryLongStarButtonControl
|
||||
VisionSpeedLimitDetection
|
||||
VoltSNG
|
||||
WarningImmediateVolume
|
||||
WarningSoftVolume
|
||||
WeatherPresets
|
||||
WheelControls
|
||||
WheelIcon
|
||||
WheelSpeed
|
||||
|
||||
@@ -116,6 +116,7 @@ PARENT_KEYS_MAPPING = {
|
||||
"longitudinal_settings.cc": {
|
||||
"advancedLongitudinalTuneKeys": "AdvancedLongitudinalTune",
|
||||
"aggressivePersonalityKeys": "AggressivePersonalityProfile",
|
||||
"conditionalChillKeys": "ConditionalChill",
|
||||
"conditionalExperimentalKeys": "ConditionalExperimental",
|
||||
"curveSpeedKeys": "CurveSpeedController",
|
||||
"customDrivingPersonalityKeys": "CustomPersonalities",
|
||||
@@ -453,9 +454,9 @@ def parse_cpp_file(filename):
|
||||
if step_match:
|
||||
step = step_match.group(1)
|
||||
|
||||
# CESpeed is rendered in Qt with a dual numeric control (CESpeed + CESpeedLead),
|
||||
# CESpeed/CCMSpeed are rendered in Qt with dual numeric controls,
|
||||
# so the generic assignment matcher cannot infer it reliably.
|
||||
if key == "CESpeed":
|
||||
if key in {"CESpeed", "CCMSpeed"}:
|
||||
widget_type = "numeric"
|
||||
data_type = "int"
|
||||
min_val, max_val, step = "0", "99", "1"
|
||||
@@ -519,7 +520,7 @@ def parse_cpp_file(filename):
|
||||
},
|
||||
])
|
||||
|
||||
# Mirror CESpeed's dual slider (with-lead variant) from Qt.
|
||||
# Mirror CESpeed/CCMSpeed's dual sliders (with-lead variants) from Qt.
|
||||
if key == "CESpeed":
|
||||
items.append({
|
||||
"key": "CESpeedLead",
|
||||
@@ -532,6 +533,18 @@ def parse_cpp_file(filename):
|
||||
"step": 1.0,
|
||||
"parent_key": "ConditionalExperimental",
|
||||
})
|
||||
elif key == "CCMSpeed":
|
||||
items.append({
|
||||
"key": "CCMSpeedLead",
|
||||
"label": "Above (With Lead)",
|
||||
"description": "Switch to \"Chill Mode\" when following a stable lead above this speed.",
|
||||
"data_type": "int",
|
||||
"ui_type": "numeric",
|
||||
"min": 0.0,
|
||||
"max": 99.0,
|
||||
"step": 1.0,
|
||||
"parent_key": "ConditionalChill",
|
||||
})
|
||||
|
||||
return items
|
||||
|
||||
|
||||
Reference in New Issue
Block a user