Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tesla: reduce jerkiness after gas overwrite #1862

Draft
wants to merge 143 commits into
base: master
Choose a base branch
from

Conversation

lukasloetkolben
Copy link
Contributor

Ramping up the jerk after overriding the gas helps to make it feel less jerky.

@lukasloetkolben lukasloetkolben marked this pull request as draft February 27, 2025 04:11
@github-actions github-actions bot added car related to opendbc/car/ tesla labels Feb 27, 2025
Comment on lines +29 to +30
# ramp up jerk after a gas overwrite
self.jerk = 0 if override else self.jerk + CarControllerParams.JERK_RATE_UP
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggested this, but @robbederks thought it was hacky. I'm going to take another look again in a few days to see if we're doing anything wrong first before merging

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a few tests and it feels much smoother.
Maybe you can do a test drive.
Maybe increase the rate to 0.04-0.05

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'm sure this fixes the issue in the car, but I think it's likely just masking an openpilot bug deeper down

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but for now it's probably better to mask the bug than show it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there's a combination of things the stock system does that we don't. On gas override it reduces the jerk and ramps it back up, then the up accel limit is near the ISO max, but because the set speed is negative it doesn't actually actuate it, just allow it. I think since we set to 0 on inactive, it thinks we're violating the accel limit and with a very high jerk it brakes to go within it (0 m/s^2):

image

This comment was marked as outdated.

This comment was marked as outdated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks much less similar on an FSD route 😞

@sshane
Copy link
Contributor

sshane commented Mar 3, 2025

Are you sure this works? I set both jerks to 0 and it still happens

@lukasloetkolben
Copy link
Contributor Author

Are you sure this works? I set both jerks to 0 and it still happens

It's definitely working for me. I have to test setting jerk to 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
car related to opendbc/car/ tesla
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants