mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-09-15 00:03:45 +08:00
fix accel_controller
This commit is contained in:
@@ -162,16 +162,19 @@ class LongitudinalPlanner(LongitudinalPlannerSP):
|
||||
if self.accel_controller.is_enabled:
|
||||
# get min, max from accel controller
|
||||
min_limit, max_limit = self.accel_controller.get_accel_limits(v_ego, accel_clip)
|
||||
#print(f"Accel limits from controller: min_limit={min_limit}, max_limit={max_limit}")
|
||||
print(f"Accel Controller: min_limit={min_limit:.2f}, max_limit={max_limit:.2f}")
|
||||
|
||||
if self.mpc.mode == 'acc':
|
||||
# VOACC car, just give it max min (-1.2) so I can brake harder
|
||||
accel_clip = [ACCEL_MIN, max_limit] if self.CP.radarUnavailable else [min_limit, max_limit]
|
||||
# Use the accel controller limits directly
|
||||
accel_clip = [min_limit, max_limit]
|
||||
# recalculate limit turn according to the new min, max
|
||||
steer_angle_without_offset = sm['carState'].steeringAngleDeg - sm['liveParameters'].angleOffsetDeg
|
||||
accel_clip = limit_accel_in_turns(v_ego, steer_angle_without_offset, accel_clip, self.CP)
|
||||
print(f"ACC Mode Final: v_ego={v_ego:.2f}, accel_clip={accel_clip}")
|
||||
else:
|
||||
# blended, just give it max min (-3.5) and max from accel controller
|
||||
accel_clip = [ACCEL_MIN, ACCEL_MAX]
|
||||
print(f"Blended Mode: accel_clip={accel_clip}")
|
||||
|
||||
if reset_state:
|
||||
self.v_desired_filter.x = v_ego
|
||||
|
||||
Reference in New Issue
Block a user