Subaru: Add 2025 Crosstrek angle steering support#3251
Subaru: Add 2025 Crosstrek angle steering support#3251lukasloetkolben wants to merge 12 commits intocommaai:masterfrom
Conversation
Car behavior reportReplays driving segments through this PR and compares the behavior to master. Testing 79 segments for: SUBARU_ASCENT, SUBARU_OUTBACK, SUBARU_LEGACY, SUBARU_IMPREZA, SUBARU_IMPREZA_2020, SUBARU_FORESTER, SUBARU_OUTBACK_PREGLOBAL, SUBARU_OUTBACK_PREGLOBAL_2018, SUBARU_FORESTER_2022 Show changes |
88aae54 to
fbd94a4
Compare
Co-Authored-By: Jacob Waller <jacobwaller@users.noreply.github.com>
fbd94a4 to
42f439f
Compare
bbabbb2 to
6683eec
Compare
…ring support Cherry-picked from commaai/opendbc#3251 onto sunnypilot/opendbc. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| # heavy steering oscillation at low speeds (up to ~5 mph), still present up to ~22mph | ||
| # likely due to poor steering angle sensor resolution or imprecise EPS actuation | ||
| if CC.latActive and CS.out.vEgoRaw < 10.0: | ||
| deadzone = np.interp(CS.out.vEgoRaw, [2., 10.0], [6.0, 3.0]) | ||
| apply_angle = self.apply_angle_last + apply_center_deadzone(apply_angle - self.apply_angle_last, deadzone) |
There was a problem hiding this comment.
likely? do we know why? have a plot of why this is needed showing the car overshooting our request?
afaik current angle is not used to error correct so not sure how that's possible
| if self.CP.flags & SubaruFlags.LKAS_ANGLE: | ||
| # ES_Brake->Cruise_Activated stays high on brake at standstill, | ||
| # so we use ES_Status->Cruise_Activated which is the correct engaged state. | ||
| ret.cruiseState.enabled = cp_es_brake.vl["ES_Status"]['Cruise_Activated'] != 0 | ||
| ret.cruiseState.available = cp_cam.vl["ES_DashStatus"]['Cruise_On'] != 0 | ||
| elif self.CP.flags & SubaruFlags.HYBRID: | ||
| # ES_Status is missing on hybrid, so we use ES_Brake instead | ||
| # TODO: 0x27 and 0x225 on hybrids may work as a replacement |
There was a problem hiding this comment.
removes a todo that I'm not sure is solved yet
| from opendbc.car.subaru.interface import CarInterface | ||
| return CarInterface.get_non_essential_params("SUBARU_ASCENT") |
There was a problem hiding this comment.
need to see the distribution of the angle cars to see if we can set to the minimum one + some tests to check new cars merged.
the Tesla VM safety mode was designed for no override, and two cars that are very similar. now that it's getting used more widely, we need to make it nice to work with and validate safety. that means detecting the car in panda safety if needed
There was a problem hiding this comment.
I would like to see data given the Ascent's params on all the new angle Subarus to show the max lateral accel for each (you can just calculate this pretty simply, no driving required)
| MAX_LATERAL_ACCEL=ISO_LATERAL_ACCEL + (ACCELERATION_DUE_TO_GRAVITY * AVERAGE_ROAD_ROLL), # ~3.6 m/s^2 | ||
| MAX_LATERAL_JERK=3.0 + (ACCELERATION_DUE_TO_GRAVITY * AVERAGE_ROAD_ROLL), # ~3.6 m/s^3 | ||
| MAX_ANGLE_RATE=5, # deg/frame, comfort rate limit |
There was a problem hiding this comment.
like this can all be common now, we're going to duplicate it in HKG as well
Adds lateral control support for the 2025 Subaru Crosstrek, the first angle-based LKAS Subaru to be fully supported. This is a cleanup and rework based on the original work by Jacob Waller in #2864.
Credits
Based on the initial implementation by @jacobwaller (#2864).