Skip to content

Commit

Permalink
Try yanking calc_accel_override to fix slow restart
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamezz committed Apr 3, 2019
1 parent 1065d69 commit 2c6669d
Showing 1 changed file with 1 addition and 29 deletions.
30 changes: 1 addition & 29 deletions selfdrive/car/gm/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,35 +58,7 @@ def compute_gb(accel, speed):

@staticmethod
def calc_accel_override(a_ego, a_target, v_ego, v_target):

# normalized max accel. Allowing max accel at low speed causes speed overshoots
max_accel_bp = [10, 20] # m/s
max_accel_v = [0.714, 1.0] # unit of max accel
max_accel = interp(v_ego, max_accel_bp, max_accel_v)

# limit the pcm accel cmd if:
# - v_ego exceeds v_target, or
# - a_ego exceeds a_target and v_ego is close to v_target

eA = a_ego - a_target
valuesA = [1.0, 0.1]
bpA = [0.3, 1.1]

eV = v_ego - v_target
valuesV = [1.0, 0.1]
bpV = [0.0, 0.5]

valuesRangeV = [1., 0.]
bpRangeV = [-1., 0.]

# only limit if v_ego is close to v_target
speedLimiter = interp(eV, bpV, valuesV)
accelLimiter = max(interp(eA, bpA, valuesA), interp(eV, bpRangeV, valuesRangeV))

# 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 1.0

@staticmethod
def get_params(candidate, fingerprint):
Expand Down

0 comments on commit 2c6669d

Please sign in to comment.