Controls - Longitudinal Tuning - Deceleration Profile

Change the deceleration rate to be either sporty or eco-friendly.
This commit is contained in:
FrogAi
2024-05-24 02:43:03 -07:00
parent 068a484089
commit 7696618573
@@ -18,6 +18,8 @@ from openpilot.selfdrive.frogpilot.controls.lib.conditional_experimental_mode im
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_functions import calculate_lane_width, calculate_road_curvature
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import CITY_SPEED_LIMIT, CRUISING_SPEED, TRAJECTORY_SIZE
A_CRUISE_MIN_ECO = A_CRUISE_MIN / 5
A_CRUISE_MIN_SPORT = A_CRUISE_MIN / 2
# MPH = [ 0., 11, 22, 34, 45, 56, 89]
A_CRUISE_MAX_BP_CUSTOM = [ 0., 5., 10., 15., 20., 25., 40.]
A_CRUISE_MAX_VALS_ECO = [1.4, 1.2, 1.0, 0.8, 0.6, 0.4, 0.2]
@@ -94,6 +96,10 @@ class FrogPilotPlanner:
if controlsState.experimentalMode:
self.min_accel = ACCEL_MIN
elif frogpilot_toggles.deceleration_profile == 1:
self.min_accel = A_CRUISE_MIN_ECO
elif frogpilot_toggles.deceleration_profile == 2:
self.min_accel = A_CRUISE_MIN_SPORT
else:
self.min_accel = A_CRUISE_MIN