mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-09-27 18:03:52 +08:00
Fix blended ACC
This commit is contained in:
@@ -86,12 +86,12 @@ class CarController(CarControllerBase):
|
||||
raw_acc_output = max(-1000, min(raw_acc_output, 1000))
|
||||
|
||||
if self.params.get_bool("BlendedACC"):
|
||||
if self.params.get_bool("ExperimentalMode"):
|
||||
self.acc_filter.update_alpha(abs(raw_acc_output-self.filtered_acc_last)/100)
|
||||
if self.params.get_int("CEStatus"):
|
||||
self.acc_filter.update_alpha(abs(raw_acc_output-self.filtered_acc_last)/1000)
|
||||
filtered_acc_output = int(self.acc_filter.update(raw_acc_output))
|
||||
else:
|
||||
# we want to use the stock value in this case but we need a smooth transition.
|
||||
self.acc_filter.update_alpha(abs(CS.crz_info["ACCEL_CMD"]-self.filtered_acc_last)/100)
|
||||
self.acc_filter.update_alpha(abs(CS.crz_info["ACCEL_CMD"]-self.filtered_acc_last)/1000)
|
||||
filtered_acc_output = int(self.acc_filter.update(CS.crz_info["ACCEL_CMD"]))
|
||||
|
||||
CS.crz_info["ACCEL_CMD"] = int(filtered_acc_output)
|
||||
@@ -105,12 +105,12 @@ class CarController(CarControllerBase):
|
||||
else:
|
||||
raw_acc_output = (CC.actuators.accel * 240) + 2000
|
||||
if self.params.get_bool("BlendedACC"):
|
||||
if self.params.get_bool("ExperimentalMode"):
|
||||
self.acc_filter.update_alpha(abs(raw_acc_output-self.filtered_acc_last)/100)
|
||||
if self.params.get_int("CEStatus"):
|
||||
self.acc_filter.update_alpha(abs(raw_acc_output-self.filtered_acc_last)/1000)
|
||||
filtered_acc_output = int(self.acc_filter.update(raw_acc_output))
|
||||
else:
|
||||
# we want to use the stock value in this case but we need a smooth transition.
|
||||
self.acc_filter.update_alpha(abs(CS.acc["ACCEL_CMD"]-self.filtered_acc_last)/100)
|
||||
self.acc_filter.update_alpha(abs(CS.acc["ACCEL_CMD"]-self.filtered_acc_last)/1000)
|
||||
filtered_acc_output = int(self.acc_filter.update(CS.acc["ACCEL_CMD"]))
|
||||
|
||||
acc_output = filtered_acc_output
|
||||
|
||||
@@ -114,7 +114,7 @@ class LongControl:
|
||||
should_stop, CS.brakePressed,
|
||||
CS.cruiseState.standstill)
|
||||
if self.params.get_bool("BlendedACC"):
|
||||
experimental_mode = self.params.get_bool("ExperimentalMode")
|
||||
experimental_mode = self.params.get_int("CEStatus") # 0 means expereimental mode is off
|
||||
if experimental_mode and not self.experimental_mode_last:
|
||||
self.reset()
|
||||
self.experimental_mode_last = experimental_mode
|
||||
|
||||
Reference in New Issue
Block a user