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

safety: add longitudinal pre-enable state for brake at a standstill #1123

Open
wants to merge 37 commits into
base: master
Choose a base branch
from

Conversation

sshane
Copy link
Contributor

@sshane sshane commented Oct 28, 2022

Adds new pre-enable state when enabling at a standstill with brake depressed. Allows brake and negative accel to 0 accel, blocks positive accel, gas, interceptor.

Pre-reqs (so this change isn't unmaintainable):

board/safety.h Outdated
@@ -85,7 +85,7 @@ int safety_fwd_hook(int bus_num, CANPacket_t *to_fwd) {
}

bool get_longitudinal_allowed(void) {
return controls_allowed && !gas_pressed_prev;
return controls_allowed && !gas_pressed_prev && !brake_pressed_prev;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will need to allow braking on cars that are gas/brake controlled and not acceleration controlled.

On both GM and certain Honda, once you release the brake the car will lurch forward as openpilot's brake request ramps up.

@sshane sshane changed the title safety: add brake pre-enable state safety: add longitudinal pre-enable state for brake at a standstill Oct 28, 2022
@sshane sshane marked this pull request as draft October 28, 2022 06:24
board/safety.h Outdated Show resolved Hide resolved
board/safety/safety_ford.h Outdated Show resolved Hide resolved
@sshane sshane added the car safety vehicle-specific safety code label Oct 4, 2023
@sshane sshane marked this pull request as ready for review November 11, 2023 08:22
return controls_allowed && !gas_pressed_prev;
}

bool get_accel_allowed(void) {
Copy link
Contributor

Choose a reason for hiding this comment

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

let's make this name less ambiguous, such as gas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
car safety vehicle-specific safety code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants