FrogPilot setup - Setup toggles

This commit is contained in:
FrogAi 2024-06-07 04:34:10 -07:00
parent ab9c1f9009
commit 41defe3f72
76 changed files with 752 additions and 112 deletions

View File

@ -112,14 +112,14 @@ std::unordered_map<std::string, uint32_t> keys = {
{"CurrentRoute", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION},
{"DisableLogging", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION},
{"DisablePowerDown", PERSISTENT},
{"DisableUpdates", PERSISTENT},
{"DisengageOnAccelerator", PERSISTENT},
{"DisableUpdates", PERSISTENT | FROGPILOT_STORAGE},
{"DisengageOnAccelerator", PERSISTENT | FROGPILOT_STORAGE},
{"DmModelInitialized", CLEAR_ON_ONROAD_TRANSITION},
{"DongleId", PERSISTENT},
{"DoReboot", CLEAR_ON_MANAGER_START},
{"DoShutdown", CLEAR_ON_MANAGER_START},
{"DoUninstall", CLEAR_ON_MANAGER_START},
{"ExperimentalLongitudinalEnabled", PERSISTENT | DEVELOPMENT_ONLY},
{"ExperimentalLongitudinalEnabled", PERSISTENT | DEVELOPMENT_ONLY | FROGPILOT_STORAGE},
{"ExperimentalMode", PERSISTENT},
{"ExperimentalModeConfirmed", PERSISTENT},
{"FirmwareQueryDone", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION},
@ -140,8 +140,8 @@ std::unordered_map<std::string, uint32_t> keys = {
{"InstallDate", PERSISTENT},
{"IsDriverViewEnabled", CLEAR_ON_MANAGER_START},
{"IsEngaged", PERSISTENT},
{"IsLdwEnabled", PERSISTENT},
{"IsMetric", PERSISTENT},
{"IsLdwEnabled", PERSISTENT | FROGPILOT_STORAGE},
{"IsMetric", PERSISTENT | FROGPILOT_STORAGE},
{"IsOffroad", CLEAR_ON_MANAGER_START},
{"IsOnroad", PERSISTENT},
{"IsRhdDetected", PERSISTENT},
@ -207,6 +207,267 @@ std::unordered_map<std::string, uint32_t> keys = {
{"UpdaterTargetBranch", CLEAR_ON_MANAGER_START},
{"UpdaterLastFetchTime", PERSISTENT},
{"Version", PERSISTENT},
// FrogPilot parameters
{"AccelerationPath", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"AccelerationProfile", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"AdjacentPath", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"AdjacentPathMetrics", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"AggressiveAcceleration", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"AggressiveFollow", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"AggressiveJerkAcceleration", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"AggressiveJerkSpeed", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"AggressivePersonalityProfile", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"AlertVolumeControl", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"AlwaysOnLateral", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"AlwaysOnLateralMain", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"AlwaysOnLateralSet", CLEAR_ON_ONROAD_TRANSITION},
{"AMapKey1", PERSISTENT},
{"AMapKey2", PERSISTENT},
{"ApiCache_DriveStats", PERSISTENT},
{"AutomaticUpdates", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_OTHER},
{"AvailableModels", PERSISTENT},
{"AvailableModelsNames", PERSISTENT},
{"BigMap", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"BlindSpotMetrics", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"BlindSpotPath", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"BorderMetrics", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"CameraFPS", PERSISTENT},
{"CameraView", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"CarMake", PERSISTENT},
{"CarModel", PERSISTENT},
{"CarModelName", PERSISTENT},
{"CECurves", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CECurvesLead", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CENavigation", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CENavigationIntersections", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CENavigationLead", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CENavigationTurns", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CESignal", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CESlowerLead", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CESpeed", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CESpeedLead", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CEStatus", PERSISTENT},
{"CEStopLights", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CEStopLightsLead", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"ClusterOffset", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"Compass", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"ConditionalExperimental", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CrosstrekTorque", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"CurrentHolidayTheme", PERSISTENT},
{"CurrentRandomEvent", PERSISTENT},
{"CurveSensitivity", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CustomAlerts", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"CustomColors", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"CustomCruise", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CustomCruiseLong", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CustomIcons", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"CustomPaths", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"CustomPersonalities", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CustomSignals", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"CustomSounds", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"CustomTheme", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"CustomUI", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"CydiaTune", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"DecelerationProfile", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"DeveloperUI", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"DeviceManagement", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"DeviceShutdown", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"DisableMTSCSmoothing", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"DisableOnroadUploads", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"DisableOpenpilotLongitudinal", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"DisableVTSCSmoothing", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"DisengageVolume", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"DoToggleReset", PERSISTENT},
{"DragonPilotTune", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"DriverCamera", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"DrivingPersonalities", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"DynamicPathWidth", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"DynamicPedalsOnUI", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"EngageVolume", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"ExperimentalModeActivation", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"ExperimentalModeViaDistance", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"ExperimentalModeViaLKAS", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"ExperimentalModeViaTap", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"Fahrenheit", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"FingerprintLogged", CLEAR_ON_MANAGER_START},
{"ForceAutoTune", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"ForceFingerprint", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"ForceMPHDashboard", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"FPSCounter", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"FrogPilotDrives", PERSISTENT | FROGPILOT_TRACKING},
{"FrogPilotKilometers", PERSISTENT | FROGPILOT_TRACKING},
{"FrogPilotMinutes", PERSISTENT | FROGPILOT_TRACKING},
{"FrogPilotTogglesUpdated", PERSISTENT},
{"FrogsGoMoo", PERSISTENT},
{"FrogsGoMooTune", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"FullMap", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"GasRegenCmd", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"GMapKey", PERSISTENT},
{"GoatScream", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"GreenLightAlert", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"HideAlerts", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"HideAOLStatusBar", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"HideCEMStatusBar", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"HideLeadMarker", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"HideMapIcon", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"HideMaxSpeed", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"HideSpeed", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"HideSpeedUI", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"HideUIElements", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"HolidayThemes", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"IncreaseThermalLimits", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"KaofuiIcons", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"LaneChangeCustomizations", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"LaneChangeTime", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"LaneDetectionWidth", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"LaneLinesWidth", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"LastMapsUpdate", PERSISTENT | FROGPILOT_OTHER},
{"LateralMetrics", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"LateralTune", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"LeadDepartingAlert", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"LeadDetectionThreshold", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"LockDoors", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"LongitudinalMetrics", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"LongitudinalTune", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"LongPitch", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"LoudBlindspotAlert", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"LowVoltageShutdown", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"ManualUpdateInitiated", PERSISTENT},
{"MapAcceleration", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"MapboxPublicKey", PERSISTENT},
{"MapboxSecretKey", PERSISTENT},
{"MapDeceleration", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"MapGears", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"MapsSelected", PERSISTENT | FROGPILOT_OTHER},
{"MapSpeedLimit", PERSISTENT},
{"MapStyle", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"MapTargetLatA", PERSISTENT},
{"MapTargetVelocities", PERSISTENT},
{"MinimumLaneChangeSpeed", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"Model", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"ModelDownloadProgress", PERSISTENT},
{"ModelName", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"ModelSelector", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"ModelToDownload", PERSISTENT},
{"ModelUI", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"MTSCAggressiveness", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"MTSCCurvatureCheck", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"MTSCEnabled", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"NextMapSpeedLimit", PERSISTENT},
{"NNFF", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"NNFFLite", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"NNFFModelName", PERSISTENT},
{"NoLogging", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"NoUploads", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"NudgelessLaneChange", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"NumericalTemp", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"OfflineMode", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"Offset1", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"Offset2", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"Offset3", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"Offset4", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"OneLaneChange", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"OnroadDistanceButton", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"OnroadDistanceButtonPressed", PERSISTENT},
{"OSMDownloadBounds", PERSISTENT},
{"OSMDownloadLocations", PERSISTENT},
{"OSMDownloadProgress", CLEAR_ON_MANAGER_START},
{"ParamConversionVersion", PERSISTENT},
{"PathEdgeWidth", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"PathWidth", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"PauseAOLOnBrake", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"PauseLateralOnSignal", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"PauseLateralSpeed", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"PedalsOnUI", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"PreferredSchedule", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_OTHER},
{"PreviousSpeedLimit", PERSISTENT},
{"PromptDistractedVolume", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"PromptVolume", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"QOLControls", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"QOLVisuals", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"RandomEvents", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"RefuseVolume", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"RelaxedFollow", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"RelaxedJerkAcceleration", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"RelaxedJerkSpeed", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"RelaxedPersonalityProfile", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"ResetSteerRatio", PERSISTENT},
{"ReverseCruise", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"ReverseCruiseUI", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"RoadEdgesWidth", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"RoadName", PERSISTENT},
{"RoadNameUI", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"RotatingWheel", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"ScreenBrightness", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"ScreenBrightnessOnroad", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"ScreenManagement", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"ScreenRecorder", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"ScreenTimeout", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"ScreenTimeoutOnroad", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"SearchInput", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_OTHER},
{"SetSpeedLimit", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"SetSpeedOffset", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"ShowCPU", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"ShowGPU", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"ShowIP", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"ShowMemoryUsage", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"ShowSLCOffset", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"ShowSLCOffsetUI", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"ShowSteering", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"ShowStorageLeft", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"ShowStorageUsed", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"Sidebar", PERSISTENT | FROGPILOT_OTHER},
{"SidebarMetrics", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"SignalMetrics", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"SLCConfirmation", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"SLCConfirmationHigher", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"SLCConfirmationLower", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"SLCConfirmed", PERSISTENT},
{"SLCConfirmedPressed", PERSISTENT},
{"SLCLookaheadHigher", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"SLCLookaheadLower", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"SLCFallback", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"SLCOverride", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"SLCPriority", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"SLCPriority1", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"SLCPriority2", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"SLCPriority3", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"SmoothBraking", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"SNGHack", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"SpeedLimitChangedAlert", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"SpeedLimitController", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"StandardFollow", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"StandardJerkAcceleration", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"StandardJerkSpeed", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"StandardPersonalityProfile", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"StandbyMode", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"StaticPedalsOnUI", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"SteerRatio", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"SteerRatioStock", PERSISTENT},
{"StockTune", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"StoppedTimer", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"StoppingDistance", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"TacoTune", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"TetheringEnabled", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_OTHER},
{"ToyotaDoors", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"TrafficFollow", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"TrafficJerkAcceleration", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"TrafficJerkSpeed", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"TrafficMode", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"TrafficPersonalityProfile", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"TurnAggressiveness", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"TurnDesires", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"UnlimitedLength", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"UnlockDoors", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"Updated", PERSISTENT},
{"UseSI", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"UseVienna", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"VisionTurnControl", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"WarningImmediateVolume", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"WarningSoftVolume", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"WheelIcon", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"WheelSpeed", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
};
} // namespace

View File

@ -16,6 +16,12 @@ enum ParamKeyType {
CLEAR_ON_OFFROAD_TRANSITION = 0x10,
DONT_LOG = 0x20,
DEVELOPMENT_ONLY = 0x40,
FROGPILOT_CONTROLS = 0x80,
FROGPILOT_VEHICLES = 0x100,
FROGPILOT_VISUALS = 0x200,
FROGPILOT_OTHER = 0x400,
FROGPILOT_STORAGE = 0x800,
FROGPILOT_TRACKING = 0x1000,
ALL = 0xFFFFFFFF
};

View File

@ -11,6 +11,12 @@ cdef extern from "common/params.h":
CLEAR_ON_ONROAD_TRANSITION
CLEAR_ON_OFFROAD_TRANSITION
DEVELOPMENT_ONLY
FROGPILOT_CONTROLS
FROGPILOT_VEHICLES
FROGPILOT_VISUALS
FROGPILOT_OTHER
FROGPILOT_STORAGE
FROGPILOT_TRACKING
ALL
cdef cppclass c_Params "Params":
@ -32,6 +38,7 @@ cdef extern from "common/params.h":
string getParamPath(string) nogil
void clearAll(ParamKeyType)
vector[string] allKeys()
ParamKeyType getKeyType(string) nogil
def ensure_bytes(v):
@ -156,3 +163,7 @@ cdef class Params:
def all_keys(self):
return self.p.allKeys()
def get_key_type(self, key):
cdef string k = self.check_key(key)
return self.p.getKeyType(k)

View File

@ -35,7 +35,7 @@ class CarController(CarControllerBase):
torque -= deadband
return torque
def update(self, CC, CS, now_nanos):
def update(self, CC, CS, now_nanos, frogpilot_toggles):
torque_l = 0
torque_r = 0

View File

@ -6,7 +6,7 @@ from openpilot.selfdrive.car.body.values import DBC
STARTUP_TICKS = 100
class CarState(CarStateBase):
def update(self, cp):
def update(self, cp, frogpilot_toggles):
ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()

View File

@ -7,7 +7,7 @@ from openpilot.selfdrive.car.body.values import SPEED_FROM_RPM
class CarInterface(CarInterfaceBase):
@staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):
def _get_params(ret, params, candidate, fingerprint, car_fw, experimental_long, docs):
ret.notCar = True
ret.carName = "body"
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.body)]
@ -25,8 +25,8 @@ class CarInterface(CarInterfaceBase):
return ret
def _update(self, c):
ret, fp_ret = self.CS.update(self.cp)
def _update(self, c, frogpilot_toggles):
ret, fp_ret = self.CS.update(self.cp, frogpilot_toggles)
# wait for everything to init first
if self.frame > int(5. / DT_CTRL):

View File

@ -195,7 +195,7 @@ def get_car_interface(CP):
return CarInterface(CP, CarController, CarState)
def get_car(logcan, sendcan, experimental_long_allowed, num_pandas=1):
def get_car(params, logcan, sendcan, experimental_long_allowed, num_pandas=1):
candidate, fingerprints, vin, car_fw, source, exact_match = fingerprint(logcan, sendcan, num_pandas)
if candidate is None:
@ -211,7 +211,7 @@ def get_car(logcan, sendcan, experimental_long_allowed, num_pandas=1):
fingerprint_log.start()
CarInterface, _, _ = interfaces[candidate]
CP = CarInterface.get_params(candidate, fingerprints, car_fw, experimental_long_allowed, docs=False)
CP = CarInterface.get_params(params, candidate, fingerprints, car_fw, experimental_long_allowed, docs=False)
CP.carVin = vin
CP.carFw = car_fw
CP.fingerprintSource = source

View File

@ -16,6 +16,8 @@ from openpilot.selfdrive.car.car_helpers import get_car, get_one_can
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
from openpilot.selfdrive.controls.lib.events import Events
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import FrogPilotVariables
REPLAY = "REPLAY" in os.environ
EventName = car.CarEvent.EventName
@ -25,6 +27,9 @@ class Car:
CI: CarInterfaceBase
def __init__(self, CI=None):
# FrogPilot variables
self.frogpilot_toggles = FrogPilotVariables.toggles
self.can_sock = messaging.sub_sock('can', timeout=20)
self.sm = messaging.SubMaster(['pandaStates', 'carControl', 'onroadEvents'])
self.pm = messaging.PubMaster(['sendcan', 'carState', 'carParams', 'carOutput', 'frogpilotCarState'])
@ -46,7 +51,7 @@ class Car:
num_pandas = len(messaging.recv_one_retry(self.sm.sock['pandaStates']).pandaStates)
experimental_long_allowed = self.params.get_bool("ExperimentalLongitudinalEnabled")
self.CI, self.CP = get_car(self.can_sock, self.pm.sock['sendcan'], experimental_long_allowed, num_pandas)
self.CI, self.CP = get_car(self.params, self.can_sock, self.pm.sock['sendcan'], experimental_long_allowed, num_pandas)
else:
self.CI, self.CP = CI, CI.CP
@ -87,7 +92,7 @@ class Car:
# Update carState from CAN
can_strs = messaging.drain_sock_raw(self.can_sock, wait_for_one=True)
CS, FPCS = self.CI.update(self.CC_prev, can_strs)
CS, FPCS = self.CI.update(self.CC_prev, can_strs, self.frogpilot_toggles)
self.sm.update(0)
@ -158,7 +163,7 @@ class Car:
if self.sm.all_alive(['carControl']):
# send car controls over can
now_nanos = self.can_log_mono_time if REPLAY else int(time.monotonic() * 1e9)
self.last_actuators_output, can_sends = self.CI.apply(CC, now_nanos)
self.last_actuators_output, can_sends = self.CI.apply(CC, now_nanos, self.frogpilot_toggles)
self.pm.send('sendcan', can_list_to_can_capnp(can_sends, msgtype='sendcan', valid=CS.canValid))
self.CC_prev = CC
@ -183,6 +188,9 @@ class Car:
self.step()
self.rk.monitor_time()
# Update FrogPilot parameters
if FrogPilotVariables.toggles_updated:
FrogPilotVariables.update_frogpilot_params()
def main():
config_realtime_process(4, Priority.CTRL_HIGH)

View File

@ -20,7 +20,7 @@ class CarController(CarControllerBase):
self.packer = CANPacker(dbc_name)
self.params = CarControllerParams(CP)
def update(self, CC, CS, now_nanos):
def update(self, CC, CS, now_nanos, frogpilot_toggles):
can_sends = []
lkas_active = CC.latActive and self.lkas_control_bit_prev

View File

@ -24,7 +24,7 @@ class CarState(CarStateBase):
self.prev_distance_button = 0
self.distance_button = 0
def update(self, cp, cp_cam):
def update(self, cp, cp_cam, frogpilot_toggles):
ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()

View File

@ -10,7 +10,7 @@ ButtonType = car.CarState.ButtonEvent.Type
class CarInterface(CarInterfaceBase):
@staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):
def _get_params(ret, params, candidate, fingerprint, car_fw, experimental_long, docs):
ret.carName = "chrysler"
ret.dashcamOnly = candidate in RAM_HD
@ -76,8 +76,8 @@ class CarInterface(CarInterfaceBase):
return ret
def _update(self, c):
ret, fp_ret = self.CS.update(self.cp, self.cp_cam)
def _update(self, c, frogpilot_toggles):
ret, fp_ret = self.CS.update(self.cp, self.cp_cam, frogpilot_toggles)
ret.buttonEvents = create_button_events(self.CS.distance_button, self.CS.prev_distance_button, {1: ButtonType.gapAdjustCruise})

View File

@ -37,7 +37,7 @@ class CarController(CarControllerBase):
self.steer_alert_last = False
self.lead_distance_bars_last = None
def update(self, CC, CS, now_nanos):
def update(self, CC, CS, now_nanos, frogpilot_toggles):
can_sends = []
actuators = CC.actuators

View File

@ -22,7 +22,7 @@ class CarState(CarStateBase):
self.prev_distance_button = 0
self.distance_button = 0
def update(self, cp, cp_cam):
def update(self, cp, cp_cam, frogpilot_toggles):
ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()

View File

@ -13,7 +13,7 @@ GearShifter = car.CarState.GearShifter
class CarInterface(CarInterfaceBase):
@staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):
def _get_params(ret, params, candidate, fingerprint, car_fw, experimental_long, docs):
ret.carName = "ford"
ret.dashcamOnly = bool(ret.flags & FordFlags.CANFD)
@ -67,8 +67,8 @@ class CarInterface(CarInterfaceBase):
ret.centerToFront = ret.wheelbase * 0.44
return ret
def _update(self, c):
ret, fp_ret = self.CS.update(self.cp, self.cp_cam)
def _update(self, c, frogpilot_toggles):
ret, fp_ret = self.CS.update(self.cp, self.cp_cam, frogpilot_toggles)
ret.buttonEvents = create_button_events(self.CS.distance_button, self.CS.prev_distance_button, {1: ButtonType.gapAdjustCruise})

View File

@ -60,7 +60,7 @@ class CarController(CarControllerBase):
return pedal_gas
def update(self, CC, CS, now_nanos):
def update(self, CC, CS, now_nanos, frogpilot_toggles):
actuators = CC.actuators
hud_control = CC.hudControl
hud_alert = hud_control.visualAlert

View File

@ -33,7 +33,7 @@ class CarState(CarStateBase):
self.single_pedal_mode = False
self.pedal_steady = 0.
def update(self, pt_cp, cam_cp, loopback_cp):
def update(self, pt_cp, cam_cp, loopback_cp, frogpilot_toggles):
ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()

View File

@ -88,7 +88,7 @@ class CarInterface(CarInterfaceBase):
return self.torque_from_lateral_accel_linear
@staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):
def _get_params(ret, params, candidate, fingerprint, car_fw, experimental_long, docs):
ret.carName = "gm"
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.gm)]
ret.autoResumeSng = False
@ -302,8 +302,8 @@ class CarInterface(CarInterfaceBase):
return ret
# returns a car.CarState
def _update(self, c):
ret, fp_ret = self.CS.update(self.cp, self.cp_cam, self.cp_loopback)
def _update(self, c, frogpilot_toggles):
ret, fp_ret = self.CS.update(self.cp, self.cp_cam, self.cp_loopback, frogpilot_toggles)
# Don't add event if transitioning from INIT, unless it's to an actual button
if self.CS.cruise_buttons != CruiseButtons.UNPRESS or self.CS.prev_cruise_buttons != CruiseButtons.INIT:

View File

@ -3,6 +3,7 @@ from enum import IntFlag
from cereal import car
from openpilot.common.numpy_fast import interp
from openpilot.common.params import Params
from openpilot.selfdrive.car import dbc_dict, PlatformConfig, DbcDict, Platforms, CarSpecs
from openpilot.selfdrive.car.docs_definitions import CarHarness, CarDocs, CarParts
from openpilot.selfdrive.car.fw_query_definitions import FwQueryConfig, Request, StdQueries

View File

@ -125,7 +125,7 @@ class CarController(CarControllerBase):
self.brake = 0.0
self.last_steer = 0.0
def update(self, CC, CS, now_nanos):
def update(self, CC, CS, now_nanos, frogpilot_toggles):
actuators = CC.actuators
hud_control = CC.hudControl
conversion = hondacan.get_cruise_speed_conversion(self.CP.carFingerprint, CS.is_metric)

View File

@ -104,7 +104,7 @@ class CarState(CarStateBase):
# However, on cars without a digital speedometer this is not always present (HRV, FIT, CRV 2016, ILX and RDX)
self.dash_speed_seen = False
def update(self, cp, cp_cam, cp_body):
def update(self, cp, cp_cam, cp_body, frogpilot_toggles):
ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()

View File

@ -32,7 +32,7 @@ class CarInterface(CarInterfaceBase):
return CarControllerParams.NIDEC_ACCEL_MIN, interp(current_speed, ACCEL_MAX_BP, ACCEL_MAX_VALS)
@staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):
def _get_params(ret, params, candidate, fingerprint, car_fw, experimental_long, docs):
ret.carName = "honda"
CAN = CanBus(ret, fingerprint)
@ -222,8 +222,8 @@ class CarInterface(CarInterfaceBase):
disable_ecu(logcan, sendcan, bus=1, addr=0x18DAB0F1, com_cont_req=b'\x28\x83\x03')
# returns a car.CarState
def _update(self, c):
ret, fp_ret = self.CS.update(self.cp, self.cp_cam, self.cp_body)
def _update(self, c, frogpilot_toggles):
ret, fp_ret = self.CS.update(self.cp, self.cp_cam, self.cp_body, frogpilot_toggles)
ret.buttonEvents = [
*create_button_events(self.CS.cruise_buttons, self.CS.prev_cruise_buttons, BUTTONS_DICT),

View File

@ -57,7 +57,7 @@ class CarController(CarControllerBase):
self.car_fingerprint = CP.carFingerprint
self.last_button_frame = 0
def update(self, CC, CS, now_nanos):
def update(self, CC, CS, now_nanos, frogpilot_toggles):
actuators = CC.actuators
hud_control = CC.hudControl

View File

@ -52,9 +52,9 @@ class CarState(CarStateBase):
self.params = CarControllerParams(CP)
def update(self, cp, cp_cam):
def update(self, cp, cp_cam, frogpilot_toggles):
if self.CP.carFingerprint in CANFD_CAR:
return self.update_canfd(cp, cp_cam)
return self.update_canfd(cp, cp_cam, frogpilot_toggles)
ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()
@ -168,7 +168,7 @@ class CarState(CarStateBase):
return ret, fp_ret
def update_canfd(self, cp, cp_cam):
def update_canfd(self, cp, cp_cam, frogpilot_toggles):
ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()

View File

@ -19,7 +19,7 @@ BUTTONS_DICT = {Buttons.RES_ACCEL: ButtonType.accelCruise, Buttons.SET_DECEL: Bu
class CarInterface(CarInterfaceBase):
@staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):
def _get_params(ret, params, candidate, fingerprint, car_fw, experimental_long, docs):
ret.carName = "hyundai"
ret.radarUnavailable = RADAR_START_ADDR not in fingerprint[1] or DBC[ret.carFingerprint]["radar"] is None
@ -150,8 +150,8 @@ class CarInterface(CarInterfaceBase):
if CP.flags & HyundaiFlags.ENABLE_BLINKERS:
disable_ecu(logcan, sendcan, bus=CanBus(CP).ECAN, addr=0x7B1, com_cont_req=b'\x28\x83\x01')
def _update(self, c):
ret, fp_ret = self.CS.update(self.cp, self.cp_cam)
def _update(self, c, frogpilot_toggles):
ret, fp_ret = self.CS.update(self.cp, self.cp_cam, frogpilot_toggles)
if self.CS.CP.openpilotLongitudinalControl:
ret.buttonEvents = create_button_events(self.CS.cruise_buttons[-1], self.CS.prev_cruise_buttons, BUTTONS_DICT)

View File

@ -13,6 +13,7 @@ from openpilot.common.basedir import BASEDIR
from openpilot.common.conversions import Conversions as CV
from openpilot.common.simple_kalman import KF1D, get_kalman_gain
from openpilot.common.numpy_fast import clip
from openpilot.common.params import Params
from openpilot.common.realtime import DT_CTRL
from openpilot.selfdrive.car import apply_hysteresis, gen_empty_fingerprint, scale_rot_inertia, scale_tire_stiffness, STD_CARGO_KG
from openpilot.selfdrive.car.values import PLATFORMS
@ -110,8 +111,12 @@ class CarInterfaceBase(ABC):
dbc_name = "" if self.cp is None else self.cp.dbc_name
self.CC: CarControllerBase = CarController(dbc_name, CP, self.VM)
def apply(self, c: car.CarControl, now_nanos: int) -> tuple[car.CarControl.Actuators, list[tuple[int, int, bytes, int]]]:
return self.CC.update(c, self.CS, now_nanos)
# FrogPilot variables
self.params = Params()
self.params_memory = Params("/dev/shm/params")
def apply(self, c: car.CarControl, now_nanos: int, frogpilot_toggles) -> tuple[car.CarControl.Actuators, list[tuple[int, int, bytes, int]]]:
return self.CC.update(c, self.CS, now_nanos, frogpilot_toggles)
@staticmethod
def get_pid_accel_limits(CP, current_speed, cruise_speed):
@ -125,7 +130,7 @@ class CarInterfaceBase(ABC):
return cls.get_params(candidate, gen_empty_fingerprint(), list(), False, False)
@classmethod
def get_params(cls, candidate: str, fingerprint: dict[int, dict[int, int]], car_fw: list[car.CarParams.CarFw], experimental_long: bool, docs: bool):
def get_params(cls, params: Params, candidate: str, fingerprint: dict[int, dict[int, int]], car_fw: list[car.CarParams.CarFw], experimental_long: bool, docs: bool):
ret = CarInterfaceBase.get_std_params(candidate)
platform = PLATFORMS[candidate]
@ -138,7 +143,7 @@ class CarInterfaceBase(ABC):
ret.tireStiffnessFactor = platform.config.specs.tireStiffnessFactor
ret.flags |= int(platform.config.flags)
ret = cls._get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs)
ret = cls._get_params(ret, params, candidate, fingerprint, car_fw, experimental_long, docs)
# Vehicle mass is published curb weight plus assumed payload such as a human driver; notCars have no assumed payload
if not ret.notCar:
@ -230,14 +235,14 @@ class CarInterfaceBase(ABC):
def _update(self, c: car.CarControl) -> car.CarState:
pass
def update(self, c: car.CarControl, can_strings: list[bytes]) -> car.CarState:
def update(self, c: car.CarControl, can_strings: list[bytes], frogpilot_toggles) -> car.CarState:
# parse can
for cp in self.can_parsers:
if cp is not None:
cp.update_strings(can_strings)
# get CarState
ret, fp_ret = self._update(c)
ret, fp_ret = self._update(c, frogpilot_toggles)
ret.canValid = all(cp.can_valid for cp in self.can_parsers if cp is not None)
ret.canTimeout = any(cp.bus_timeout for cp in self.can_parsers if cp is not None)

View File

@ -16,7 +16,7 @@ class CarController(CarControllerBase):
self.brake_counter = 0
self.frame = 0
def update(self, CC, CS, now_nanos):
def update(self, CC, CS, now_nanos, frogpilot_toggles):
can_sends = []
apply_steer = 0

View File

@ -21,7 +21,7 @@ class CarState(CarStateBase):
self.prev_distance_button = 0
self.distance_button = 0
def update(self, cp, cp_cam):
def update(self, cp, cp_cam, frogpilot_toggles):
ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()

View File

@ -11,7 +11,7 @@ EventName = car.CarEvent.EventName
class CarInterface(CarInterfaceBase):
@staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):
def _get_params(ret, params, candidate, fingerprint, car_fw, experimental_long, docs):
ret.carName = "mazda"
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.mazda)]
ret.radarUnavailable = True
@ -31,8 +31,8 @@ class CarInterface(CarInterfaceBase):
return ret
# returns a car.CarState
def _update(self, c):
ret, fp_ret = self.CS.update(self.cp, self.cp_cam)
def _update(self, c, frogpilot_toggles):
ret, fp_ret = self.CS.update(self.cp, self.cp_cam, frogpilot_toggles)
# TODO: add button types for inc and dec
ret.buttonEvents = create_button_events(self.CS.distance_button, self.CS.prev_distance_button, {1: ButtonType.gapAdjustCruise})

View File

@ -12,7 +12,7 @@ class CarInterface(CarInterfaceBase):
self.sm = messaging.SubMaster(['gpsLocation', 'gpsLocationExternal'])
@staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):
def _get_params(ret, params, candidate, fingerprint, car_fw, experimental_long, docs):
ret.carName = "mock"
ret.mass = 1700.
ret.wheelbase = 2.70
@ -21,7 +21,7 @@ class CarInterface(CarInterfaceBase):
ret.dashcamOnly = True
return ret
def _update(self, c):
def _update(self, c, frogpilot_toggles):
self.sm.update(0)
gps_sock = 'gpsLocationExternal' if self.sm.recv_frame['gpsLocationExternal'] > 1 else 'gpsLocation'

View File

@ -19,7 +19,7 @@ class CarController(CarControllerBase):
self.packer = CANPacker(dbc_name)
def update(self, CC, CS, now_nanos):
def update(self, CC, CS, now_nanos, frogpilot_toggles):
actuators = CC.actuators
hud_control = CC.hudControl
pcm_cancel_cmd = CC.cruiseControl.cancel

View File

@ -23,7 +23,7 @@ class CarState(CarStateBase):
self.prev_distance_button = 0
self.distance_button = 0
def update(self, cp, cp_adas, cp_cam):
def update(self, cp, cp_adas, cp_cam, frogpilot_toggles):
ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()

View File

@ -10,7 +10,7 @@ ButtonType = car.CarState.ButtonEvent.Type
class CarInterface(CarInterfaceBase):
@staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):
def _get_params(ret, params, candidate, fingerprint, car_fw, experimental_long, docs):
ret.carName = "nissan"
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.nissan)]
ret.autoResumeSng = False
@ -29,8 +29,8 @@ class CarInterface(CarInterfaceBase):
return ret
# returns a car.CarState
def _update(self, c):
ret, fp_ret = self.CS.update(self.cp, self.cp_adas, self.cp_cam)
def _update(self, c, frogpilot_toggles):
ret, fp_ret = self.CS.update(self.cp, self.cp_adas, self.cp_cam, frogpilot_toggles)
ret.buttonEvents = create_button_events(self.CS.distance_button, self.CS.prev_distance_button, {1: ButtonType.gapAdjustCruise})

View File

@ -23,7 +23,7 @@ class CarController(CarControllerBase):
self.p = CarControllerParams(CP)
self.packer = CANPacker(DBC[CP.carFingerprint]['pt'])
def update(self, CC, CS, now_nanos):
def update(self, CC, CS, now_nanos, frogpilot_toggles):
actuators = CC.actuators
hud_control = CC.hudControl
pcm_cancel_cmd = CC.cruiseControl.cancel

View File

@ -16,7 +16,7 @@ class CarState(CarStateBase):
self.angle_rate_calulator = CanSignalRateCalculator(50)
def update(self, cp, cp_cam, cp_body):
def update(self, cp, cp_cam, cp_body, frogpilot_toggles):
ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()

View File

@ -9,7 +9,7 @@ from openpilot.selfdrive.car.subaru.values import CAR, GLOBAL_ES_ADDR, SubaruFla
class CarInterface(CarInterfaceBase):
@staticmethod
def _get_params(ret, candidate: CAR, fingerprint, car_fw, experimental_long, docs):
def _get_params(ret, params, candidate: CAR, fingerprint, car_fw, experimental_long, docs):
ret.carName = "subaru"
ret.radarUnavailable = True
# for HYBRID CARS to be upstreamed, we need:
@ -97,9 +97,9 @@ class CarInterface(CarInterfaceBase):
return ret
# returns a car.CarState
def _update(self, c):
def _update(self, c, frogpilot_toggles):
ret, fp_ret = self.CS.update(self.cp, self.cp_cam, self.cp_body)
ret, fp_ret = self.CS.update(self.cp, self.cp_cam, self.cp_body, frogpilot_toggles)
ret.events = self.create_common_events(ret).to_msg()

View File

@ -3,6 +3,7 @@ from enum import Enum, IntFlag
from cereal import car
from panda.python import uds
from openpilot.common.params import Params
from openpilot.selfdrive.car import CarSpecs, DbcDict, PlatformConfig, Platforms, dbc_dict
from openpilot.selfdrive.car.docs_definitions import CarFootnote, CarHarness, CarDocs, CarParts, Tool, Column
from openpilot.selfdrive.car.fw_query_definitions import FwQueryConfig, Request, StdQueries, p16

View File

@ -15,7 +15,7 @@ class CarController(CarControllerBase):
self.pt_packer = CANPacker(DBC[CP.carFingerprint]['pt'])
self.tesla_can = TeslaCAN(self.packer, self.pt_packer)
def update(self, CC, CS, now_nanos):
def update(self, CC, CS, now_nanos, frogpilot_toggles):
actuators = CC.actuators
pcm_cancel_cmd = CC.cruiseControl.cancel

View File

@ -20,7 +20,7 @@ class CarState(CarStateBase):
self.acc_state = 0
self.das_control_counters = deque(maxlen=32)
def update(self, cp, cp_cam):
def update(self, cp, cp_cam, frogpilot_toggles):
ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()

View File

@ -8,7 +8,7 @@ from openpilot.selfdrive.car.interfaces import CarInterfaceBase
class CarInterface(CarInterfaceBase):
@staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):
def _get_params(ret, params, candidate, fingerprint, car_fw, experimental_long, docs):
ret.carName = "tesla"
# There is no safe way to do steer blending with user torque,
@ -39,8 +39,8 @@ class CarInterface(CarInterfaceBase):
ret.steerActuatorDelay = 0.25
return ret
def _update(self, c):
ret, fp_ret = self.CS.update(self.cp, self.cp_cam)
def _update(self, c, frogpilot_toggles):
ret, fp_ret = self.CS.update(self.cp, self.cp_cam, frogpilot_toggles)
ret.events = self.create_common_events(ret).to_msg()

View File

@ -1,5 +1,6 @@
from cereal import car
from openpilot.common.numpy_fast import clip
from openpilot.common.params import Params
from openpilot.selfdrive.car import apply_meas_steer_torque_limits, apply_std_steer_angle_limits, common_fault_avoidance, make_can_msg
from openpilot.selfdrive.car.interfaces import CarControllerBase
from openpilot.selfdrive.car.toyota import toyotacan
@ -42,7 +43,10 @@ class CarController(CarControllerBase):
self.gas = 0
self.accel = 0
def update(self, CC, CS, now_nanos):
# FrogPilot variables
params = Params()
def update(self, CC, CS, now_nanos, frogpilot_toggles):
actuators = CC.actuators
hud_control = CC.hudControl
pcm_cancel_cmd = CC.cruiseControl.cancel
@ -132,10 +136,10 @@ class CarController(CarControllerBase):
can_sends.append(toyotacan.create_acc_cancel_command(self.packer))
elif self.CP.openpilotLongitudinalControl:
can_sends.append(toyotacan.create_accel_command(self.packer, pcm_accel_cmd, pcm_cancel_cmd, self.standstill_req, lead, CS.acc_type, fcw_alert,
self.distance_button))
self.distance_button, frogpilot_toggles))
self.accel = pcm_accel_cmd
else:
can_sends.append(toyotacan.create_accel_command(self.packer, 0, pcm_cancel_cmd, False, lead, CS.acc_type, False, self.distance_button))
can_sends.append(toyotacan.create_accel_command(self.packer, 0, pcm_cancel_cmd, False, lead, CS.acc_type, False, self.distance_button, frogpilot_toggles))
# *** hud ui ***
if self.CP.carFingerprint != CAR.TOYOTA_PRIUS_V:

View File

@ -49,7 +49,7 @@ class CarState(CarStateBase):
self.acc_type = 1
self.lkas_hud = {}
def update(self, cp, cp_cam):
def update(self, cp, cp_cam, frogpilot_toggles):
ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()

View File

@ -18,7 +18,7 @@ class CarInterface(CarInterfaceBase):
return CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX
@staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):
def _get_params(ret, params, candidate, fingerprint, car_fw, experimental_long, docs):
ret.carName = "toyota"
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.toyota)]
ret.safetyConfigs[0].safetyParam = EPS_SCALE[candidate]
@ -162,8 +162,8 @@ class CarInterface(CarInterfaceBase):
disable_ecu(logcan, sendcan, bus=0, addr=0x750, sub_addr=0xf, com_cont_req=communication_control)
# returns a car.CarState
def _update(self, c):
ret, fp_ret = self.CS.update(self.cp, self.cp_cam)
def _update(self, c, frogpilot_toggles):
ret, fp_ret = self.CS.update(self.cp, self.cp_cam, frogpilot_toggles)
if self.CP.carFingerprint in (TSS2_CAR - RADAR_ACC_CAR) or (self.CP.flags & ToyotaFlags.SMART_DSU and not self.CP.flags & ToyotaFlags.RADAR_CAN_FILTER):
ret.buttonEvents = create_button_events(self.CS.distance_button, self.CS.prev_distance_button, {1: ButtonType.gapAdjustCruise})

View File

@ -33,7 +33,7 @@ def create_lta_steer_command(packer, steer_control_type, steer_angle, steer_req,
return packer.make_can_msg("STEERING_LTA", 0, values)
def create_accel_command(packer, accel, pcm_cancel, standstill_req, lead, acc_type, fcw_alert, distance):
def create_accel_command(packer, accel, pcm_cancel, standstill_req, lead, acc_type, fcw_alert, distance, frogpilot_toggles):
# TODO: find the exact canceling bit that does not create a chime
values = {
"ACCEL_CMD": accel,

View File

@ -27,7 +27,7 @@ class CarController(CarControllerBase):
self.hca_frame_timer_running = 0
self.hca_frame_same_torque = 0
def update(self, CC, CS, now_nanos):
def update(self, CC, CS, now_nanos, frogpilot_toggles):
actuators = CC.actuators
hud_control = CC.hudControl
can_sends = []

View File

@ -32,9 +32,9 @@ class CarState(CarStateBase):
return button_events
def update(self, pt_cp, cam_cp, ext_cp, trans_type):
def update(self, pt_cp, cam_cp, ext_cp, trans_type, frogpilot_toggles):
if self.CP.flags & VolkswagenFlags.PQ:
return self.update_pq(pt_cp, cam_cp, ext_cp, trans_type)
return self.update_pq(pt_cp, cam_cp, ext_cp, trans_type, frogpilot_toggles)
ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()
@ -156,7 +156,7 @@ class CarState(CarStateBase):
self.frame += 1
return ret, fp_ret
def update_pq(self, pt_cp, cam_cp, ext_cp, trans_type):
def update_pq(self, pt_cp, cam_cp, ext_cp, trans_type, frogpilot_toggles):
ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()
# Update vehicle speed and acceleration from ABS wheel speeds.

View File

@ -20,7 +20,7 @@ class CarInterface(CarInterfaceBase):
self.cp_ext = self.cp_cam
@staticmethod
def _get_params(ret, candidate: CAR, fingerprint, car_fw, experimental_long, docs):
def _get_params(ret, params, candidate: CAR, fingerprint, car_fw, experimental_long, docs):
ret.carName = "volkswagen"
ret.radarUnavailable = True
@ -101,8 +101,8 @@ class CarInterface(CarInterfaceBase):
return ret
# returns a car.CarState
def _update(self, c):
ret, fp_ret = self.CS.update(self.cp, self.cp_cam, self.cp_ext, self.CP.transmissionType)
def _update(self, c, frogpilot_toggles):
ret, fp_ret = self.CS.update(self.cp, self.cp_cam, self.cp_ext, self.CP.transmissionType, frogpilot_toggles)
events = self.create_common_events(ret, extra_gears=[GearShifter.eco, GearShifter.sport, GearShifter.manumatic],
pcm_enable=not self.CS.CP.openpilotLongitudinalControl,
@ -128,4 +128,3 @@ class CarInterface(CarInterfaceBase):
ret.events = events.to_msg()
return ret, fp_ret

View File

@ -31,6 +31,8 @@ from openpilot.selfdrive.controls.lib.vehicle_model import VehicleModel
from openpilot.system.hardware import HARDWARE
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import FrogPilotVariables
SOFT_DISABLE_TIME = 3 # seconds
LDW_MIN_SPEED = 31 * CV.MPH_TO_MS
LANE_DEPARTURE_THRESHOLD = 0.1
@ -60,7 +62,11 @@ ENABLED_STATES = (State.preEnabled, *ACTIVE_STATES)
class Controls:
def __init__(self, CI=None):
# FrogPilot variables
self.frogpilot_toggles = FrogPilotVariables.toggles
self.params = Params()
self.params_memory = Params("/dev/shm/params")
if CI is None:
cloudlog.info("controlsd is waiting for CarParams")
@ -512,7 +518,7 @@ class Controls:
else:
self.state = State.enabled
self.current_alert_types.append(ET.ENABLE)
self.v_cruise_helper.initialize_v_cruise(CS, self.experimental_mode)
self.v_cruise_helper.initialize_v_cruise(CS, self.experimental_mode, self.frogpilot_toggles)
# Check if openpilot is engaged and actuators are enabled
self.enabled = self.state in ENABLED_STATES
@ -837,6 +843,10 @@ class Controls:
self.joystick_mode = self.params.get_bool("JoystickDebugMode")
time.sleep(0.1)
# Update FrogPilot parameters
if FrogPilotVariables.toggles_updated:
FrogPilotVariables.update_frogpilot_params()
def controlsd_thread(self):
e = threading.Event()
t = threading.Thread(target=self.params_thread, args=(e, ))

View File

@ -40,7 +40,7 @@ class DesireHelper:
self.prev_one_blinker = False
self.desire = log.Desire.none
def update(self, carstate, lateral_active, lane_change_prob, frogpilotPlan):
def update(self, carstate, lateral_active, lane_change_prob, frogpilotPlan, frogpilot_toggles):
v_ego = carstate.vEgo
one_blinker = carstate.leftBlinker != carstate.rightBlinker
below_lane_change_speed = v_ego < LANE_CHANGE_SPEED_MIN

View File

@ -3,6 +3,7 @@ import math
from cereal import car, log
from openpilot.common.conversions import Conversions as CV
from openpilot.common.numpy_fast import clip, interp
from openpilot.common.params import Params
from openpilot.common.realtime import DT_CTRL
# WARNING: this value was determined based on the model's training distribution,
@ -45,6 +46,9 @@ class VCruiseHelper:
self.button_timers = {ButtonType.decelCruise: 0, ButtonType.accelCruise: 0}
self.button_change_states = {btn: {"standstill": False, "enabled": False} for btn in self.button_timers}
# FrogPilot variables
self.params_memory = Params("/dev/shm/params")
@property
def v_cruise_initialized(self):
return self.v_cruise_kph != V_CRUISE_UNSET
@ -125,7 +129,7 @@ class VCruiseHelper:
self.button_timers[b.type.raw] = 1 if b.pressed else 0
self.button_change_states[b.type.raw] = {"standstill": CS.cruiseState.standstill, "enabled": enabled}
def initialize_v_cruise(self, CS, experimental_mode: bool) -> None:
def initialize_v_cruise(self, CS, experimental_mode: bool, frogpilot_toggles) -> None:
# initializing is handled by the PCM
if self.CP.pcmCruise:
return

View File

@ -9,9 +9,13 @@ from cereal import log, car
import cereal.messaging as messaging
from openpilot.common.conversions import Conversions as CV
from openpilot.common.git import get_short_branch
from openpilot.common.params import Params
from openpilot.common.realtime import DT_CTRL
from openpilot.selfdrive.locationd.calibrationd import MIN_SPEED_FILTER
params = Params()
params_memory = Params("/dev/shm/params")
AlertSize = log.ControlsState.AlertSize
AlertStatus = log.ControlsState.AlertStatus
VisualAlert = car.CarControl.HUDControl.VisualAlert

View File

@ -331,7 +331,7 @@ class LongitudinalMpc:
self.cruise_min_a = min_a
self.max_a = max_a
def update(self, radarstate, v_cruise, x, v, a, j, t_follow, personality=log.LongitudinalPersonality.standard):
def update(self, radarstate, v_cruise, x, v, a, j, t_follow, frogpilot_toggles, personality=log.LongitudinalPersonality.standard):
v_ego = self.x0[1]
self.status = radarstate.leadOne.status or radarstate.leadTwo.status

View File

@ -96,7 +96,7 @@ class LongitudinalPlanner:
j = np.zeros(len(T_IDXS_MPC))
return x, v, a, j
def update(self, sm):
def update(self, sm, frogpilot_toggles):
self.mpc.mode = 'blended' if sm['controlsState'].experimentalMode else 'acc'
v_ego = sm['carState'].vEgo
@ -139,7 +139,7 @@ class LongitudinalPlanner:
self.mpc.set_cur_state(self.v_desired_filter.x, self.a_desired)
x, v, a, j = self.parse_model(sm['modelV2'], self.v_model_error)
self.mpc.update(sm['radarState'], sm['frogpilotPlan'].vCruise, x, v, a, j, sm['frogpilotPlan'].tFollow,
personality=sm['controlsState'].personality)
frogpilot_toggles, personality=sm['controlsState'].personality)
self.v_desired_trajectory_full = np.interp(ModelConstants.T_IDXS, T_IDXS_MPC, self.mpc.v_solution)
self.a_desired_trajectory_full = np.interp(ModelConstants.T_IDXS, T_IDXS_MPC, self.mpc.a_solution)

View File

@ -6,6 +6,8 @@ from openpilot.common.swaglog import cloudlog
from openpilot.selfdrive.controls.lib.longitudinal_planner import LongitudinalPlanner
import cereal.messaging as messaging
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import FrogPilotVariables
def publish_ui_plan(sm, pm, longitudinal_planner):
ui_send = messaging.new_message('uiPlan')
ui_send.valid = sm.all_checks(service_list=['carState', 'controlsState', 'modelV2'])
@ -17,7 +19,7 @@ def publish_ui_plan(sm, pm, longitudinal_planner):
uiPlan.accel = longitudinal_planner.a_desired_trajectory_full.tolist()
pm.send('uiPlan', ui_send)
def plannerd_thread():
def plannerd_thread(frogpilot_toggles):
config_realtime_process(5, Priority.CTRL_LOW)
cloudlog.info("plannerd is waiting for CarParams")
@ -34,12 +36,16 @@ def plannerd_thread():
while True:
sm.update()
if sm.updated['modelV2']:
longitudinal_planner.update(sm)
longitudinal_planner.update(sm, frogpilot_toggles)
longitudinal_planner.publish(sm, pm)
publish_ui_plan(sm, pm, longitudinal_planner)
# Update FrogPilot parameters
if FrogPilotVariables.toggles_updated:
FrogPilotVariables.update_frogpilot_params()
def main():
plannerd_thread()
plannerd_thread(FrogPilotVariables.toggles)
if __name__ == "__main__":

View File

@ -13,6 +13,7 @@ from openpilot.common.swaglog import cloudlog
from openpilot.common.simple_kalman import KF1D
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import FrogPilotVariables
# Default lead acceleration decay set to 50% at 1s
_LEAD_ACCEL_TAU = 1.5
@ -208,6 +209,9 @@ class RadarD:
self.ready = False
# FrogPilot variables
self.frogpilot_toggles = FrogPilotVariables.toggles
def update(self, sm: messaging.SubMaster, rr):
self.ready = sm.seen['modelV2']
self.current_time = 1e-9*max(sm.logMonoTime.values())
@ -260,6 +264,10 @@ class RadarD:
self.radar_state.leadOne = get_lead(self.v_ego, self.ready, self.tracks, leads_v3[0], model_v_ego, low_speed_override=True)
self.radar_state.leadTwo = get_lead(self.v_ego, self.ready, self.tracks, leads_v3[1], model_v_ego, low_speed_override=False)
# Update FrogPilot parameters
if FrogPilotVariables.toggles_updated:
FrogPilotVariables.update_frogpilot_params()
def publish(self, pm: messaging.PubMaster, lag_ms: float):
assert self.radar_state is not None

View File

@ -27,7 +27,7 @@ class FrogPilotPlanner:
self.acceleration_jerk = 0
self.speed_jerk = 0
def update(self, carState, controlsState, frogpilotCarControl, frogpilotCarState, frogpilotNavigation, modelData, radarState):
def update(self, carState, controlsState, frogpilotCarControl, frogpilotCarState, frogpilotNavigation, modelData, radarState, frogpilot_toggles):
self.lead_one = radarState.leadOne
driving_gear = carState.gearShifter not in (GearShifter.neutral, GearShifter.park, GearShifter.reverse, GearShifter.unknown)
@ -55,19 +55,19 @@ class FrogPilotPlanner:
self.t_follow = get_T_FOLLOW(controlsState.personality)
if self.tracking_lead and driving_gear:
self.update_follow_values(lead_distance, stopping_distance, v_ego, v_lead)
self.update_follow_values(lead_distance, stopping_distance, v_ego, v_lead, frogpilot_toggles)
else:
self.acceleration_jerk = self.base_acceleration_jerk
self.speed_jerk = self.base_speed_jerk
self.v_cruise = self.update_v_cruise(carState, controlsState, frogpilotCarState, frogpilotNavigation, modelData, v_cruise, v_ego)
self.v_cruise = self.update_v_cruise(carState, controlsState, frogpilotCarState, frogpilotNavigation, modelData, v_cruise, v_ego, frogpilot_toggles)
if v_ego > CRUISING_SPEED:
self.tracking_lead = self.lead_one.status
def update_follow_values(self, lead_distance, stopping_distance, v_ego, v_lead):
def update_follow_values(self, lead_distance, stopping_distance, v_ego, v_lead, frogpilot_toggles):
def update_v_cruise(self, carState, controlsState, frogpilotCarState, frogpilotNavigation, modelData, v_cruise, v_ego):
def update_v_cruise(self, carState, controlsState, frogpilotCarState, frogpilotNavigation, modelData, v_cruise, v_ego, frogpilot_toggles):
v_cruise_cluster = max(controlsState.vCruiseCluster, v_cruise) * CV.KPH_TO_MS
v_cruise_diff = v_cruise_cluster - v_cruise
@ -79,7 +79,7 @@ class FrogPilotPlanner:
return min(filtered_targets)
def publish(self, sm, pm):
def publish(self, sm, pm, frogpilot_toggles):
frogpilot_plan_send = messaging.new_message('frogpilotPlan')
frogpilot_plan_send.valid = sm.all_checks(service_list=['carState', 'controlsState'])
frogpilotPlan = frogpilot_plan_send.frogpilotPlan

View File

@ -1,2 +1,213 @@
from types import SimpleNamespace
from cereal import car
from openpilot.common.conversions import Conversions as CV
from openpilot.common.params import Params
from openpilot.selfdrive.controls.lib.desire_helper import LANE_CHANGE_SPEED_MIN
from openpilot.selfdrive.frogpilot.controls.lib.model_manager import RADARLESS_MODELS
CITY_SPEED_LIMIT = 25 # 55mph is typically the minimum speed for highways
CRUISING_SPEED = 5 # Roughly the speed cars go when not touching the gas while in drive
class FrogPilotVariables:
def __init__(self):
self.frogpilot_toggles = SimpleNamespace()
self.params = Params()
self.params_memory = Params("/dev/shm/params")
self.update_frogpilot_params(False)
@property
def toggles(self):
return self.frogpilot_toggles
@property
def toggles_updated(self):
return self.params_memory.get_bool("FrogPilotTogglesUpdated")
def update_frogpilot_params(self, started=True):
toggle = self.frogpilot_toggles
openpilot_installed = self.params.get_bool("HasAcceptedTerms")
key = "CarParams" if started else "CarParamsPersistent"
msg_bytes = self.params.get(key, block=started and openpilot_installed)
if msg_bytes is None:
always_on_lateral_set = False
car_name = "mock"
openpilot_longitudinal = False
pcm_cruise = False
else:
with car.CarParams.from_bytes(msg_bytes) as CP:
always_on_lateral_set = self.params.get_bool("AlwaysOnLateralSet")
car_name = CP.carName
openpilot_longitudinal = CP.openpilotLongitudinalControl
pcm_cruise = CP.pcmCruise
toggle.is_metric = self.params.get_bool("IsMetric")
distance_conversion = 1. if toggle.is_metric else CV.FOOT_TO_METER
speed_conversion = CV.KPH_TO_MS if toggle.is_metric else CV.MPH_TO_MS
if not started:
toggle.model = self.params.get("Model", block=openpilot_installed, encoding='utf-8')
toggle.radarless_model = toggle.model in RADARLESS_MODELS
toggle.alert_volume_control = self.params.get_bool("AlertVolumeControl")
toggle.disengage_volume = self.params.get_int("DisengageVolume") if toggle.alert_volume_control else 100
toggle.engage_volume = self.params.get_int("EngageVolume") if toggle.alert_volume_control else 100
toggle.prompt_volume = self.params.get_int("PromptVolume") if toggle.alert_volume_control else 100
toggle.promptDistracted_volume = self.params.get_int("PromptDistractedVolume") if toggle.alert_volume_control else 100
toggle.refuse_volume = self.params.get_int("RefuseVolume") if toggle.alert_volume_control else 100
toggle.warningSoft_volume = self.params.get_int("WarningSoftVolume") if toggle.alert_volume_control else 100
toggle.warningImmediate_volume = self.params.get_int("WarningImmediateVolume") if toggle.alert_volume_control else 100
toggle.always_on_lateral = always_on_lateral_set and self.params.get_bool("AlwaysOnLateral")
toggle.always_on_lateral_main = toggle.always_on_lateral and self.params.get_bool("AlwaysOnLateralMain")
toggle.always_on_lateral_pause_speed = self.params.get_int("PauseAOLOnBrake") if toggle.always_on_lateral else 0
toggle.automatic_updates = self.params.get_bool("AutomaticUpdates")
toggle.cluster_offset = self.params.get_float("ClusterOffset") if car_name == "toyota" else 1
toggle.conditional_experimental_mode = openpilot_longitudinal and self.params.get_bool("ConditionalExperimental")
toggle.conditional_curves = toggle.conditional_experimental_mode and self.params.get_bool("CECurves")
toggle.conditional_curves_lead = toggle.conditional_curves and self.params.get_bool("CECurvesLead")
toggle.conditional_limit = self.params.get_int("CESpeed") * speed_conversion if toggle.conditional_experimental_mode else 0
toggle.conditional_limit_lead = self.params.get_int("CESpeedLead") * speed_conversion if toggle.conditional_experimental_mode else 0
toggle.conditional_navigation = toggle.conditional_experimental_mode and self.params.get_bool("CENavigation")
toggle.conditional_navigation_intersections = toggle.conditional_navigation and self.params.get_bool("CENavigationIntersections")
toggle.conditional_navigation_lead = toggle.conditional_navigation and self.params.get_bool("CENavigationLead")
toggle.conditional_navigation_turns = toggle.conditional_navigation and self.params.get_bool("CENavigationTurns")
toggle.conditional_signal = toggle.conditional_experimental_mode and self.params.get_bool("CESignal")
toggle.conditional_slower_lead = toggle.conditional_experimental_mode and self.params.get_bool("CESlowerLead")
toggle.conditional_stop_lights = toggle.conditional_experimental_mode and self.params.get_bool("CEStopLights")
toggle.conditional_stop_lights_lead = toggle.conditional_stop_lights and self.params.get_bool("CEStopLightsLead")
custom_alerts = self.params.get_bool("CustomAlerts")
toggle.green_light_alert = custom_alerts and self.params.get_bool("GreenLightAlert")
toggle.lead_departing_alert = custom_alerts and self.params.get_bool("LeadDepartingAlert")
toggle.loud_blindspot_alert = custom_alerts and self.params.get_bool("LoudBlindspotAlert")
custom_themes = self.params.get_bool("CustomTheme")
holiday_themes = custom_themes and self.params.get_bool("HolidayThemes")
toggle.current_holiday_theme = self.params_memory.get_int("CurrentHolidayTheme") if holiday_themes else 0
toggle.custom_sounds = self.params.get_int("CustomSounds") if custom_themes else 0
toggle.goat_scream = toggle.current_holiday_theme == 0 and toggle.custom_sounds == 1 and self.params.get_bool("GoatScream")
toggle.random_events = custom_themes and self.params.get_bool("RandomEvents")
custom_ui = self.params.get_bool("CustomUI")
custom_paths = self.params.get_bool("CustomPaths")
toggle.adjacent_lanes = custom_paths and self.params.get_bool("AdjacentPath")
toggle.blind_spot_path = custom_paths and self.params.get_bool("BlindSpotPath")
toggle.device_management = self.params.get_bool("DeviceManagement")
device_shutdown_setting = self.params.get_int("DeviceShutdown") if toggle.device_management else 33
toggle.device_shutdown_time = (device_shutdown_setting - 3) * 3600 if device_shutdown_setting >= 4 else device_shutdown_setting * (60 * 15)
toggle.increase_thermal_limits = toggle.device_management and self.params.get_bool("IncreaseThermalLimits")
toggle.low_voltage_shutdown = self.params.get_float("LowVoltageShutdown") if toggle.device_management else 11.8
toggle.offline_mode = toggle.device_management and self.params.get_bool("OfflineMode")
driving_personalities = openpilot_longitudinal and self.params.get_bool("DrivingPersonalities")
toggle.custom_personalities = driving_personalities and self.params.get_bool("CustomPersonalities")
aggressive_profile = toggle.custom_personalities and self.params.get_bool("AggressivePersonalityProfile")
toggle.aggressive_jerk_acceleration = self.params.get_int("AggressiveJerkAcceleration") / 100. if aggressive_profile else 0.5
toggle.aggressive_jerk_speed = self.params.get_int("AggressiveJerkSpeed") / 100. if aggressive_profile else 0.5
toggle.aggressive_follow = self.params.get_float("AggressiveFollow") if aggressive_profile else 1.25
standard_profile = toggle.custom_personalities and self.params.get_bool("StandardPersonalityProfile")
toggle.standard_jerk_acceleration = self.params.get_int("StandardJerkAcceleration") / 100. if standard_profile else 1.0
toggle.standard_jerk_speed = self.params.get_int("StandardJerkSpeed") / 100. if standard_profile else 1.0
toggle.standard_follow = self.params.get_float("StandardFollow") if standard_profile else 1.45
relaxed_profile = toggle.custom_personalities and self.params.get_bool("RelaxedPersonalityProfile")
toggle.relaxed_jerk_acceleration = self.params.get_int("RelaxedJerkAcceleration") / 100. if relaxed_profile else 1.0
toggle.relaxed_jerk_speed = self.params.get_int("RelaxedJerkSpeed") / 100. if relaxed_profile else 1.0
toggle.relaxed_follow = self.params.get_float("RelaxedFollow") if relaxed_profile else 1.75
traffic_profile = toggle.custom_personalities and self.params.get_bool("TrafficPersonalityProfile")
toggle.traffic_mode_jerk_acceleration = [self.params.get_int("TrafficJerkAcceleration") / 100., toggle.aggressive_jerk_acceleration] if traffic_profile else [0.5, 0.5]
toggle.traffic_mode_jerk_speed = [self.params.get_int("TrafficJerkSpeed") / 100., toggle.aggressive_jerk_speed] if traffic_profile else [0.5, 0.5]
toggle.traffic_mode_t_follow = [self.params.get_float("TrafficFollow"), toggle.aggressive_follow] if traffic_profile else [0.5, 1.0]
toggle.experimental_mode_via_press = openpilot_longitudinal and self.params.get_bool("ExperimentalModeActivation")
toggle.experimental_mode_via_distance = toggle.experimental_mode_via_press and self.params.get_bool("ExperimentalModeViaDistance")
toggle.experimental_mode_via_lkas = toggle.experimental_mode_via_press and self.params.get_bool("ExperimentalModeViaLKAS")
lane_change_customizations = self.params.get_bool("LaneChangeCustomizations")
toggle.lane_change_delay = self.params.get_int("LaneChangeTime") if lane_change_customizations else 0
toggle.lane_detection_width = self.params.get_int("LaneDetectionWidth") * distance_conversion / 10. if lane_change_customizations else 0
toggle.lane_detection = toggle.lane_detection_width != 0
toggle.minimum_lane_change_speed = self.params.get_int("MinimumLaneChangeSpeed") * speed_conversion if lane_change_customizations else LANE_CHANGE_SPEED_MIN
toggle.nudgeless = lane_change_customizations and self.params.get_bool("NudgelessLaneChange")
toggle.one_lane_change = lane_change_customizations and self.params.get_bool("OneLaneChange")
lateral_tune = self.params.get_bool("LateralTune")
toggle.force_auto_tune = lateral_tune and self.params.get_bool("ForceAutoTune")
stock_steer_ratio = self.params.get_float("SteerRatioStock")
toggle.steer_ratio = self.params.get_float("SteerRatio") if lateral_tune else stock_steer_ratio
toggle.use_custom_steer_ratio = toggle.steer_ratio != stock_steer_ratio
toggle.taco_tune = lateral_tune and self.params.get_bool("TacoTune")
toggle.turn_desires = lateral_tune and self.params.get_bool("TurnDesires")
toggle.long_pitch = openpilot_longitudinal and car_name == "gm" and self.params.get_bool("LongPitch")
longitudinal_tune = openpilot_longitudinal and self.params.get_bool("LongitudinalTune")
toggle.acceleration_profile = self.params.get_int("AccelerationProfile") if longitudinal_tune else 0
toggle.aggressive_acceleration = longitudinal_tune and self.params.get_bool("AggressiveAcceleration")
toggle.deceleration_profile = self.params.get_int("DecelerationProfile") if longitudinal_tune else 0
toggle.increased_stopping_distance = self.params.get_int("StoppingDistance") * distance_conversion if longitudinal_tune else 0
toggle.lead_detection_threshold = self.params.get_int("LeadDetectionThreshold") / 100. if longitudinal_tune else 0.5
toggle.smoother_braking = longitudinal_tune and self.params.get_bool("SmoothBraking")
toggle.sport_plus = longitudinal_tune and toggle.acceleration_profile == 3
toggle.traffic_mode = longitudinal_tune and self.params.get_bool("TrafficMode")
toggle.model_selector = self.params.get_bool("ModelSelector")
quality_of_life_controls = self.params.get_bool("QOLControls")
toggle.custom_cruise_increase = self.params.get_int("CustomCruise") if quality_of_life_controls and not pcm_cruise else 1
toggle.custom_cruise_increase_long = self.params.get_int("CustomCruiseLong") if quality_of_life_controls and not pcm_cruise else 5
map_gears = quality_of_life_controls and self.params.get_bool("MapGears")
toggle.map_acceleration = map_gears and self.params.get_bool("MapAcceleration")
toggle.map_deceleration = map_gears and self.params.get_bool("MapDeceleration")
toggle.pause_lateral_below_speed = self.params.get_int("PauseLateralSpeed") * speed_conversion if quality_of_life_controls else 0
toggle.pause_lateral_below_signal = quality_of_life_controls and self.params.get_bool("PauseLateralOnSignal")
toggle.reverse_cruise_increase = quality_of_life_controls and pcm_cruise and self.params.get_bool("ReverseCruise")
toggle.set_speed_offset = self.params.get_int("SetSpeedOffset") * (1. if toggle.is_metric else CV.MPH_TO_KPH) if quality_of_life_controls and not pcm_cruise else 0
toggle.map_turn_speed_controller = openpilot_longitudinal and self.params.get_bool("MTSCEnabled")
toggle.mtsc_curvature_check = toggle.map_turn_speed_controller and self.params.get_bool("MTSCCurvatureCheck")
self.params_memory.put_float("MapTargetLatA", 2 * (self.params.get_int("MTSCAggressiveness") / 100.))
toggle.sng_hack = openpilot_longitudinal and car_name == "toyota" and self.params.get_bool("SNGHack")
toggle.speed_limit_controller = openpilot_longitudinal and self.params.get_bool("SpeedLimitController")
toggle.force_mph_dashboard = toggle.speed_limit_controller and self.params.get_bool("ForceMPHDashboard")
toggle.map_speed_lookahead_higher = self.params.get_int("SLCLookaheadHigher") if toggle.speed_limit_controller else 0
toggle.map_speed_lookahead_lower = self.params.get_int("SLCLookaheadLower") if toggle.speed_limit_controller else 0
toggle.offset1 = self.params.get_int("Offset1") * speed_conversion if toggle.speed_limit_controller else 0
toggle.offset2 = self.params.get_int("Offset2") * speed_conversion if toggle.speed_limit_controller else 0
toggle.offset3 = self.params.get_int("Offset3") * speed_conversion if toggle.speed_limit_controller else 0
toggle.offset4 = self.params.get_int("Offset4") * speed_conversion if toggle.speed_limit_controller else 0
toggle.set_speed_limit = toggle.speed_limit_controller and self.params.get_bool("SetSpeedLimit")
toggle.speed_limit_alert = toggle.speed_limit_controller and self.params.get_bool("SpeedLimitChangedAlert")
toggle.speed_limit_confirmation = toggle.speed_limit_controller and self.params.get_bool("SLCConfirmation")
toggle.speed_limit_confirmation_higher = toggle.speed_limit_confirmation and self.params.get_bool("SLCConfirmationHigher")
toggle.speed_limit_confirmation_lower = toggle.speed_limit_confirmation and self.params.get_bool("SLCConfirmationLower")
toggle.speed_limit_controller_override = self.params.get_int("SLCOverride") if toggle.speed_limit_controller else 0
toggle.use_experimental_mode = toggle.speed_limit_controller and self.params.get_int("SLCFallback") == 1
toggle.use_previous_limit = toggle.speed_limit_controller and self.params.get_int("SLCFallback") == 2
toggle.speed_limit_priority1 = self.params.get("SLCPriority1", encoding='utf-8') if toggle.speed_limit_controller else None
toggle.speed_limit_priority2 = self.params.get("SLCPriority2", encoding='utf-8') if toggle.speed_limit_controller else None
toggle.speed_limit_priority3 = self.params.get("SLCPriority3", encoding='utf-8') if toggle.speed_limit_controller else None
toggle.speed_limit_priority_highest = toggle.speed_limit_priority1 == "Highest"
toggle.speed_limit_priority_lowest = toggle.speed_limit_priority1 == "Lowest"
toyota_doors = car_name == "toyota" and self.params.get_bool("ToyotaDoors")
toggle.lock_doors = toyota_doors and self.params.get_bool("LockDoors")
toggle.unlock_doors = toyota_doors and self.params.get_bool("UnlockDoors")
toggle.vision_turn_controller = openpilot_longitudinal and self.params.get_bool("VisionTurnControl")
toggle.curve_sensitivity = self.params.get_int("CurveSensitivity") / 100. if toggle.vision_turn_controller else 1
toggle.turn_aggressiveness = self.params.get_int("TurnAggressiveness") / 100. if toggle.vision_turn_controller else 1
FrogPilotVariables = FrogPilotVariables()

View File

@ -11,6 +11,7 @@ from openpilot.common.time import system_time_valid
from openpilot.selfdrive.frogpilot.controls.frogpilot_planner import FrogPilotPlanner
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_functions import FrogPilotFunctions
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import FrogPilotVariables
WIFI = log.DeviceState.NetworkType.wifi
@ -25,7 +26,7 @@ def time_checks(deviceState, now, params, params_memory):
screen_off = deviceState.screenBrightnessPercent == 0
wifi_connection = deviceState.networkType == WIFI
def frogpilot_thread():
def frogpilot_thread(frogpilot_toggles):
config_realtime_process(5, Priority.CTRL_LOW)
params = Params()
@ -50,8 +51,11 @@ def frogpilot_thread():
if started and sm.updated['modelV2']:
frogpilot_planner.update(sm['carState'], sm['controlsState'], sm['frogpilotCarControl'], sm['frogpilotCarState'],
sm['frogpilotNavigation'], sm['modelV2'], sm['radarState'])
frogpilot_planner.publish(sm, pm)
sm['frogpilotNavigation'], sm['modelV2'], sm['radarState'], frogpilot_toggles)
frogpilot_planner.publish(sm, pm, frogpilot_toggles)
if FrogPilotVariables.toggles_updated:
FrogPilotVariables.update_frogpilot_params(started)
if now.second == 0 or not time_validated:
if not started:
@ -64,7 +68,7 @@ def frogpilot_thread():
continue
def main():
frogpilot_thread()
frogpilot_thread(FrogPilotVariables.toggles)
if __name__ == "__main__":
main()

View File

@ -0,0 +1,11 @@
#include "selfdrive/ui/ui.h"
Params paramsMemory{"/dev/shm/params"};
void updateFrogPilotToggles() {
std::thread([]() {
paramsMemory.putBool("FrogPilotTogglesUpdated", true);
std::this_thread::sleep_for(std::chrono::seconds(1));
paramsMemory.putBool("FrogPilotTogglesUpdated", false);
}).detach();
}

View File

@ -0,0 +1,3 @@
#pragma once
void updateFrogPilotToggles();

View File

@ -136,6 +136,7 @@ def main():
min_sr, max_sr = 0.5 * CP.steerRatio, 2.0 * CP.steerRatio
params = params_reader.get("LiveParameters")
params_memory = Params("/dev/shm/params")
# Check if car model matches
if params is not None:

View File

@ -24,6 +24,8 @@ from openpilot.selfdrive.modeld.fill_model_msg import fill_model_msg, fill_pose_
from openpilot.selfdrive.modeld.constants import ModelConstants
from openpilot.selfdrive.modeld.models.commonmodel_pyx import ModelFrame, CLContext
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import FrogPilotVariables
PROCESS_NAME = "selfdrive.modeld.modeld"
SEND_RAW_PRED = os.getenv('SEND_RAW_PRED')
@ -111,7 +113,7 @@ class ModelState:
return outputs
def main(demo=False):
def main(demo=False, frogpilot_toggles=None):
cloudlog.warning("modeld init")
sentry.set_tag("daemon", PROCESS_NAME)
@ -267,7 +269,7 @@ def main(demo=False):
l_lane_change_prob = desire_state[log.Desire.laneChangeLeft]
r_lane_change_prob = desire_state[log.Desire.laneChangeRight]
lane_change_prob = l_lane_change_prob + r_lane_change_prob
DH.update(sm['carState'], sm['carControl'].latActive, lane_change_prob, sm['frogpilotPlan'])
DH.update(sm['carState'], sm['carControl'].latActive, lane_change_prob, sm['frogpilotPlan'], frogpilot_toggles)
modelv2_send.modelV2.meta.laneChangeState = DH.lane_change_state
modelv2_send.modelV2.meta.laneChangeDirection = DH.lane_change_direction
@ -277,6 +279,9 @@ def main(demo=False):
last_vipc_frame_id = meta_main.frame_id
# Update FrogPilot parameters
if FrogPilotVariables.toggles_updated:
FrogPilotVariables.update_frogpilot_params()
if __name__ == "__main__":
try:
@ -284,7 +289,7 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--demo', action='store_true', help='A boolean for demo mode.')
args = parser.parse_args()
main(demo=args.demo)
main(demo=args.demo, frogpilot_toggles=FrogPilotVariables.toggles)
except KeyboardInterrupt:
cloudlog.warning(f"child {PROCESS_NAME} got SIGINT")
except Exception:

View File

@ -17,6 +17,8 @@ from openpilot.selfdrive.navd.helpers import (Coordinate, coordinate_from_param,
parse_banner_instructions)
from openpilot.common.swaglog import cloudlog
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import FrogPilotVariables
REROUTE_DISTANCE = 25
MANEUVER_TRANSITION_THRESHOLD = 10
REROUTE_COUNTER_MIN = 3
@ -58,6 +60,9 @@ class RouteEngine:
self.api = Api(self.params.get("DongleId", encoding='utf8'))
self.mapbox_host = "https://maps.comma.ai"
# FrogPilot variables
self.frogpilot_toggles = FrogPilotVariables.toggles
def update(self):
self.sm.update(0)
@ -76,6 +81,10 @@ class RouteEngine:
except Exception:
cloudlog.exception("navd.failed_to_compute")
# Update FrogPilot parameters
if FrogPilotVariables.toggles_updated:
FrogPilotVariables.update_frogpilot_params()
def update_location(self):
location = self.sm['liveLocationKalman']
self.gps_ok = location.gpsOK

View File

@ -69,6 +69,9 @@ private:
DriverViewWindow *driver_view;
QStackedLayout *slayout;
// FrogPilot variables
Params params;
private slots:
void updateState(const UIState &s);
};

View File

@ -74,6 +74,9 @@ private:
void updateDestinationMarker();
uint64_t route_rcv_frame = 0;
// FrogPilot variables
Params params;
private slots:
void updateState(const UIState &s);

View File

@ -98,4 +98,7 @@ private:
Params params;
ParamWatcher *fs_watch;
// FrogPilot variables
Params paramsMemory{"/dev/shm/params"};
};

View File

@ -59,4 +59,7 @@ protected:
private:
std::unique_ptr<PubMaster> pm;
// FrogPilot variables
Params params;
};

View File

@ -18,6 +18,10 @@ signals:
public slots:
void updateState(const UIState &s);
private:
// FrogPilot variables
Params params;
protected:
QStackedLayout *stack;
};

View File

@ -22,4 +22,7 @@ private:
HomeWindow *homeWindow;
SettingsWindow *settingsWindow;
OnboardingWindow *onboardingWindow;
// FrogPilot variables
Params params;
};

View File

@ -13,6 +13,8 @@ from openpilot.common.swaglog import cloudlog
from openpilot.system import micd
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import FrogPilotVariables
SAMPLE_RATE = 48000
SAMPLE_BUFFER = 4096 # (approx 100ms)
MAX_VOLUME = 1.0
@ -62,6 +64,11 @@ class Soundd:
self.spl_filter_weighted = FirstOrderFilter(0, 2.5, FILTER_DT, initialized=False)
# FrogPilot variables
self.frogpilot_toggles = FrogPilotVariables.toggles
self.update_frogpilot_sounds()
def load_sounds(self):
self.loaded_sounds: dict[int, np.ndarray] = {}
@ -155,6 +162,12 @@ class Soundd:
assert stream.active
# Update FrogPilot parameters
if FrogPilotVariables.toggles_updated:
FrogPilotVariables.update_frogpilot_params()
self.update_frogpilot_sounds()
def update_frogpilot_sounds(self):
def main():
s = Soundd()

View File

@ -254,6 +254,11 @@ void ui_update_params(UIState *s) {
s->scene.map_on_left = params.getBool("NavSettingLeftSide");
}
void ui_update_frogpilot_params(UIState *s) {
Params params = Params();
UIScene &scene = s->scene;
}
void UIState::updateStatus() {
if (scene.started && sm->updated("controlsState")) {
auto controls_state = (*sm)["controlsState"].getControlsState();
@ -270,6 +275,7 @@ void UIState::updateStatus() {
if (scene.started) {
status = STATUS_DISENGAGED;
scene.started_frame = sm->frame;
updateFrogPilotToggles();
}
started_prev = scene.started;
scene.world_objects_visible = false;
@ -297,6 +303,8 @@ UIState::UIState(QObject *parent) : QObject(parent) {
timer = new QTimer(this);
QObject::connect(timer, &QTimer::timeout, this, &UIState::update);
timer->start(1000 / UI_FREQ);
ui_update_frogpilot_params(this);
}
void UIState::update() {
@ -308,6 +316,13 @@ void UIState::update() {
watchdog_kick(nanos_since_boot());
}
emit uiUpdate(*this);
// Update FrogPilot parameters
if (paramsMemory.getBool("FrogPilotTogglesUpdated")) {
ui_update_frogpilot_params(this);
}
// FrogPilot variables that need to be constantly updated
}
void UIState::setPrimeType(PrimeType type) {

View File

@ -16,6 +16,8 @@
#include "common/timing.h"
#include "system/hardware/hw.h"
#include "selfdrive/frogpilot/ui/qt/widgets/frogpilot_controls.h"
const int UI_BORDER_SIZE = 30;
const int UI_HEADER_HEIGHT = 420;
@ -158,6 +160,9 @@ private:
QTimer *timer;
bool started_prev = false;
PrimeType prime_type = PrimeType::UNKNOWN;
// FrogPilot variables
Params paramsMemory{"/dev/shm/params"};
};
UIState *uiState();
@ -207,3 +212,6 @@ void update_dmonitoring(UIState *s, const cereal::DriverStateV2::Reader &drivers
void update_leads(UIState *s, const cereal::RadarState::Reader &radar_state, const cereal::XYZTData::Reader &line);
void update_line_data(const UIState *s, const cereal::XYZTData::Reader &line,
float y_off, float z_off, QPolygonF *pvd, int max_idx, bool allow_invert);
// FrogPilot functions
void ui_update_frogpilot_params(UIState *s);

View File

@ -958,6 +958,9 @@ void process_road_camera(MultiCameraState *s, CameraState *c, int cnt) {
}
void cameras_run(MultiCameraState *s) {
// FrogPilot variables
Params paramsMemory{"/dev/shm/params"};
LOG("-- Starting threads");
std::vector<std::thread> threads;
if (s->driver_cam.enabled) threads.push_back(start_process_thread(s, &s->driver_cam, process_driver_camera));

View File

@ -25,6 +25,8 @@ from openpilot.system.hardware.power_monitoring import PowerMonitoring
from openpilot.system.hardware.fan_controller import TiciFanController
from openpilot.system.version import terms_version, training_version
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import FrogPilotVariables
ThermalStatus = log.DeviceState.ThermalStatus
NetworkType = log.DeviceState.NetworkType
NetworkStrength = log.DeviceState.NetworkStrength
@ -162,7 +164,7 @@ def hw_state_thread(end_event, hw_queue):
time.sleep(DT_HW)
def hardware_thread(end_event, hw_queue) -> None:
def hardware_thread(end_event, hw_queue, frogpilot_toggles) -> None:
pm = messaging.PubMaster(['deviceState', 'frogpilotDeviceState'])
sm = messaging.SubMaster(["peripheralState", "gpsLocationExternal", "controlsState", "pandaStates"], poll="pandaStates")
@ -387,7 +389,7 @@ def hardware_thread(end_event, hw_queue) -> None:
msg.deviceState.somPowerDrawW = som_power_draw
# Check if we need to shut down
if power_monitor.should_shutdown(onroad_conditions["ignition"], in_car, off_ts, started_seen):
if power_monitor.should_shutdown(onroad_conditions["ignition"], in_car, off_ts, started_seen, frogpilot_toggles):
cloudlog.warning(f"shutting device down, offroad since {off_ts}")
params.put_bool("DoShutdown", True)
@ -449,6 +451,9 @@ def hardware_thread(end_event, hw_queue) -> None:
count += 1
should_start_prev = should_start
# Update FrogPilot parameters
if FrogPilotVariables.toggles_updated:
FrogPilotVariables.update_frogpilot_params(started_ts is not None)
def main():
hw_queue = queue.Queue(maxsize=1)
@ -456,7 +461,7 @@ def main():
threads = [
threading.Thread(target=hw_state_thread, args=(end_event, hw_queue)),
threading.Thread(target=hardware_thread, args=(end_event, hw_queue)),
threading.Thread(target=hardware_thread, args=(end_event, hw_queue, FrogPilotVariables.toggles)),
]
for t in threads:

View File

@ -107,7 +107,7 @@ class PowerMonitoring:
return int(self.car_battery_capacity_uWh)
# See if we need to shutdown
def should_shutdown(self, ignition: bool, in_car: bool, offroad_timestamp: float | None, started_seen: bool):
def should_shutdown(self, ignition: bool, in_car: bool, offroad_timestamp: float | None, started_seen: bool, frogpilot_toggles):
if offroad_timestamp is None:
return False

View File

@ -353,6 +353,7 @@ def manager_thread() -> None:
cloudlog.info({"environ": os.environ})
params = Params()
params_memory = Params("/dev/shm/params")
ignore: list[str] = []
if params.get("DongleId", encoding='utf8') in (None, UNREGISTERED_DONGLE_ID):
@ -378,6 +379,7 @@ def manager_thread() -> None:
params.clear_all(ParamKeyType.CLEAR_ON_ONROAD_TRANSITION)
elif not started and started_prev:
params.clear_all(ParamKeyType.CLEAR_ON_OFFROAD_TRANSITION)
params_memory.clear_all(ParamKeyType.CLEAR_ON_OFFROAD_TRANSITION)
# update onroad params, which drives pandad's safety setter thread
if started != started_prev:

View File

@ -22,6 +22,8 @@ from openpilot.selfdrive.controls.lib.alertmanager import set_offroad_alert
from openpilot.system.hardware import AGNOS, HARDWARE
from openpilot.system.version import get_build_metadata
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import FrogPilotVariables
LOCK_FILE = os.getenv("UPDATER_LOCK_FILE", "/tmp/safe_staging_overlay.lock")
STAGING_ROOT = os.getenv("UPDATER_STAGING_ROOT", "/data/safe_staging")
@ -411,6 +413,7 @@ class Updater:
def main() -> None:
params = Params()
params_memory = Params("/dev/shm/params")
if params.get_bool("DisableUpdates"):
cloudlog.warning("updates are disabled by the DisableUpdates param")