September 2024 Update

This commit is contained in:
FrogAi 2024-08-31 10:30:54 -07:00
parent 27cbcc4d1c
commit 1acc93990f
222 changed files with 4291 additions and 2151 deletions

59
.github/workflows/update-pr-branch.yaml vendored Normal file
View File

@ -0,0 +1,59 @@
name: Update MAKE-PRS-HERE
on:
push:
branches:
- FrogPilot-Staging
env:
SOURCE_BRANCH: FrogPilot-Staging
TARGET_BRANCH: MAKE-PRS-HERE
jobs:
squash-and-cherry-pick:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ env.SOURCE_BRANCH }}
fetch-depth: 0
- name: Set Git user name and email
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Get the second to last commit hash and create a temporary branch
run: |
commit_hash=$(git rev-parse HEAD~1)
git checkout -b temp-branch $commit_hash
- name: Squash all commits into one with today's date in Phoenix time zone
run: |
day=$(TZ='America/Phoenix' date '+%-d')
suffix="th"
case $day in
1|21|31) suffix="st" ;;
2|22) suffix="nd" ;;
3|23) suffix="rd" ;;
esac
commit_message="$(TZ='America/Phoenix' date '+%B ')$day$suffix, $(TZ='America/Phoenix' date '+%Y') Update"
git reset --soft $(git rev-list --max-parents=0 HEAD)
git commit -m "$commit_message"
- name: Cherry-pick the squashed commit to target branch and push
run: |
git fetch origin
git checkout ${{ env.TARGET_BRANCH }}
git cherry-pick temp-branch -X theirs || {
if git status | grep -q "nothing to commit, working tree clean"; then
echo "Empty commit detected, skipping cherry-pick."
git cherry-pick --skip
else
echo "Continuing with cherry-pick."
git cherry-pick --continue
fi
}
git push origin ${{ env.TARGET_BRANCH }}

View File

@ -0,0 +1,21 @@
name: Update FrogPilot-Previous Branch
on:
schedule:
- cron: '0 7 1 * *'
jobs:
update-branch:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Reset "FrogPilot-Previous" branch to match "FrogPilot"
run: |
git fetch origin
git checkout FrogPilot-Previous || git checkout -b FrogPilot-Previous
git reset --hard origin/FrogPilot
git push origin FrogPilot-Previous --force

View File

@ -0,0 +1,21 @@
name: Update FrogPilot Branch
on:
schedule:
- cron: '0 19 1 * *'
jobs:
update-branch:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Reset "FrogPilot" branch to match "FrogPilot-Staging"
run: |
git fetch origin
git checkout FrogPilot || git checkout -b FrogPilot
git reset --hard origin/FrogPilot-Staging
git push origin FrogPilot --force

View File

@ -21,7 +21,7 @@ FrogPilot is a fully open-sourced fork of openpilot, featuring clear and concise
------
FrogPilot was last updated on:
**August 2nd, 2024**
**September 1st, 2024**
Features
------

View File

@ -1,6 +1,8 @@
using Cxx = import "./include/c++.capnp";
$Cxx.namespace("cereal");
using Car = import "car.capnp";
@0xb526ba661d550a59;
# custom.capnp: a home for empty structs reserved for custom forks
@ -9,9 +11,11 @@ $Cxx.namespace("cereal");
# you can rename the struct, but don't change the identifier
struct FrogPilotCarControl @0x81c2f05a394cf4af {
alwaysOnLateral @0 :Bool;
resumePressed @1 :Bool;
speedLimitChanged @2 :Bool;
alwaysOnLateralActive @0 :Bool;
fcwEventTriggered @1 :Bool;
noEntryEventTriggered @2 :Bool;
resumePressed @3 :Bool;
steerSaturatedEventTriggered @4 :Bool;
}
struct FrogPilotCarState @0xaedffd8f31e7b55d {
@ -46,31 +50,32 @@ struct FrogPilotPlan @0x80ae746ee2596b11 {
accelerationJerk @0 :Float32;
accelerationJerkStock @1 :Float32;
adjustedCruise @2 :Float32;
conditionalExperimentalActive @3 :Bool;
alwaysOnLateralActive @3 :Bool;
dangerJerk @4 :Float32;
desiredFollowDistance @5 :Float32;
forcingStop @6 :Bool;
greenLight @7 :Bool;
laneWidthLeft @8 :Float32;
laneWidthRight @9 :Float32;
leadDeparting @10 :Bool;
maxAcceleration @11 :Float32;
minAcceleration @12 :Float32;
redLight @13 :Bool;
safeObstacleDistance @14 :Int16;
safeObstacleDistanceStock @15 :Int16;
slcOverridden @16 :Bool;
slcOverriddenSpeed @17 :Float32;
slcSpeedLimit @18 :Float32;
slcSpeedLimitOffset @19 :Float32;
speedJerk @20 :Float32;
speedJerkStock @21 :Float32;
stoppedEquivalenceFactor @22 :Int16;
takingCurveQuickly @23 :Bool;
tFollow @24 :Float32;
unconfirmedSlcSpeedLimit @25 :Float32;
vCruise @26 :Float32;
vtscControllingCurve @27 :Bool;
experimentalMode @6 :Bool;
forcingStop @7 :Bool;
frogpilotEvents @8: List(Car.CarEvent);
lateralCheck @9 :Bool;
laneWidthLeft @10 :Float32;
laneWidthRight @11 :Float32;
maxAcceleration @12 :Float32;
minAcceleration @13 :Float32;
redLight @14 :Bool;
safeObstacleDistance @15 :Int32;
safeObstacleDistanceStock @16 :Int32;
slcOverridden @17 :Bool;
slcOverriddenSpeed @18 :Float32;
slcSpeedLimit @19 :Float32;
slcSpeedLimitOffset @20 :Float32;
speedJerk @21 :Float32;
speedJerkStock @22 :Float32;
speedLimitChanged @23 :Bool;
stoppedEquivalenceFactor @24 :Int32;
tFollow @25 :Float32;
unconfirmedSlcSpeedLimit @26 :Float32;
vCruise @27 :Float32;
vtscControllingCurve @28 :Bool;
}
struct CustomReserved5 @0xa5cd762cd951a455 {

View File

@ -12,6 +12,8 @@ class Conversions:
KNOTS_TO_MS = 1. / MS_TO_KNOTS
# Distance
KM_TO_MILES = KPH_TO_MPH
MILES_TO_KM = MPH_TO_KPH
METER_TO_FOOT = 3.28084
FOOT_TO_METER = 1. / METER_TO_FOOT
CM_TO_INCH = 1. / 2.54

View File

@ -213,7 +213,6 @@ std::unordered_map<std::string, uint32_t> keys = {
{"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},
{"AggressiveJerkDanger", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
@ -223,7 +222,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"AlwaysOnLateral", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"AlwaysOnLateralLKAS", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"AlwaysOnLateralMain", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"AlwaysOnLateralSet", CLEAR_ON_ONROAD_TRANSITION},
{"AlwaysOnLateralSet", CLEAR_ON_OFFROAD_TRANSITION},
{"AMapKey1", PERSISTENT},
{"AMapKey2", PERSISTENT},
{"ApiCache_DriveStats", PERSISTENT},
@ -235,16 +234,19 @@ std::unordered_map<std::string, uint32_t> keys = {
{"BlacklistedModels", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"BlindSpotMetrics", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"BlindSpotPath", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"BonusContent", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"BorderMetrics", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"CameraFPS", PERSISTENT},
{"CameraView", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"CancelModelDownload", PERSISTENT},
{"CancelThemeDownload", PERSISTENT},
{"CarMake", PERSISTENT},
{"CarModel", PERSISTENT},
{"CarModelName", PERSISTENT},
{"CECurves", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CECurvesLead", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CELead", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CEModelStopTime", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CENavigation", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CENavigationIntersections", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CENavigationLead", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
@ -258,28 +260,30 @@ std::unordered_map<std::string, uint32_t> keys = {
{"CESpeed", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CESpeedLead", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CEStatus", PERSISTENT},
{"CEStopLights", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CEStopLightsLessSensitive", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CEStoppedLead", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"ClairvoyantDriverCalibrationParams", PERSISTENT},
{"ClairvoyantDriverDrives", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"ClairvoyantDriverLiveTorqueParameters", PERSISTENT},
{"ClairvoyantDriverScore", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"ClusterOffset", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"ColorToDownload", PERSISTENT},
{"Compass", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"ConditionalExperimental", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"CrosstrekTorque", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"CurrentHolidayTheme", PERSISTENT},
{"CurrentHolidayTheme", CLEAR_ON_MANAGER_START},
{"CurrentModel", PERSISTENT | CLEAR_ON_OFFROAD_TRANSITION},
{"CurrentModelName", PERSISTENT | CLEAR_ON_OFFROAD_TRANSITION},
{"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},
{"CustomDistanceIcons", 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},
@ -290,8 +294,15 @@ std::unordered_map<std::string, uint32_t> keys = {
{"DisableOnroadUploads", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"DisableOpenpilotLongitudinal", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"DisableVTSCSmoothing", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"DistanceIconToDownload", PERSISTENT},
{"DisengageVolume", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"DoToggleReset", PERSISTENT},
{"DownloadableColors", PERSISTENT},
{"DownloadableDistanceIcons", PERSISTENT},
{"DownloadableIcons", PERSISTENT},
{"DownloadableSignals", PERSISTENT},
{"DownloadableSounds", PERSISTENT},
{"DownloadableWheels", PERSISTENT},
{"DownloadAllModels", PERSISTENT},
{"DragonPilotTune", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"DriveRated", CLEAR_ON_ONROAD_TRANSITION},
@ -304,6 +315,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"DynamicPathWidth", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"DynamicPedalsOnUI", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"EngageVolume", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"ExperimentalGMTune", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"ExperimentalModeActivation", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"ExperimentalModels", PERSISTENT},
{"ExperimentalModeViaDistance", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
@ -340,9 +352,11 @@ std::unordered_map<std::string, uint32_t> keys = {
{"HideSpeedUI", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"HideUIElements", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"HolidayThemes", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"HumanAcceleration", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"HumanFollowing", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"IconToDownload", PERSISTENT},
{"IncreaseThermalLimits", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"JerkInfo", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"KaofuiIcons", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"LaneChangeCustomizations", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"LaneChangeTime", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"LaneDetectionWidth", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
@ -374,6 +388,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"MapStyle", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"MapTargetLatA", PERSISTENT},
{"MapTargetVelocities", PERSISTENT},
{"MinimumBackupSize", PERSISTENT},
{"MinimumLaneChangeSpeed", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"Model", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"ModelDownloadProgress", PERSISTENT},
@ -393,7 +408,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"NewLongAPIGM", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"NNFF", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"NNFFLite", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"NNFFModelName", PERSISTENT},
{"NNFFModelName", CLEAR_ON_OFFROAD_TRANSITION},
{"NoLogging", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"NorthDakotaCalibrationParams", PERSISTENT},
{"NorthDakotaDrives", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
@ -421,13 +436,13 @@ std::unordered_map<std::string, uint32_t> keys = {
{"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},
{"PersonalizeOpenpilot", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"PreferredSchedule", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_OTHER},
{"PreviousSpeedLimit", PERSISTENT},
{"PromptDistractedVolume", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
@ -483,6 +498,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"Sidebar", PERSISTENT | FROGPILOT_OTHER},
{"SidebarMetrics", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"SignalMetrics", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"SignalToDownload", PERSISTENT},
{"SLCConfirmation", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"SLCConfirmationHigher", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"SLCConfirmationLower", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
@ -495,8 +511,8 @@ std::unordered_map<std::string, uint32_t> keys = {
{"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},
{"SoundToDownload", PERSISTENT},
{"SpeedLimitChangedAlert", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"SpeedLimitController", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"StandardFollow", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
@ -505,6 +521,8 @@ std::unordered_map<std::string, uint32_t> keys = {
{"StandardJerkSpeed", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"StandardPersonalityProfile", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"StandbyMode", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"StartupMessageBottom", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"StartupMessageTop", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"StaticPedalsOnUI", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"SteerRatio", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"SteerRatioStock", PERSISTENT},
@ -513,6 +531,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"StoppingDistance", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"TacoTune", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"TetheringEnabled", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_OTHER},
{"ThemeDownloadProgress", PERSISTENT},
{"ToyotaDoors", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"TrafficFollow", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"TrafficJerkAcceleration", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
@ -526,7 +545,10 @@ std::unordered_map<std::string, uint32_t> keys = {
{"UnlimitedLength", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"UnlockDoors", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
{"Updated", PERSISTENT},
{"UpdateTheme", PERSISTENT},
{"UpdateWheelImage", PERSISTENT},
{"UseSI", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"UseStockColors", CLEAR_ON_MANAGER_START},
{"UseVienna", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"VisionTurnControl", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_CONTROLS},
{"VoltSNG", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VEHICLES},
@ -538,6 +560,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"WD40Score", PERSISTENT | FROGPILOT_CONTROLS},
{"WheelIcon", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"WheelSpeed", PERSISTENT | FROGPILOT_STORAGE | FROGPILOT_VISUALS},
{"WheelToDownload", PERSISTENT},
};
} // namespace

View File

@ -221,6 +221,7 @@ BO_ 715 ASCMGasRegenCmd: 8 K124_ASCM
SG_ GasRegenFullStopActive : 13|1@0+ (1,0) [0|0] "" NEO
SG_ GasRegenCmdActive : 0|1@0+ (1,0) [0|0] "" NEO
SG_ RollingCounter : 7|2@0+ (1,0) [0|0] "" NEO
SG_ GasRegenAlwaysOne3 : 23|1@0+ (1,0) [0|1] "" NEO
SG_ GasRegenCmd : 8|14@0+ (1,0) [0|0] "" NEO
BO_ 717 ASCM_2CD: 5 K124_ASCM

View File

@ -94,6 +94,7 @@ class Car:
# FrogPilot variables
self.frogpilot_toggles = FrogPilotVariables.toggles
FrogPilotVariables.update_frogpilot_params()
self.update_toggles = False

View File

@ -7,6 +7,8 @@ from openpilot.selfdrive.car.ford.values import CarControllerParams, FordFlags
from openpilot.selfdrive.car.interfaces import CarControllerBase
from openpilot.selfdrive.controls.lib.drive_helpers import V_CRUISE_MAX
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import get_max_allowed_accel
LongCtrlState = car.CarControl.Actuators.LongControlState
VisualAlert = car.CarControl.HUDControl.VisualAlert
@ -95,7 +97,7 @@ class CarController(CarControllerBase):
if self.CP.openpilotLongitudinalControl and (self.frame % CarControllerParams.ACC_CONTROL_STEP) == 0:
# Both gas and accel are in m/s^2, accel is used solely for braking
if frogpilot_toggles.sport_plus:
accel = clip(actuators.accel, CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX_PLUS)
accel = clip(actuators.accel, CarControllerParams.ACCEL_MIN, get_max_allowed_accel(CS.out.vEgoRaw))
else:
accel = clip(actuators.accel, CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX)
gas = accel

View File

@ -33,7 +33,6 @@ class CarControllerParams:
CURVATURE_ERROR = 0.002 # ~6 degrees at 10 m/s, ~10 degrees at 35 m/s
ACCEL_MAX = 2.0 # m/s^2 max acceleration
ACCEL_MAX_PLUS = 4.0 # m/s^2 max acceleration
ACCEL_MIN = -3.5 # m/s^2 max deceleration
MIN_GAS = -0.5
INACTIVE_GAS = -5.0

View File

@ -12,6 +12,8 @@ from openpilot.selfdrive.car.gm.values import CAR, CruiseButtons, CarControllerP
from openpilot.selfdrive.car.interfaces import CarInterfaceBase, TorqueFromLateralAccelCallbackType, FRICTION_THRESHOLD, LatControlInputs, NanoFFModel
from openpilot.selfdrive.controls.lib.drive_helpers import get_friction
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import get_max_allowed_accel
ButtonType = car.CarState.ButtonEvent.Type
FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
EventName = car.CarEvent.EventName
@ -40,7 +42,7 @@ class CarInterface(CarInterfaceBase):
@staticmethod
def get_pid_accel_limits(CP, current_speed, cruise_speed, frogpilot_toggles):
if frogpilot_toggles.sport_plus:
return CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX_PLUS
return CarControllerParams.ACCEL_MIN, get_max_allowed_accel(current_speed)
else:
return CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX
@ -113,6 +115,11 @@ class CarInterface(CarInterfaceBase):
else:
ret.transmissionType = TransmissionType.automatic
if params.get_bool("ExperimentalGMTune"):
ret.stoppingDecelRate = 0.3
ret.vEgoStopping = 0.15
ret.vEgoStarting = 0.15
if use_new_api:
ret.longitudinalTuning.kiBP = [5., 35.]
else:

View File

@ -7,6 +7,8 @@ from openpilot.selfdrive.car import dbc_dict, PlatformConfig, DbcDict, Platforms
from openpilot.selfdrive.car.docs_definitions import CarHarness, CarDocs, CarParts
from openpilot.selfdrive.car.fw_query_definitions import FwQueryConfig, Request, StdQueries
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import get_max_allowed_accel
Ecu = car.CarParams.Ecu
@ -33,7 +35,6 @@ class CarControllerParams:
# Our controller should still keep the 2 second average above
# -3.5 m/s^2 as per planner limits
ACCEL_MAX = 2. # m/s^2
ACCEL_MAX_PLUS = 4. # m/s^2
ACCEL_MIN = -4. # m/s^2
def __init__(self, CP):
@ -48,14 +49,14 @@ class CarControllerParams:
self.INACTIVE_REGEN = 5650
# Camera ACC vehicles have no regen while enabled.
# Camera transitions to MAX_ACC_REGEN from ZERO_GAS and uses friction brakes instantly
max_regen_acceleration = 0.
self.max_regen_acceleration = 0.
elif CP.carFingerprint in SDGM_CAR:
self.MAX_GAS = 7496
self.MAX_GAS_PLUS = 7496
self.MAX_ACC_REGEN = 5610
self.INACTIVE_REGEN = 5650
max_regen_acceleration = 0.
self.max_regen_acceleration = 0.
else:
self.MAX_GAS = 7168 # Safety limit, not ACC max. Stock ACC >8192 from standstill.
@ -64,14 +65,13 @@ class CarControllerParams:
self.INACTIVE_REGEN = 5500
# ICE has much less engine braking force compared to regen in EVs,
# lower threshold removes some braking deadzone
max_regen_acceleration = -1. if CP.carFingerprint in EV_CAR else -0.1
self.max_regen_acceleration = -1. if CP.carFingerprint in EV_CAR else -0.1
self.GAS_LOOKUP_BP = [max_regen_acceleration, 0., self.ACCEL_MAX]
self.GAS_LOOKUP_BP_PLUS = [max_regen_acceleration, 0., self.ACCEL_MAX_PLUS]
self.GAS_LOOKUP_BP = [self.max_regen_acceleration, 0., self.ACCEL_MAX]
self.GAS_LOOKUP_V = [self.MAX_ACC_REGEN, self.ZERO_GAS, self.MAX_GAS]
self.GAS_LOOKUP_V_PLUS = [self.MAX_ACC_REGEN, self.ZERO_GAS, self.MAX_GAS_PLUS]
self.BRAKE_LOOKUP_BP = [self.ACCEL_MIN, max_regen_acceleration]
self.BRAKE_LOOKUP_BP = [self.ACCEL_MIN, self.max_regen_acceleration]
self.BRAKE_LOOKUP_V = [self.MAX_BRAKE, 0.]
# determined by letting Volt regen to a stop in L gear from 89mph,
@ -83,9 +83,10 @@ class CarControllerParams:
def update_ev_gas_brake_threshold(self, v_ego):
gas_brake_threshold = interp(v_ego, self.EV_GAS_BRAKE_THRESHOLD_BP, self.EV_GAS_BRAKE_THRESHOLD_V)
self.EV_GAS_LOOKUP_BP = [gas_brake_threshold, max(0., gas_brake_threshold), self.ACCEL_MAX]
self.EV_GAS_LOOKUP_BP_PLUS = [gas_brake_threshold, max(0., gas_brake_threshold), self.ACCEL_MAX_PLUS]
self.EV_GAS_LOOKUP_BP_PLUS = [gas_brake_threshold, max(0., gas_brake_threshold), get_max_allowed_accel(v_ego)]
self.EV_BRAKE_LOOKUP_BP = [self.ACCEL_MIN, gas_brake_threshold]
self.GAS_LOOKUP_BP_PLUS = [self.max_regen_acceleration, 0., get_max_allowed_accel(v_ego)]
@dataclass
class GMCarDocs(CarDocs):

View File

@ -10,6 +10,8 @@ from openpilot.selfdrive.car.honda.values import CruiseButtons, VISUAL_HUD, HOND
from openpilot.selfdrive.car.interfaces import CarControllerBase
from openpilot.selfdrive.controls.lib.drive_helpers import rate_limit
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import get_max_allowed_accel
VisualAlert = car.CarControl.HUDControl.VisualAlert
LongCtrlState = car.CarControl.Actuators.LongControlState
@ -217,7 +219,7 @@ class CarController(CarControllerBase):
if self.CP.carFingerprint in HONDA_BOSCH:
if frogpilot_toggles.sport_plus:
self.accel = clip(accel, self.params.BOSCH_ACCEL_MIN, self.params.BOSCH_ACCEL_MAX_PLUS)
self.accel = clip(accel, self.params.BOSCH_ACCEL_MIN, get_max_allowed_accel(CS.out.vEgo))
else:
self.accel = clip(accel, self.params.BOSCH_ACCEL_MIN, self.params.BOSCH_ACCEL_MAX)
self.gas = interp(accel, self.params.BOSCH_GAS_LOOKUP_BP, self.params.BOSCH_GAS_LOOKUP_V)

View File

@ -10,6 +10,8 @@ from openpilot.selfdrive.car import create_button_events, get_safety_config
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
from openpilot.selfdrive.car.disable_ecu import disable_ecu
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import get_max_allowed_accel
ButtonType = car.CarState.ButtonEvent.Type
FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
@ -25,12 +27,12 @@ class CarInterface(CarInterfaceBase):
def get_pid_accel_limits(CP, current_speed, cruise_speed, frogpilot_toggles):
if CP.carFingerprint in HONDA_BOSCH:
if frogpilot_toggles.sport_plus:
return CarControllerParams.BOSCH_ACCEL_MIN, CarControllerParams.BOSCH_ACCEL_MAX_PLUS
return CarControllerParams.BOSCH_ACCEL_MIN, get_max_allowed_accel(current_speed)
else:
return CarControllerParams.BOSCH_ACCEL_MIN, CarControllerParams.BOSCH_ACCEL_MAX
elif CP.enableGasInterceptor:
if frogpilot_toggles.sport_plus:
return CarControllerParams.NIDEC_ACCEL_MIN, CarControllerParams.NIDEC_ACCEL_MAX_PLUS
return CarControllerParams.NIDEC_ACCEL_MIN, get_max_allowed_accel(current_speed)
else:
return CarControllerParams.NIDEC_ACCEL_MIN, CarControllerParams.NIDEC_ACCEL_MAX
else:

View File

@ -20,7 +20,6 @@ class CarControllerParams:
# -3.5 m/s^2 as per planner limits
NIDEC_ACCEL_MIN = -4.0 # m/s^2
NIDEC_ACCEL_MAX = 1.6 # m/s^2, lower than 2.0 m/s^2 for tuning reasons
NIDEC_ACCEL_MAX_PLUS = 4.0 # m/s^2
NIDEC_ACCEL_LOOKUP_BP = [-1., 0., .6]
NIDEC_ACCEL_LOOKUP_V = [-4.8, 0., 2.0]
@ -33,7 +32,6 @@ class CarControllerParams:
BOSCH_ACCEL_MIN = -3.5 # m/s^2
BOSCH_ACCEL_MAX = 2.0 # m/s^2
BOSCH_ACCEL_MAX_PLUS = 4.0 # m/s^2
BOSCH_GAS_LOOKUP_BP = [-0.2, 2.0] # 2m/s^2
BOSCH_GAS_LOOKUP_V = [0, 1600]

View File

@ -9,6 +9,8 @@ from openpilot.selfdrive.car.hyundai.hyundaicanfd import CanBus
from openpilot.selfdrive.car.hyundai.values import HyundaiFlags, Buttons, CarControllerParams, CANFD_CAR, CAR
from openpilot.selfdrive.car.interfaces import CarControllerBase
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import get_max_allowed_accel
VisualAlert = car.CarControl.HUDControl.VisualAlert
LongCtrlState = car.CarControl.Actuators.LongControlState
@ -80,7 +82,7 @@ class CarController(CarControllerBase):
# accel + longitudinal
if frogpilot_toggles.sport_plus:
accel = clip(actuators.accel, CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX_PLUS)
accel = clip(actuators.accel, CarControllerParams.ACCEL_MIN, get_max_allowed_accel(CS.out.vEgo))
else:
accel = clip(actuators.accel, CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX)
stopping = actuators.longControlState == LongCtrlState.stopping

View File

@ -15,7 +15,6 @@ Ecu = car.CarParams.Ecu
class CarControllerParams:
ACCEL_MIN = -3.5 # m/s
ACCEL_MAX = 2.0 # m/s
ACCEL_MAX_PLUS = 4.0 # m/s
def __init__(self, CP):
self.STEER_DELTA_UP = 3

View File

@ -22,6 +22,8 @@ from openpilot.selfdrive.controls.lib.drive_helpers import CRUISE_LONG_PRESS, V_
from openpilot.selfdrive.controls.lib.events import Events
from openpilot.selfdrive.controls.lib.vehicle_model import VehicleModel
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import get_max_allowed_accel
ButtonType = car.CarState.ButtonEvent.Type
FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
GearShifter = car.CarState.GearShifter
@ -29,7 +31,6 @@ EventName = car.CarEvent.EventName
MAX_CTRL_SPEED = (V_CRUISE_MAX + 4) * CV.KPH_TO_MS
ACCEL_MAX = 2.0
ACCEL_MAX_PLUS = 4.0
ACCEL_MIN = -3.5
FRICTION_THRESHOLD = 0.3
@ -266,7 +267,7 @@ class CarInterfaceBase(ABC):
@staticmethod
def get_pid_accel_limits(CP, current_speed, cruise_speed, frogpilot_toggles):
if frogpilot_toggles.sport_plus:
return ACCEL_MIN, ACCEL_MAX_PLUS
return ACCEL_MIN, get_max_allowed_accel(current_speed)
else:
return ACCEL_MIN, ACCEL_MAX

View File

@ -6,9 +6,11 @@ from openpilot.selfdrive.car.interfaces import CarControllerBase
from openpilot.selfdrive.car.toyota import toyotacan
from openpilot.selfdrive.car.toyota.values import CAR, STATIC_DSU_MSGS, NO_STOP_TIMER_CAR, TSS2_CAR, \
MIN_ACC_SPEED, PEDAL_TRANSITION, CarControllerParams, ToyotaFlags, \
UNSUPPORTED_DSU_CAR, STOP_AND_GO_CAR, TSS2_CAR
UNSUPPORTED_DSU_CAR, STOP_AND_GO_CAR
from opendbc.can.packer import CANPacker
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import get_max_allowed_accel
LongCtrlState = car.CarControl.Actuators.LongControlState
SteerControlType = car.CarParams.SteerControlType
VisualAlert = car.CarControl.HUDControl.VisualAlert
@ -38,15 +40,6 @@ PARK = car.CarState.GearShifter.park
COMPENSATORY_CALCULATION_THRESHOLD_V = [-0.3, -0.25, 0.] # m/s^2
COMPENSATORY_CALCULATION_THRESHOLD_BP = [0., 11., 23.] # m/s
def compute_gb_toyota(accel, speed):
creep_brake = 0.0
creep_speed = 2.3
creep_brake_value = 0.15
if speed < creep_speed:
creep_brake = (creep_speed - speed) / creep_speed * creep_brake_value
gb = accel - creep_brake
return gb
class CarController(CarControllerBase):
def __init__(self, dbc_name, CP, VM):
self.CP = CP
@ -162,28 +155,27 @@ class CarController(CarControllerBase):
self.prohibit_neg_calculation = False
# limit minimum to only positive until first positive is reached after engagement, don't calculate when long isn't active
if CC.longActive and not self.prohibit_neg_calculation and (self.cydia_tune or self.frogs_go_moo_tune and self.CP.carFingerprint not in TSS2_CAR):
if CC.longActive and not self.prohibit_neg_calculation and self.cydia_tune:
accel_offset = CS.pcm_neutral_force / self.CP.mass
elif CC.longActive and self.frogs_go_moo_tune:
accel_offset = min(CS.pcm_neutral_force / self.CP.mass, 0.0)
if CS.out.cruiseState.standstill or actuators.longControlState == LongCtrlState.stopping:
self.pcm_accel_comp = 0.0
else:
self.pcm_accel_comp = clip(actuators.accel - CS.pcm_accel_net, self.pcm_accel_comp - 0.01, self.pcm_accel_comp + 0.01)
accel_offset += self.pcm_accel_comp
else:
accel_offset = 0.
if CC.longActive and self.frogs_go_moo_tune:
wind_brake = interp(CS.out.vEgo, [0.0, 2.3, 35.0], [0.001, 0.002, 0.15])
gas_accel = compute_gb_toyota(actuators.accel, CS.out.vEgo) + wind_brake
self.pcm_accel_comp = clip(gas_accel - CS.pcm_accel_net, self.pcm_accel_comp - 0.03, self.pcm_accel_comp + 0.03)
self.pcm_accel_comp = 0.0
# only calculate pcm_accel_cmd when long is active to prevent disengagement from accelerator depression
if CC.longActive:
if frogpilot_toggles.sport_plus:
if self.frogs_go_moo_tune:
pcm_accel_cmd = clip(gas_accel + self.pcm_accel_comp, self.params.ACCEL_MIN, self.params.ACCEL_MAX_PLUS)
else:
pcm_accel_cmd = clip(actuators.accel + accel_offset, self.params.ACCEL_MIN, self.params.ACCEL_MAX_PLUS)
pcm_accel_cmd = clip(actuators.accel + accel_offset, self.params.ACCEL_MIN, get_max_allowed_accel(CS.out.vEgo))
else:
if self.frogs_go_moo_tune:
pcm_accel_cmd = clip(gas_accel + self.pcm_accel_comp, self.params.ACCEL_MIN, self.params.ACCEL_MAX)
else:
pcm_accel_cmd = clip(actuators.accel + accel_offset, self.params.ACCEL_MIN, self.params.ACCEL_MAX)
pcm_accel_cmd = clip(actuators.accel + accel_offset, self.params.ACCEL_MIN, self.params.ACCEL_MAX)
else:
pcm_accel_cmd = 0.
@ -204,7 +196,7 @@ class CarController(CarControllerBase):
if (self.frame % 3 == 0 and self.CP.openpilotLongitudinalControl) or pcm_cancel_cmd:
lead = hud_control.leadVisible or CS.out.vEgo < 12. # at low speed we always assume the lead is present so ACC can be engaged
# when stopping, send -2.5 raw acceleration immediately to prevent vehicle from creeping, else send actuators.accel
accel_raw = -2.5 if stopping and self.cydia_tune else actuators.accel
accel_raw = -2.5 if stopping and (self.cydia_tune or self.frogs_go_moo_tune) else actuators.accel
# Press distance button until we are at the correct bar length. Only change while enabled to avoid skipping startup popup
if self.frame % 6 == 0 and self.CP.openpilotLongitudinalControl:

View File

@ -223,8 +223,7 @@ class CarState(CarStateBase):
if self.CP.carFingerprint != CAR.TOYOTA_PRIUS_V:
self.lkas_previously_enabled = self.lkas_enabled
message_keys = ["LDA_ON_MESSAGE", "SET_ME_X02"]
self.lkas_enabled = any(self.lkas_hud.get(key) == 1 for key in message_keys)
self.lkas_enabled = self.lkas_hud.get("LDA_ON_MESSAGE") == 1
self.pcm_accel_net = cp.vl["PCM_CRUISE"]["ACCEL_NET"]
self.pcm_neutral_force = cp.vl["PCM_CRUISE"]["NEUTRAL_FORCE"]

View File

@ -7,6 +7,8 @@ from openpilot.selfdrive.car import create_button_events, get_safety_config
from openpilot.selfdrive.car.disable_ecu import disable_ecu
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import get_max_allowed_accel
ButtonType = car.CarState.ButtonEvent.Type
FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
EventName = car.CarEvent.EventName
@ -17,7 +19,7 @@ class CarInterface(CarInterfaceBase):
@staticmethod
def get_pid_accel_limits(CP, current_speed, cruise_speed, frogpilot_toggles):
if frogpilot_toggles.sport_plus:
return CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX_PLUS
return CarControllerParams.ACCEL_MIN, get_max_allowed_accel(current_speed)
else:
return CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX
@ -136,21 +138,21 @@ class CarInterface(CarInterfaceBase):
ret.minEnableSpeed = -1. if (candidate in STOP_AND_GO_CAR or ret.enableGasInterceptor) else MIN_ACC_SPEED
tune = ret.longitudinalTuning
if params.get_bool("CydiaTune") or params.get_bool("FrogsGoMooTune"):
ret.stopAccel = -2.5 # on stock Toyota this is -2.5
ret.stoppingDecelRate = 0.3 # reach stopping target smoothly
if params.get_bool("CydiaTune"):
ret.stopAccel = -2.5 # on stock Toyota this is -2.5
ret.stoppingDecelRate = 0.3 # reach stopping target smoothly
if candidate in TSS2_CAR or ret.enableGasInterceptor:
tune.kpV = [0.0]
tune.kiV = [0.5]
if params.get_bool("FrogsGoMooTune"):
ret.vEgoStopping = 0.15
ret.vEgoStarting = 0.15
else:
ret.vEgoStopping = 0.25
ret.vEgoStarting = 0.25
ret.vEgoStopping = 0.25
ret.vEgoStarting = 0.25
else:
tune.kpV = [0.0]
tune.kiV = [1.2] # appears to produce minimal oscillation on TSS-P
tune.kiV = [1.2] # appears to produce minimal oscillation on TSS-P
elif params.get_bool("FrogsGoMooTune"):
ret.stopAccel = -2.5 # on stock Toyota this is -2.5
ret.stoppingDecelRate = 0.1 # reach stopping target smoothly
ret.vEgoStarting = 0.15
ret.vEgoStopping = 0.15
tune.kiV = [1.0]
elif candidate in TSS2_CAR or ret.enableGasInterceptor:
tune.kpV = [0.0]
tune.kiV = [0.5]

View File

@ -17,7 +17,6 @@ PEDAL_TRANSITION = 10. * CV.MPH_TO_MS
class CarControllerParams:
ACCEL_MAX = 1.5 # m/s2, lower than allowed 2.0 m/s2 for tuning reasons
ACCEL_MAX_PLUS = 4.0 # m/s2
ACCEL_MIN = -3.5 # m/s2
STEER_STEP = 1

View File

@ -8,6 +8,8 @@ from openpilot.selfdrive.car.interfaces import CarControllerBase
from openpilot.selfdrive.car.volkswagen import mqbcan, pqcan
from openpilot.selfdrive.car.volkswagen.values import CANBUS, CarControllerParams, VolkswagenFlags
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import get_max_allowed_accel
VisualAlert = car.CarControl.HUDControl.VisualAlert
LongCtrlState = car.CarControl.Actuators.LongControlState
@ -81,7 +83,7 @@ class CarController(CarControllerBase):
if self.frame % self.CCP.ACC_CONTROL_STEP == 0 and self.CP.openpilotLongitudinalControl:
acc_control = self.CCS.acc_control_value(CS.out.cruiseState.available, CS.out.accFaulted, CC.longActive)
if frogpilot_toggles.sport_plus:
accel = clip(actuators.accel, self.CCP.ACCEL_MIN, self.CCP.ACCEL_MAX_PLUS) if CC.longActive else 0
accel = clip(actuators.accel, self.CCP.ACCEL_MIN, get_max_allowed_accel(CS.out.vEgo)) if CC.longActive else 0
else:
accel = clip(actuators.accel, self.CCP.ACCEL_MIN, self.CCP.ACCEL_MAX) if CC.longActive else 0
stopping = actuators.longControlState == LongCtrlState.stopping

View File

@ -37,7 +37,6 @@ class CarControllerParams:
DEFAULT_MIN_STEER_SPEED = 0.4 # m/s, newer EPS racks fault below this speed, don't show a low speed alert
ACCEL_MAX = 2.0 # 2.0 m/s max acceleration
ACCEL_MAX_PLUS = 4.0 # 4.0 m/s max acceleration
ACCEL_MIN = -3.5 # 3.5 m/s max deceleration
def __init__(self, CP):

View File

@ -1,13 +1,11 @@
#!/usr/bin/env python3
import os
import math
import random
import time
import threading
from typing import SupportsFloat
import cereal.messaging as messaging
import openpilot.system.sentry as sentry
from cereal import car, custom, log
from msgq.visionipc import VisionIpcClient, VisionStreamType
@ -22,7 +20,7 @@ from openpilot.common.swaglog import cloudlog
from openpilot.selfdrive.car.car_helpers import get_car_interface, get_startup_event
from openpilot.selfdrive.controls.lib.alertmanager import AlertManager, set_offroad_alert
from openpilot.selfdrive.controls.lib.drive_helpers import IMPERIAL_INCREMENT, VCruiseHelper, clip_curvature
from openpilot.selfdrive.controls.lib.drive_helpers import VCruiseHelper, clip_curvature
from openpilot.selfdrive.controls.lib.events import Events, ET
from openpilot.selfdrive.controls.lib.latcontrol import LatControl, MIN_LATERAL_CONTROL_SPEED
from openpilot.selfdrive.controls.lib.latcontrol_pid import LatControlPID
@ -33,8 +31,7 @@ from openpilot.selfdrive.controls.lib.vehicle_model import VehicleModel
from openpilot.system.hardware import HARDWARE
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import CRUISING_SPEED, FrogPilotVariables
from openpilot.selfdrive.frogpilot.controls.lib.speed_limit_controller import SpeedLimitController
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import FrogPilotVariables
SOFT_DISABLE_TIME = 3 # seconds
LDW_MIN_SPEED = 31 * CV.MPH_TO_MS
@ -55,7 +52,6 @@ LaneChangeDirection = log.LaneChangeDirection
EventName = car.CarEvent.EventName
ButtonType = car.CarState.ButtonEvent.Type
FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
GearShifter = car.CarState.GearShifter
SafetyModel = car.CarParams.SafetyModel
IGNORED_SAFETY_MODES = (SafetyModel.silent, SafetyModel.noOutput)
@ -68,7 +64,6 @@ ENABLED_STATES = (State.preEnabled, *ACTIVE_STATES)
class Controls:
def __init__(self, CI=None):
self.params = Params()
self.params_memory = Params("/dev/shm/params")
if CI is None:
cloudlog.info("controlsd is waiting for CarParams")
@ -186,40 +181,22 @@ class Controls:
# FrogPilot variables
self.frogpilot_toggles = FrogPilotVariables.toggles
FrogPilotVariables.update_frogpilot_params()
self.params_tracking = Params("/persist/tracking")
self.total_drives = self.params_tracking.get_int("FrogPilotDrives")
self.total_kilometers = self.params_tracking.get_float("FrogPilotKilometers")
self.total_minutes = self.params_tracking.get_float("FrogPilotMinutes")
self.params_memory = Params("/dev/shm/params")
self.always_on_lateral_active = False
self.drive_added = False
self.fcw_random_event_triggered = False
self.holiday_theme_alerted = False
self.no_entry_alert_played = False
self.fcw_event_triggered = False
self.no_entry_alert_triggered = False
self.onroad_distance_pressed = False
self.openpilot_crashed_triggered = False
self.previous_traffic_mode = False
self.random_event_triggered = False
self.resume_pressed = False
self.resume_previously_pressed = False
self.speed_check = False
self.speed_limit_changed = False
self.stopped_for_light = False
self.steer_saturated_event_triggered = False
self.update_toggles = False
self.use_old_long = self.CP.carName == "hyundai" and not self.params.get_bool("NewLongAPI")
self.use_old_long |= self.CP.carName == "gm" and not self.params.get_bool("NewLongAPIGM")
self.display_timer = 0
self.drive_distance = 0
self.drive_time = 0
self.max_acceleration = 0
self.previous_speed_limit = 0
self.previous_v_cruise = 0
self.random_event_timer = 0
self.speed_limit_timer = 0
def set_initial_state(self):
if REPLAY:
@ -421,11 +398,7 @@ class Controls:
planner_fcw = self.sm['longitudinalPlan'].fcw and self.enabled
if (planner_fcw or model_fcw) and not (self.CP.notCar and self.joystick_mode):
self.events.add(EventName.fcw)
self.fcw_random_event_triggered = not self.random_event_triggered
elif self.fcw_random_event_triggered and self.frogpilot_toggles.random_events:
self.events.add(EventName.yourFrogTriedToKillMe)
self.fcw_random_event_triggered = False
self.random_event_triggered = True
self.fcw_event_triggered = True
for m in messaging.drain_sock(self.log_sock, wait_for_one=False):
try:
@ -450,8 +423,8 @@ class Controls:
if self.sm['modelV2'].frameDropPerc > 20:
self.events.add(EventName.modeldLagging)
# Update FrogPilot events
self.update_frogpilot_events(CS, self.sm['frogpilotCarState'], self.sm['frogpilotPlan'])
# Add FrogPilot events
self.events.add_from_msg(self.sm['frogpilotPlan'].frogpilotEvents)
def data_sample(self):
"""Receive data from sockets"""
@ -502,7 +475,7 @@ class Controls:
def state_transition(self, CS):
"""Compute conditional state transitions and execute actions on state transitions"""
self.v_cruise_helper.update_v_cruise(CS, self.enabled, self.is_metric, self.speed_limit_changed, self.frogpilot_toggles)
self.v_cruise_helper.update_v_cruise(CS, self.enabled, self.is_metric, self.sm['frogpilotPlan'].speedLimitChanged, self.frogpilot_toggles)
# decrement the soft disable timer at every step, as it's reset on
# entrance in SOFT_DISABLING state
@ -582,8 +555,8 @@ class Controls:
# Check if openpilot is engaged and actuators are enabled
self.enabled = self.state in ENABLED_STATES
self.active = self.state in ACTIVE_STATES
if self.active or self.always_on_lateral_active:
self.active = self.state in ACTIVE_STATES or self.always_on_lateral_active
if self.active:
self.current_alert_types.append(ET.WARNING)
def state_control(self, CS):
@ -610,8 +583,8 @@ class Controls:
# Check which actuators can be enabled
standstill = CS.vEgo <= max(self.CP.minSteerSpeed, MIN_LATERAL_CONTROL_SPEED) or CS.standstill
CC.latActive = (self.active or self.always_on_lateral_active) and self.speed_check and not CS.steerFaultTemporary and not CS.steerFaultPermanent and \
(not standstill or self.joystick_mode)
CC.latActive = self.active and not CS.steerFaultTemporary and not CS.steerFaultPermanent and \
(not standstill or self.joystick_mode) and self.sm['frogpilotPlan'].lateralCheck
CC.longActive = self.enabled and not self.events.contains(ET.OVERRIDE_LONGITUDINAL) and self.CP.openpilotLongitudinalControl
actuators = CC.actuators
@ -688,18 +661,11 @@ class Controls:
turning = abs(lac_log.desiredLateralAccel) > 1.0
good_speed = CS.vEgo > 5
max_torque = abs(self.sm['carOutput'].actuatorsOutput.steer) > 0.99
if undershooting and turning and good_speed and max_torque and not self.random_event_triggered:
event_choices = [1, 2]
if self.sm.frame % (10000 // len(event_choices)) == 0 and self.frogpilot_toggles.random_events:
event_choice = random.choice(event_choices)
if event_choice == 1:
lac_log.active and self.events.add(EventName.firefoxSteerSaturated)
self.params_memory.put_int("CurrentRandomEvent", 1)
elif event_choice == 2:
lac_log.active and self.events.add(EventName.goatSteerSaturated)
self.random_event_triggered = True
else:
lac_log.active and self.events.add(EventName.goatSteerSaturated if self.frogpilot_toggles.goat_scream else EventName.steerSaturated)
if undershooting and turning and good_speed and max_torque:
lac_log.active and self.events.add(EventName.goatSteerSaturated if self.frogpilot_toggles.goat_scream else EventName.steerSaturated)
self.steer_saturated_event_triggered = True
else:
self.steer_saturated_event_triggered = False
elif lac_log.saturated:
# TODO probably should not use dpath_points but curvature
dpath_points = model_v2.position.y
@ -739,10 +705,37 @@ class Controls:
self.display_timer -= 1
FPCC = self.update_frogpilot_variables(CS, self.sm['frogpilotCarState'], self.sm['frogpilotPlan'])
FPCC = self.update_frogpilot_variables(CS)
return CC, lac_log, FPCC
def update_frogpilot_variables(self, CS):
self.always_on_lateral_active = self.sm['frogpilotPlan'].alwaysOnLateralActive and self.sm.all_checks(['frogpilotPlan'])
if self.frogpilot_toggles.conditional_experimental_mode:
self.experimental_mode = self.sm['frogpilotPlan'].experimentalMode
if any(be.pressed and be.type == FrogPilotButtonType.lkas for be in CS.buttonEvents):
if self.frogpilot_toggles.experimental_mode_via_lkas and self.enabled:
if self.frogpilot_toggles.conditional_experimental_mode:
conditional_status = self.params_memory.get_int("CEStatus")
override_value = 0 if conditional_status in {1, 2, 3, 4, 5, 6} else 3 if conditional_status >= 7 else 4
self.params_memory.put_int("CEStatus", override_value)
else:
self.experimental_mode = not self.experimental_mode
self.params.put_bool_nonblocking("ExperimentalMode", self.experimental_mode)
if self.sm.frame % 10 == 0 or self.resume_pressed:
self.resume_previously_pressed = self.resume_pressed
FPCC = custom.FrogPilotCarControl.new_message()
FPCC.alwaysOnLateralActive = self.always_on_lateral_active
FPCC.fcwEventTriggered = self.fcw_event_triggered
FPCC.noEntryEventTriggered = self.no_entry_alert_triggered
FPCC.resumePressed = self.resume_previously_pressed
FPCC.steerSaturatedEventTriggered = self.steer_saturated_event_triggered
return FPCC
def publish_logs(self, CS, start_time, CC, lac_log, FPCC):
"""Send actuators and hud commands to the car, send controlsstate and MPC logging"""
@ -922,8 +915,7 @@ class Controls:
def params_thread(self, evt):
while not evt.is_set():
self.is_metric = self.params.get_bool("IsMetric")
if self.CP.openpilotLongitudinalControl and not self.frogpilot_toggles.conditional_experimental_mode:
self.experimental_mode = self.params.get_bool("ExperimentalMode") or self.frogpilot_toggles.speed_limit_controller and SpeedLimitController.experimental_mode
self.experimental_mode = self.params.get_bool("ExperimentalMode") and self.CP.openpilotLongitudinalControl
self.personality = self.read_personality_param()
if self.CP.notCar:
self.joystick_mode = self.params.get_bool("JoystickDebugMode")
@ -932,7 +924,7 @@ class Controls:
# Update FrogPilot parameters
if FrogPilotVariables.toggles_updated:
self.update_toggles = True
elif self.update_toggles or self.sm.frame * DT_CTRL < 1: # Force updates at first to check the current state of "Always On Lateral" and holiday theme
elif self.update_toggles:
FrogPilotVariables.update_frogpilot_params()
self.update_toggles = False
@ -948,197 +940,6 @@ class Controls:
e.set()
t.join()
def update_frogpilot_events(self, CS, frogpilotCarState, frogpilotPlan):
if frogpilotPlan.forcingStop:
self.events.add(EventName.forcingStop)
if self.frogpilot_toggles.green_light_alert and not self.sm['longitudinalPlan'].hasLead and CS.standstill:
if frogpilotPlan.greenLight and self.stopped_for_light:
self.events.add(EventName.greenLight)
self.stopped_for_light = frogpilotPlan.redLight
else:
self.stopped_for_light = False
if not self.holiday_theme_alerted and self.frogpilot_toggles.current_holiday_theme != 0 and self.sm.frame * DT_CTRL >= 10:
self.events.add(EventName.holidayActive)
self.holiday_theme_alerted = True
if frogpilotPlan.leadDeparting:
self.events.add(EventName.leadDeparting)
if not self.openpilot_crashed_triggered and os.path.isfile(os.path.join(sentry.CRASHES_DIR, 'error.txt')):
if self.frogpilot_toggles.random_events:
self.events.add(EventName.openpilotCrashedRandomEvent)
else:
self.events.add(EventName.openpilotCrashed)
self.openpilot_crashed_triggered = True
if self.frogpilot_toggles.random_events and not self.random_event_triggered:
acceleration = CS.aEgo
if not CS.gasPressed:
self.max_acceleration = max(acceleration, self.max_acceleration)
else:
self.max_acceleration = 0
if 3.5 > self.max_acceleration >= 3.0 and acceleration < 1.5:
self.events.add(EventName.accel30)
self.params_memory.put_int("CurrentRandomEvent", 2)
self.random_event_triggered = True
self.max_acceleration = 0
elif 4.0 > self.max_acceleration >= 3.5 and acceleration < 1.5:
self.events.add(EventName.accel35)
self.params_memory.put_int("CurrentRandomEvent", 3)
self.random_event_triggered = True
self.max_acceleration = 0
elif self.max_acceleration >= 4.0 and acceleration < 1.5:
self.events.add(EventName.accel40)
self.params_memory.put_int("CurrentRandomEvent", 4)
self.random_event_triggered = True
self.max_acceleration = 0
if frogpilotPlan.takingCurveQuickly:
self.events.add(EventName.dejaVuCurve)
self.params_memory.put_int("CurrentRandomEvent", 5)
self.random_event_triggered = True
if self.no_entry_alert_triggered and not self.no_entry_alert_played:
self.events.add(EventName.hal9000)
self.no_entry_alert_played = True
self.random_event_triggered = True
conversion = 1 if self.is_metric else IMPERIAL_INCREMENT
v_cruise = max(self.v_cruise_helper.v_cruise_kph, self.v_cruise_helper.v_cruise_cluster_kph) * conversion
if 70 > v_cruise >= 69 and v_cruise != self.previous_v_cruise:
self.events.add(EventName.vCruise69)
self.random_event_triggered = True
self.previous_v_cruise = v_cruise
if self.frogpilot_toggles.speed_limit_alert and self.speed_limit_changed:
self.events.add(EventName.speedLimitChanged)
if self.sm.frame * DT_CTRL == 5.5 and self.CP.lateralTuning.which() == "torque" and self.CI.use_nnff:
self.events.add(EventName.torqueNNLoad)
if frogpilotCarState.trafficModeActive != self.previous_traffic_mode:
if self.previous_traffic_mode:
self.events.add(EventName.trafficModeInactive)
else:
self.events.add(EventName.trafficModeActive)
self.previous_traffic_mode = frogpilotCarState.trafficModeActive
if self.sm['modelV2'].meta.turnDirection == Desire.turnLeft:
self.events.add(EventName.turningLeft)
elif self.sm['modelV2'].meta.turnDirection == Desire.turnRight:
self.events.add(EventName.turningRight)
def update_frogpilot_variables(self, CS, frogpilotCarState, frogpilotPlan):
driving_gear = CS.gearShifter not in (GearShifter.neutral, GearShifter.park, GearShifter.reverse, GearShifter.unknown)
self.always_on_lateral_active |= self.frogpilot_toggles.always_on_lateral_main or CS.cruiseState.enabled
self.always_on_lateral_active &= self.frogpilot_toggles.always_on_lateral and CS.cruiseState.available
self.always_on_lateral_active &= driving_gear
self.always_on_lateral_active &= self.speed_check
self.always_on_lateral_active &= not (self.frogpilot_toggles.always_on_lateral_lkas and frogpilotCarState.alwaysOnLateralDisabled)
self.always_on_lateral_active &= not (CS.brakePressed and CS.vEgo < self.frogpilot_toggles.always_on_lateral_pause_speed) or CS.standstill
self.drive_distance += CS.vEgo * DT_CTRL
self.drive_time += DT_CTRL
if self.drive_time > 60 and CS.standstill:
self.total_kilometers += self.drive_distance / 1000
self.params_tracking.put_float_nonblocking("FrogPilotKilometers", self.total_kilometers)
self.drive_distance = 0
self.total_minutes += self.drive_time / 60
self.params_tracking.put_float_nonblocking("FrogPilotMinutes", self.total_minutes)
self.drive_time = 0
if not self.drive_added and self.sm.frame * DT_CTRL > 60 * 15:
self.total_drives += 1
self.params_tracking.put_int_nonblocking("FrogPilotDrives", self.total_drives)
self.drive_added = True
if self.frogpilot_toggles.conditional_experimental_mode:
self.experimental_mode = frogpilotPlan.conditionalExperimentalActive
if any(be.pressed and be.type == FrogPilotButtonType.lkas for be in CS.buttonEvents):
if self.frogpilot_toggles.experimental_mode_via_lkas and self.enabled:
if self.frogpilot_toggles.conditional_experimental_mode:
conditional_status = self.params_memory.get_int("CEStatus")
override_value = 0 if conditional_status in {1, 2, 3, 4, 5, 6} else 3 if conditional_status >= 7 else 4
self.params_memory.put_int("CEStatus", override_value)
else:
self.experimental_mode = not self.experimental_mode
self.params.put_bool_nonblocking("ExperimentalMode", self.experimental_mode)
if self.random_event_triggered:
self.random_event_timer += DT_CTRL
if self.random_event_timer >= 4:
self.random_event_triggered = False
self.random_event_timer = 0
self.params_memory.remove("CurrentRandomEvent")
if self.sm.frame % 10 == 0 or self.resume_pressed:
self.resume_previously_pressed = self.resume_pressed
self.speed_check = CS.vEgo >= self.frogpilot_toggles.pause_lateral_below_speed
self.speed_check |= self.frogpilot_toggles.pause_lateral_below_signal and not (CS.leftBlinker or CS.rightBlinker)
self.speed_check |= CS.standstill
if self.frogpilot_toggles.speed_limit_confirmation:
current_speed_limit = frogpilotPlan.slcSpeedLimit
desired_speed_limit = frogpilotPlan.unconfirmedSlcSpeedLimit
limit_changed = desired_speed_limit != self.previous_speed_limit and abs(current_speed_limit - desired_speed_limit) > 1
speed_limit_decreased = limit_changed and self.previous_speed_limit > desired_speed_limit
speed_limit_increased = limit_changed and self.previous_speed_limit < desired_speed_limit
self.previous_speed_limit = desired_speed_limit
if self.CP.pcmCruise and self.speed_limit_changed:
if self.resume_pressed:
self.params_memory.put_bool("SLCConfirmed", True)
self.params_memory.put_bool("SLCConfirmedPressed", True)
elif any(be.type == ButtonType.decelCruise for be in CS.buttonEvents):
self.params_memory.put_bool("SLCConfirmed", False)
self.params_memory.put_bool("SLCConfirmedPressed", True)
if speed_limit_decreased:
if self.frogpilot_toggles.speed_limit_confirmation_lower:
self.speed_limit_changed = True
else:
self.params_memory.put_bool("SLCConfirmed", True)
elif speed_limit_increased:
if self.frogpilot_toggles.speed_limit_confirmation_higher:
self.speed_limit_changed = True
else:
self.params_memory.put_bool("SLCConfirmed", True)
if self.params_memory.get_bool("SLCConfirmedPressed") or not abs(current_speed_limit - desired_speed_limit) > 1:
self.speed_limit_changed = False
self.params_memory.put_bool("SLCConfirmedPressed", False)
if self.speed_limit_changed:
self.speed_limit_timer += DT_CTRL
if self.speed_limit_timer >= 10:
self.speed_limit_changed = False
self.speed_limit_timer = 0
else:
self.speed_limit_timer = 0
else:
self.speed_limit_changed = False
FPCC = custom.FrogPilotCarControl.new_message()
FPCC.alwaysOnLateral = self.always_on_lateral_active
FPCC.resumePressed = self.resume_pressed or self.resume_previously_pressed
FPCC.speedLimitChanged = self.speed_limit_changed
return FPCC
def main():
config_realtime_process(4, Priority.CTRL_HIGH)

View File

@ -46,9 +46,6 @@ 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
@ -96,16 +93,9 @@ class VCruiseHelper:
if button_type is None:
return
# Confirm or deny the new speed limit value
# Don't adjust speed when pressing to confirm/deny speed limits
if speed_limit_changed:
if button_type == ButtonType.accelCruise:
self.params_memory.put_bool("SLCConfirmed", True)
self.params_memory.put_bool("SLCConfirmedPressed", True)
return
elif button_type == ButtonType.decelCruise:
self.params_memory.put_bool("SLCConfirmed", False)
self.params_memory.put_bool("SLCConfirmedPressed", True)
return
return
# Don't adjust speed when pressing resume to exit standstill
cruise_standstill = self.button_change_states[button_type]["standstill"] or CS.cruiseState.standstill

View File

@ -13,9 +13,6 @@ 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
@ -229,11 +226,13 @@ def user_soft_disable_alert(alert_text_2: str) -> AlertCallbackType:
return func
def startup_master_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int) -> Alert:
params = Params()
branch = get_short_branch() # Ensure get_short_branch is cached to avoid lags on startup
if "REPLAY" in os.environ:
branch = "replay"
return StartupAlert("Hippity hoppity this is my property", "so I do what I want 🐸", alert_status=AlertStatus.frogpilot)
return StartupAlert(params.get("StartupMessageTop", encoding='utf-8'), params.get("StartupMessageBottom", encoding='utf-8'), alert_status=AlertStatus.frogpilot)
def below_engage_speed_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int) -> Alert:
return NoEntryAlert(f"Drive above {get_display_speed(CP.minEnableSpeed, metric)} to engage")
@ -257,7 +256,7 @@ def calibration_incomplete_alert(CP: car.CarParams, CS: car.CarState, sm: messag
def torque_nn_load_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int) -> Alert:
model_name = params.get("NNFFModelName", encoding='utf-8')
model_name = Params().get("NNFFModelName", encoding='utf-8')
if model_name == "":
return Alert(
"NNFF Torque Controller not available",
@ -348,21 +347,21 @@ def joystick_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster,
# FrogPilot Alerts
def holiday_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int) -> Alert:
holiday_messages = {
1: ("Happy April Fool's Day! 🤡", "aprilFoolsAlert"),
2: ("Merry Christmas! 🎄", "christmasAlert"),
3: ("¡Feliz Cinco de Mayo! 🌮", "cincoDeMayoAlert"),
4: ("Happy Easter! 🐰", "easterAlert"),
5: ("Happy Fourth of July! 🎆", "fourthOfJulyAlert"),
6: ("Happy Halloween! 🎃", "halloweenAlert"),
7: ("Happy New Year! 🎉", "newYearsDayAlert"),
8: ("Happy St. Patrick's Day! 🍀", "stPatricksDayAlert"),
9: ("Happy Thanksgiving! 🦃", "thanksgivingAlert"),
10: ("Happy Valentine's Day! ❤️", "valentinesDayAlert"),
11: ("Happy World Frog Day! 🐸", "worldFrogDayAlert"),
"new_years": ("Happy New Year! 🎉", "newYearsDayAlert"),
"valentines": ("Happy Valentine's Day! ❤️", "valentinesDayAlert"),
"st_patricks": ("Happy St. Patrick's Day! 🍀", "stPatricksDayAlert"),
"world_frog_day": ("Happy World Frog Day! 🐸", "worldFrogDayAlert"),
"april_fools": ("Happy April Fool's Day! 🤡", "aprilFoolsAlert"),
"easter_week": ("Happy Easter! 🐰", "easterAlert"),
"cinco_de_mayo": ("¡Feliz Cinco de Mayo! 🌮", "cincoDeMayoAlert"),
"fourth_of_july": ("Happy Fourth of July! 🎆", "fourthOfJulyAlert"),
"halloween_week": ("Happy Halloween! 🎃", "halloweenAlert"),
"thanksgiving_week": ("Happy Thanksgiving! 🦃", "thanksgivingAlert"),
"christmas_week": ("Merry Christmas! 🎄", "christmasAlert")
}
theme_id = params_memory.get_int("CurrentHolidayTheme")
message, alert_type = holiday_messages.get(theme_id, ("", ""))
holiday_name = Params().get("CurrentHolidayTheme", encoding='utf-8')
message, alert_type = holiday_messages.get(holiday_name, ("", ""))
return Alert(
message,

View File

@ -115,6 +115,9 @@ class LongControl:
if output_accel > self.CP.stopAccel:
output_accel = min(output_accel, 0.0)
output_accel -= self.CP.stoppingDecelRate * DT_CTRL
elif output_accel < self.CP.stopAccel:
output_accel = min(output_accel, 0.0)
output_accel += self.CP.stoppingDecelRate * DT_CTRL
self.reset()
elif self.long_control_state == LongCtrlState.starting:

View File

@ -299,7 +299,7 @@ class LongitudinalMpc:
for i in range(N):
self.solver.cost_set(i, 'Zl', Zl)
def set_weights(self, acceleration_jerk=1.0, danger_jerk = 1.0, speed_jerk=1.0, prev_accel_constraint=True, personality=log.LongitudinalPersonality.standard):
def set_weights(self, acceleration_jerk=1.0, danger_jerk=1.0, speed_jerk=1.0, prev_accel_constraint=True, personality=log.LongitudinalPersonality.standard):
if self.mode == 'acc':
a_change_cost = acceleration_jerk if prev_accel_constraint else 0
cost_weights = [X_EGO_OBSTACLE_COST, X_EGO_COST, V_EGO_COST, A_EGO_COST, a_change_cost, speed_jerk]

View File

@ -174,10 +174,8 @@ class LongitudinalPlanner:
return x, v, a, j
def update(self, sm, frogpilot_toggles):
self.secret_good_openpilot = frogpilot_toggles.secretgoodopenpilot_model
self.mpc.mode = 'blended' if sm['controlsState'].experimentalMode else 'acc'
def update(self, clairvoyant_model, e2e_longitudinal_model, sm, frogpilot_toggles):
self.mpc.mode = 'blended' if sm['controlsState'].experimentalMode and not clairvoyant_model else 'acc'
v_ego = sm['carState'].vEgo
v_cruise_kph = min(sm['controlsState'].vCruise, V_CRUISE_MAX)
@ -206,7 +204,7 @@ class LongitudinalPlanner:
# Prevent divergence, smooth in current v_ego
self.v_desired_filter.x = max(0.0, self.v_desired_filter.update(v_ego))
# Compute model v_ego error
self.v_model_error = 0. if self.secret_good_openpilot else get_speed_error(sm['modelV2'], v_ego)
self.v_model_error = 0.0 if e2e_longitudinal_model else get_speed_error(sm['modelV2'], v_ego)
if force_slow_decel:
v_cruise = 0.0
@ -250,7 +248,7 @@ class LongitudinalPlanner:
self.a_desired = float(interp(self.dt, CONTROL_N_T_IDX, self.a_desired_trajectory))
self.v_desired_filter.x = self.v_desired_filter.x + self.dt * (self.a_desired + a_prev) / 2.0
def publish(self, sm, pm):
def publish(self, e2e_longitudinal_model, sm, pm):
plan_send = messaging.new_message('longitudinalPlan')
plan_send.valid = sm.all_checks(service_list=['carState', 'controlsState'])
@ -272,15 +270,21 @@ class LongitudinalPlanner:
longitudinalPlan.longitudinalPlanSource = self.mpc.source
longitudinalPlan.fcw = self.fcw
a_target, should_stop = get_accel_from_plan(self.CP, longitudinalPlan.speeds, longitudinalPlan.accels)
if self.secret_good_openpilot and sm['controlsState'].experimentalMode:
a_target_mpc, should_stop_mpc = get_accel_from_plan(self.CP, longitudinalPlan.speeds, longitudinalPlan.accels)
if e2e_longitudinal_model and sm['controlsState'].experimentalMode:
model_speeds = np.interp(CONTROL_N_T_IDX, ModelConstants.T_IDXS, sm['modelV2'].velocity.x)
model_accels = np.interp(CONTROL_N_T_IDX, ModelConstants.T_IDXS, sm['modelV2'].acceleration.x)
a_target_model, should_stop_model = get_accel_from_plan(self.CP, model_speeds, model_accels)
a_target = min(a_target, a_target_model)
should_stop |= should_stop_model
a_target = min(a_target_mpc, a_target_model)
should_stop = should_stop_mpc or should_stop_model
else:
a_target = a_target_mpc
should_stop = should_stop_mpc
longitudinalPlan.aTarget = float(a_target)
longitudinalPlan.shouldStop = bool(should_stop)
longitudinalPlan.allowBrake = True
longitudinalPlan.allowThrottle = True

View File

@ -35,14 +35,18 @@ def plannerd_thread():
# FrogPilot variables
frogpilot_toggles = FrogPilotVariables.toggles
FrogPilotVariables.update_frogpilot_params()
clairvoyant_model = frogpilot_toggles.clairvoyant_model
e2e_longitudinal_model = clairvoyant_model or frogpilot_toggles.secretgoodopenpilot_model
update_toggles = False
while True:
sm.update()
if sm.updated['modelV2']:
longitudinal_planner.update(sm, frogpilot_toggles)
longitudinal_planner.publish(sm, pm)
longitudinal_planner.update(clairvoyant_model, e2e_longitudinal_model, sm, frogpilot_toggles)
longitudinal_planner.publish(e2e_longitudinal_model, sm, pm)
publish_ui_plan(sm, pm, longitudinal_planner)
# Update FrogPilot parameters

View File

@ -214,8 +214,9 @@ class RadarD:
# FrogPilot variables
self.frogpilot_toggles = FrogPilotVariables.toggles
FrogPilotVariables.update_frogpilot_params()
self.secret_good_openpilot = self.frogpilot_toggles.secretgoodopenpilot_model
self.e2e_longitudinal_model = self.frogpilot_toggles.clairvoyant_model or self.frogpilot_toggles.secretgoodopenpilot_model
self.update_toggles = False
def update(self, sm: messaging.SubMaster, rr):
@ -261,7 +262,7 @@ class RadarD:
self.radar_state.radarErrors = list(radar_errors)
self.radar_state.carStateMonoTime = sm.logMonoTime['carState']
if len(sm['modelV2'].temporalPose.trans) and not self.secret_good_openpilot:
if len(sm['modelV2'].temporalPose.trans) and not self.e2e_longitudinal_model:
model_v_ego = sm['modelV2'].temporalPose.trans[0]
else:
model_v_ego = self.v_ego
@ -340,20 +341,20 @@ def main():
# *** setup messaging
can_sock = messaging.sub_sock('can')
pub_sock = messaging.pub_sock('liveTracks')
RI = RadarInterface(CP)
# TODO timing is different between cars, need a single time step for all cars
# TODO just take the fastest one for now, and keep resending same messages for slower radars
rk = Ratekeeper(1.0 / CP.radarTimeStep, print_delay_threshold=None)
RD = RadarD(CP.radarTimeStep, RI.delay)
if not FrogPilotVariables.toggles.radarless_model:
# FrogPilot variables
frogpilot_toggles = FrogPilotVariables.toggles
FrogPilotVariables.update_frogpilot_params()
if not frogpilot_toggles.radarless_model:
sm = messaging.SubMaster(['modelV2', 'carState'], frequency=int(1./DT_CTRL))
pm = messaging.PubMaster(['radarState', 'liveTracks'])
while True:
while 1:
can_strings = messaging.drain_sock_raw(can_sock, wait_for_one=True)
rr = RI.update(can_strings)
sm.update(0)
@ -364,7 +365,8 @@ def main():
RD.publish(pm, -rk.remaining*1000.0)
rk.monitor_time()
else:
while True:
pub_sock = messaging.pub_sock('liveTracks')
while 1:
can_strings = messaging.drain_sock_raw(can_sock, wait_for_one=True)
rr = RI.update(can_strings)
if rr is None:

View File

@ -0,0 +1,50 @@
{
"LaneLines": {
"red": 23,
"green": 134,
"blue": 68,
"alpha": 242
},
"LeadMarker": {
"red": 23,
"green": 134,
"blue": 68,
"alpha": 242
},
"Path": {
"red": 23,
"green": 134,
"blue": 68,
"alpha": 242
},
"PathEdge": {
"red": 18,
"green": 107,
"blue": 54,
"alpha": 242
},
"RoadEdges": {
"red": 23,
"green": 134,
"blue": 68,
"alpha": 242
},
"Sidebar1": {
"red": 23,
"green": 134,
"blue": 68,
"alpha": 242
},
"Sidebar2": {
"red": 23,
"green": 134,
"blue": 68,
"alpha": 242
},
"Sidebar3": {
"red": 23,
"green": 134,
"blue": 68,
"alpha": 242
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View File

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

Some files were not shown because too many files have changed in this diff Show More