mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-02 12:02:09 +08:00
less accel (#21565)
* less accel * new refs * Update longitudinal_planner.py * update refs old-commit-hash: a42d8f3a14132c3c0826ed106d61a617ce41936e
This commit is contained in:
@@ -8,7 +8,7 @@ from selfdrive.config import Conversions as CV
|
||||
from selfdrive.car.honda.values import CruiseButtons, CAR, HONDA_BOSCH, HONDA_BOSCH_ALT_BRAKE_SIGNAL
|
||||
from selfdrive.car.honda.hondacan import disable_radar
|
||||
from selfdrive.car import STD_CARGO_KG, CivicParams, scale_rot_inertia, scale_tire_stiffness, gen_empty_fingerprint
|
||||
from selfdrive.controls.lib.longitudinal_planner import A_CRUISE_MAX as A_ACC_MAX
|
||||
from selfdrive.controls.lib.longitudinal_planner import A_CRUISE_MAX_VALS
|
||||
from selfdrive.car.interfaces import CarInterfaceBase
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ class CarInterface(CarInterfaceBase):
|
||||
# accelOverride is more or less the max throttle allowed to pcm: usually set to a constant
|
||||
# unless aTargetMax is very high and then we scale with it; this help in quicker restart
|
||||
|
||||
return float(max(max_accel, a_target / A_ACC_MAX)) * min(speedLimiter, accelLimiter)
|
||||
return float(max(max_accel, a_target / A_CRUISE_MAX_VALS[0])) * min(speedLimiter, accelLimiter)
|
||||
|
||||
@staticmethod
|
||||
def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[]): # pylint: disable=dangerous-default-value
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
from cereal import car
|
||||
from selfdrive.car import dbc_dict
|
||||
from selfdrive.config import Conversions as CV
|
||||
from selfdrive.controls.lib.longitudinal_planner import A_CRUISE_MAX_VALS
|
||||
|
||||
Ecu = car.CarParams.Ecu
|
||||
MIN_ACC_SPEED = 19. * CV.MPH_TO_MS
|
||||
@@ -10,7 +11,7 @@ PEDAL_HYST_GAP = 3. * CV.MPH_TO_MS
|
||||
|
||||
class CarControllerParams:
|
||||
ACCEL_HYST_GAP = 0.02 # don't change accel command for small oscilalitons within this value
|
||||
ACCEL_MAX = 1.5 # 1.5 m/s2
|
||||
ACCEL_MAX = A_CRUISE_MAX_VALS[0]
|
||||
ACCEL_MIN = -3.0 # 3 m/s2
|
||||
ACCEL_SCALE = max(ACCEL_MAX, -ACCEL_MIN)
|
||||
|
||||
|
||||
@@ -19,13 +19,18 @@ from selfdrive.swaglog import cloudlog
|
||||
LON_MPC_STEP = 0.2 # first step is 0.2s
|
||||
AWARENESS_DECEL = -0.2 # car smoothly decel at .2m/s^2 when user is distracted
|
||||
A_CRUISE_MIN = -1.2
|
||||
A_CRUISE_MAX = 1.2
|
||||
A_CRUISE_MAX_VALS = [1.2, 1.2, 0.8]
|
||||
A_CRUISE_MAX_BP = [0., 15., 40.]
|
||||
|
||||
# Lookup table for turns
|
||||
_A_TOTAL_MAX_V = [1.7, 3.2]
|
||||
_A_TOTAL_MAX_BP = [20., 40.]
|
||||
|
||||
|
||||
def get_max_accel(v_ego):
|
||||
return interp(v_ego, A_CRUISE_MAX_BP, A_CRUISE_MAX_VALS)
|
||||
|
||||
|
||||
def limit_accel_in_turns(v_ego, angle_steers, a_target, CP):
|
||||
"""
|
||||
This function returns a limited long acceleration allowed, depending on the existing lateral acceleration
|
||||
@@ -85,7 +90,7 @@ class Planner():
|
||||
self.v_desired = self.alpha * self.v_desired + (1 - self.alpha) * v_ego
|
||||
self.v_desired = max(0.0, self.v_desired)
|
||||
|
||||
accel_limits = [A_CRUISE_MIN, A_CRUISE_MAX]
|
||||
accel_limits = [A_CRUISE_MIN, get_max_accel(v_ego)]
|
||||
accel_limits_turns = limit_accel_in_turns(v_ego, sm['carState'].steeringAngleDeg, accel_limits, self.CP)
|
||||
if force_slow_decel:
|
||||
# if required so, force a smooth deceleration
|
||||
|
||||
@@ -1 +1 @@
|
||||
c59e46e21147ee1dc44b7fe2b5d1e4a16842c6c5
|
||||
9837021bf19bf6cddd6ef737564158b05c7333ed
|
||||
Reference in New Issue
Block a user