curve speed and paddle commands
This commit is contained in:
@@ -178,7 +178,7 @@ class CarController(CarControllerBase):
|
||||
else:
|
||||
small_cmd_scale = np.interp(abs(accel), [0.0, 0.35, 0.8, 1.5, 2.5], [0.44, 0.54, 0.70, 0.89, 1.0])
|
||||
accel_cmd = accel * small_cmd_scale
|
||||
if accel < -2.0:
|
||||
if (not press_regen_paddle) and accel < -2.0:
|
||||
accel_cmd *= np.interp(abs(accel), [2.0, 2.5, 3.0], [1.0, 1.03, 1.06])
|
||||
raw_pedal_gas = float(np.clip(pedaloffset + accel_cmd * accel_gain * accel_term_scale, 0.0, 1.0))
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#!/usr/bin/env python3
|
||||
import numpy as np
|
||||
|
||||
from openpilot.common.constants import CV
|
||||
from openpilot.common.realtime import DT_MDL
|
||||
|
||||
from openpilot.starpilot.common.starpilot_variables import CRUISING_SPEED, DEFAULT_LATERAL_ACCELERATION, PLANNER_TIME
|
||||
from openpilot.starpilot.common.starpilot_variables import CITY_SPEED_LIMIT, CRUISING_SPEED, DEFAULT_LATERAL_ACCELERATION, PLANNER_TIME
|
||||
|
||||
CALIBRATION_PROGRESS_THRESHOLD = 10 / DT_MDL
|
||||
CSC_MIN_SPEED = CITY_SPEED_LIMIT * CV.MPH_TO_MS
|
||||
MAX_CURVATURE = 0.1
|
||||
MIN_CURVATURE = 0.001
|
||||
PERCENTILE = 90
|
||||
@@ -97,7 +99,7 @@ class CurveSpeedController:
|
||||
decel_rate = (v_ego - csc_speed) / self.starpilot_planner.time_to_curve
|
||||
|
||||
self.target -= decel_rate * DT_MDL
|
||||
self.target = float(np.clip(self.target, CRUISING_SPEED, csc_speed))
|
||||
self.target = float(np.clip(self.target, CSC_MIN_SPEED, csc_speed))
|
||||
else:
|
||||
self.target_set = True
|
||||
self.target = v_ego
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
from openpilot.common.constants import CV
|
||||
from openpilot.common.realtime import DT_MDL
|
||||
|
||||
from openpilot.starpilot.common.starpilot_variables import CRUISING_SPEED, PLANNER_TIME
|
||||
from openpilot.starpilot.common.starpilot_variables import CITY_SPEED_LIMIT, CRUISING_SPEED, PLANNER_TIME
|
||||
from openpilot.starpilot.controls.lib.curve_speed_controller import CurveSpeedController
|
||||
from openpilot.starpilot.controls.lib.speed_limit_controller import SpeedLimitController
|
||||
|
||||
CSC_MIN_SPEED = CITY_SPEED_LIMIT * CV.MPH_TO_MS
|
||||
OVERRIDE_FORCE_STOP_TIMER = 10
|
||||
|
||||
|
||||
@@ -94,6 +95,6 @@ class StarPilotVCruise:
|
||||
targets = [self.csc_target, v_cruise]
|
||||
if starpilot_toggles.speed_limit_controller:
|
||||
targets.append(max(self.slc.overridden_speed, self.slc_target + self.slc_offset) - v_ego_diff)
|
||||
v_cruise = min([target if target >= CRUISING_SPEED else v_cruise for target in targets])
|
||||
v_cruise = min([target if target >= CSC_MIN_SPEED else v_cruise for target in targets])
|
||||
|
||||
return v_cruise
|
||||
|
||||
Reference in New Issue
Block a user