Skip to content
This repository has been archived by the owner on Dec 16, 2023. It is now read-only.

Brake Pedal does NOT disengage BoltPilot, but Regen Paddle does. #223

Closed
josetann opened this issue Aug 6, 2023 · 12 comments
Closed

Brake Pedal does NOT disengage BoltPilot, but Regen Paddle does. #223

josetann opened this issue Aug 6, 2023 · 12 comments
Assignees
Labels
question Further information is requested

Comments

@josetann
Copy link

josetann commented Aug 6, 2023

To Reproduce

While engaged (BoltPilot controlling speed and steering), press brake pedal. BoltPilot does not disengage.

Expected Behavior

While engaged (BoltPilot controlling speed and steering), pressing brake pedal will disengage BoltPilot.

Additional Context

2018 Chevrolet Bolt Premier with Comma 3 and Pedal. Tried both release and develop builds a few days ago (also tried feature-develop but had issues getting it to work).

It seems as though it's treating the regen paddle and the brake reverse of how it should. Using the regen paddle DOES cause BoltPilot to disengage. I'd expect the actual brake pedal to disengage the system (while I could see arguments for and against the regen paddle disengaging BoltPilot).

Also, a question since I couldn't see where to ask (is there a discord somewhere?). How can I set BoltPilot to require a nudge on the wheel before changing lanes? If I cancel the signal, sometimes the stalk will jump a bit too far and cause the opposite turn signal indicator to indicate (so if I'm turning left, have the left signal on, manually cancelling the signal may cause the right signal to briefly flash; this is dangerous as BoltPilot will just happily change lanes all over the place).

Thanks!

@issuelabeler issuelabeler bot added the question Further information is requested label Aug 6, 2023
@jc01rho
Copy link

jc01rho commented Aug 8, 2023

Hello, sorry for late answer.
Currently, there is no official real-time asking method. please use this issues.
but if you have a simple question, ping me @jc01rho in here (https://discord.gg/uxbZMJzayP, openpilot community, channel #gm)

in current version of BoltPilot, there are many options to chagning behavior of Comma,
I think the default option might be set to work as you wrote.

will be post the options names to handle your problem.
( basically, described in here but Koreean. https://github.com/jc01rho-openpilot-BoltEV2019-KoKr/boltpilot/blob/release/selfdrive/apilot.json )

@jc01rho
Copy link

jc01rho commented Aug 8, 2023

  1. if hit the brake when engaged, the state changes to "manual" that stop CommaPedal, steering things. isn't it ?
  2. touch the Comma3 screen , go to Settings -> Tune -> find "LANE CHANGE: Speed (30)" located most below.
    2-1. if you are using develop or master, set above 155
    2-2 if you are using (https://github.com/jc01rho-openpilot-BoltEV2019-KoKr/boltpilot/tree/feature/opgm-ap-integration), set below 10 or above 155.

explain for 155, in Korea, BoltEV limited higest vehicle speed to 154 km/h.
when the vehicle speed reached to 154 km/h, it works like fuel-cut? ( feels no speed up when hit gas-pedal. )
so set the minium limit speed of auto-lane-change to 155 (or above, ) it will not happen.

@josetann
Copy link
Author

josetann commented Aug 8, 2023

  1. If I press the regen paddle, it makes the disengage sound and flashes MANUAL on the screen. BoltPilot is properly disengaged. If I press the brake pedal, it makes no sound but does flash MANUAL on the screen. BoltPilot is not disengaged. I'd like it to act the same as the regen paddle, i.e. disengaging BoltPilot completely.

  2. I thought I found an option that would control that (Auto LaneMode change speed) but apparently that wasn't it. I'll try the other setting. I did a quick and dirty google translate for all the options in apilot.json so I can make out what I should be doing.

Thanks!

@jc01rho
Copy link

jc01rho commented Aug 8, 2023

Not "Lanemode" . Please find it in tune.

@jc01rho
Copy link

jc01rho commented Aug 8, 2023

Tune -> "LANE CHANGE: Speed (30)"

@josetann
Copy link
Author

josetann commented Aug 8, 2023

I tried, but it only went up to 60. I then edited apilot.json to set its max value to 160, updated, but still only lets me go to 60. I'll look at the code a bit more later and try to figure out what's happening.

@josetann
Copy link
Author

josetann commented Aug 8, 2023

Found the other location to set to 160 (it was settings for the ui itself). Works as expected now.

I haven't found the issue with the brake yet. I believe this is the code responsible for disabling BoltPilot when the brake or the regen paddle is used:

// exit controls on rising edge of brake press
if (brake_pressed && (!brake_pressed_prev || vehicle_moving)) {
  controls_allowed = 0;
}
brake_pressed_prev = brake_pressed;

// exit controls on rising edge of regen paddle
if (regen_braking && (!regen_braking_prev || vehicle_moving)) {
  controls_allowed = 0;
}
regen_braking_prev = regen_braking;

I don't see any issues there. Then I checked safety_gm.h and saw that these brake_pressed values had been commented out:

if ((addr == 190) && (gm_hw == GM_ASCM)) {
  //brake_pressed = GET_BYTE(to_push, 1) >= 8U;  // comment for MAD mode
}

if ((addr == 201) && (gm_hw == GM_CAM)) {
  //brake_pressed = GET_BIT(to_push, 40U) != 0U;  // comment for MAD mode
}

I uncommented, updated, but it still works as before. Regen paddle disables BoltPilot, brake pedal does not. I can understand why this behavior may be desired by some, but it should be an opt-in. I use one-pedal driving almost exclusively, so if I press the brake to force the car to slow to a stop, but then release because the car should hold, it'll take off. Also just as bad is if I just keep pressing on the brake (because I remember I need to), immediately press the accelerator to take off and drive normally (forgetting that BoltPilot is still engaged)...let off the accelerator all the way with the intention to brake and BoltPilot will take off again (because it was actually engaged the whole time, but any pedal command will pause it).

Any pointers would be appreciated.

@jc01rho
Copy link

jc01rho commented Aug 9, 2023

so sorry for numbers are limited in Apilot. the reason why is not all the codes from me lol..

I've fixed and drived-tested nudge-required thing,
fd70398#diff-93cc3090a8ba7f48d935dfbde20b6e4cafc90f37564702c03919470c84200d82

try https://github.com/jc01rho-openpilot-BoltEV2019-KoKr/boltpilot/tree/feature/opgm-ap-integration with "LANE CHANGE: Speed (30)" value 5 or zero.

@jc01rho
Copy link

jc01rho commented Aug 9, 2023

anyway, safety_gm.h does not related with all problemes described in here. :)

@jc01rho
Copy link

jc01rho commented Aug 9, 2023

sorry it could be releated with safety_gm.h lol..

@jc01rho
Copy link

jc01rho commented Aug 9, 2023

it should work as you comment-out in safety_gm.h , did you checked panda rebuilds? somethimes it need manually flashing command required to panda lol

@jc01rho
Copy link

jc01rho commented Aug 9, 2023

or, please add this just below you commented out if { .. } lines,

    if (addr == 241) {
      // Brake pedal's potentiometer returns near-zero reading
      // even when pedal is not pressed
      brake_pressed = GET_BYTE(to_push, 1) >= 10;
    }

from

if (addr == MSG_RX_BRAKE) {
// Brake pedal's potentiometer returns near-zero reading
// even when pedal is not pressed
brake_pressed = GET_BYTE(to_push, 1) >= 10;
}

hence, 0xF1 is 241
https://www.google.com/search?q=0xf1+to+decimal&sca_esv=554955330&sxsrf=AB5stBhjUxbahAJaTYjUSZPccCRZl7U7EQ%3A1691550276728&ei=RALTZOqOLO3M1e8Php6-oAU&oq=0xF1&gs_lp=Egxnd3Mtd2l6LXNlcnAiBDB4RjEqAggAMgcQIxiwAxgnMgoQABhHGNYEGLADMgoQABhHGNYEGLADMgoQABhHGNYEGLADMgoQABhHGNYEGLADMgoQABhHGNYEGLADSNYIUABYAHACeAGQAQCYAQCgAQCqAQC4AQHIAQDiAwQYACBBiAYBkAYG&sclient=gws-wiz-serp

@jc01rho jc01rho closed this as completed Sep 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants