commaai / commaai/openpilot

params learner unstable during dynamic driving

Open
#33,074 1 comment 1 reaction 0 assignees View on GitHub
bug
Dominant language
Python
Stars
63.7k
Forks
11.4k
Avg merge
17h 53m
Merged PRs (30d)
171

Description

### Describe the bug

The params learner displays unexpected behavior when coming out of a corner, or accelerating or braking. The biggest problem seems to be going around corners in city driving, but acceleration or braking in a straight line can be a problem too.

When allowing the wheel to return to center under self-aligning torque, there is often a very large spike in learned tire stiffness along with some downward pressure on learned steering ratio. There are multiple issues:

* The params learner really only understands steady-state handling, not dynamic handling
* Therefore, steering return to center via self-aligning torque, unopposed by the driver, looks like really stiff tires
* Acceleration and braking also affect apparent tire stiffness for purposes of lateral control
* `car_kf` allows a big jump because ALL of its inputs jump simultaneously as we [cross below 45 degrees steering angle](https://github.com/commaai/openpilot/blob/cd8a603ad0f14d744d12e2f5f743c7880ce907a3/selfdrive/locationd/paramsd.py#L98-L99)

The effect seems to be cumulative, and can manifest as quality degrading over the course of a drive. Much of the effect doesn't persist for the next drive, because the [learned tire stiffness factor resets at the beginning of every drive](https://github.com/commaai/openpilot/blob/cd8a603ad0f14d744d12e2f5f743c7880ce907a3/selfdrive/locationd/paramsd.py#L166-L169), but effects on the learned steering ratio can persist.

I'm not sure of the best way to fix this. As a workaround, I've done some testing with a [patch that tries to exclude more dynamic driving](https://github.com/commaai/openpilot/commit/d01e0f8f7b7565e7f1043211a5d6ec4e7de74195). It's very crude and doesn't completely work, but does seem to reduce the problem somewhat. Anecdotally, the learned params with this patch do seem to have a positive effect on driving behavior.

### Provide a route where the issue occurs

04836f13759962ab/00000077--a510468422, 73adbb0a04418743/00000027--d30dd7b9db

### openpilot version

edd8759f3934b44c640d7d044bd0c383caf68a42 (today's master)

### Additional info

From my own car, `04836f13759962ab/00000077--a510468422`.

![image](https://github.com/user-attachments/assets/a365f8a7-6cf5-4f11-8cf6-d4861bb65a27)

From Eyezenheim's car, `73adbb0a04418743/00000027--d30dd7b9db`.

**Note the tire stiffness factor transients, and the factor made it all the way to 1.5**.

![image](https://github.com/user-attachments/assets/79ecae9d-b491-47ea-a5f8-5958bc71a76b)

**Return-to-center (falling below 45 degrees) transient example 1:**

![image](https://github.com/user-attachments/assets/82b57f91-3704-47ec-b94c-eb1640a6453a)

**Return-to-center (falling below 45 degrees) transient example 2:**

![image](https://github.com/user-attachments/assets/5b33380f-2a5e-4aa4-b636-61e0c764be42)

**Return-to-center (falling below 45 degrees) transient example 3:**

![image](https://github.com/user-attachments/assets/a82e7f9d-f6fc-436f-a7b3-efd5a7c902d2)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.