jyoung8607 / openpilot

open source driving agent
MIT License
69 stars 55 forks source link

Prevent "Brake!" message on OP long disengage #75

Closed jyoung8607 closed 2 years ago

jyoung8607 commented 2 years ago

A subset of vehicles with MQB long throw a "Brake!" message and loud beep when disengaging via either gas or brake. As an example, my 2020 Tiguan does this, but my 2018 Golf R doesn't. I'm not yet sure how to fix this correctly. There's a complex interaction between the radar and the instrument cluster, and we're not yet simulating it correctly.

Involved messages/signals for later reference:

Hendrik212 commented 2 years ago

I did some further analysis and I'm fairly certain I found the cause this time.

A disengagement event on stock ACC looks as marked by the red box: 2022-01-22 16_59_52-comma ai cabana

On OP long ["TSK_06"]["TSK_Status"] is used as an input signal for ["ACC_02"]["ACC_Status_Anzeige"]. Thus ["ACC_Status_Anzeige"] is briefly set to 5 on disengage which deviates from shown stock behaviour.

I still need to confirm this with an extended test drive. However, I'm able to trigger the Brake! message at standstill by manually sending the value 5 to ["ACC_02"]["ACC_Status_Anzeige"]. That's why I'm quite optimistic we are in for an easy fix.

jyoung8607 commented 2 years ago

Very plausible, nice find! Will try it tomorrow.

Hendrik212 commented 2 years ago

After driving around for several days, I think it's safe to say the Brake beep can be fixed by changing the line https://github.com/jyoung8607/openpilot/blob/547f1cd435e512ff4f8356bdbdf26e5a58ee9b92/selfdrive/car/volkswagen/volkswagencan.py#L53 to "ACC_Status_Anzeige": 2 if acc_status == 5 else acc_status,

A few things I found out during testing: It was difficult (or even impossible?) to filter this message because we were actually commanding the cluster to display the Brake! message by sending 5. The car was not responsible for this message.

By sending 5 to ["ACC_02"]["ACC_Status_Anzeige"], the ["ACC_04"]["ACC_Texte_braking_guard"] message was also somehow triggered. However, filtering this message seemingly had no effect because it was invisible (the Brake message seems to have a higher priority).

During testing I cycled through all ["ACC_04"]["ACC_Texte_braking_guard"] messages to see if it includes the Brake beep. Here's what it can actually display: 1: text: "front assist deactivated" 2: big red front assist symbol 3: text: "front assist demo mode" 4: text: "front assist not available"

I've seen stock ACC displaying the Brake message in rare cases. It seems to be triggered when the calculated negative acceleration exceeds the lower ACC limit. It's a take over request from ACC which can occur much earlier than a FCW to give the driver additional time to intervene.

On OP-long it should be safe to just set this to 2 if tsk_status is 5 because tsk_status 5 is not an error: https://github.com/jyoung8607/openpilot/blob/547f1cd435e512ff4f8356bdbdf26e5a58ee9b92/selfdrive/car/volkswagen/carstate.py#L109

jyoung8607 commented 2 years ago

Hey @Hendrik212, wanted to let you know I tried this on our 2020 Tiguan and it worked great. I did end up setting it to 3 rather than 2 to reflect that 5 is indeed a still engaged state, but the principle of the fix worked great. Thanks very much for tracking this down!