openpilot icon indicating copy to clipboard operation
openpilot copied to clipboard

Log panda safety violations

Open adeebshihadeh opened this issue 3 years ago • 1 comments

To start, I'm thinking we add a field to pandaStates where these flags can be set. This will help debug controlsMismatches, where controls_allowed mysteriously goes low. It should at least cover:

  • [ ] lag detector tripped
  • [ ] RX addr checks (checksum + counter)
  • [ ] TX steering violations

adeebshihadeh avatar Jul 14 '22 00:07 adeebshihadeh

Having ridden this ride before, I'd like to see ALL controls_allowed transitions have an explicit reason every time and pass that reason up in pandaStates. Could do just reasons for exiting if we don't care about entering. Maybe migrate accesses in vehicle safety code to a getter/setter function or macro pattern to do it.

Something along these lines:

controls_allowed_transition(true, CD_NONE); ... controls_allowed_transition(false, CD_BRAKE);

struct PandaState @0xa7649e2575e4591e {
  ...
  lastControlsDisabledReason @26 :ControlsDisabledReasons;

  enum ControlsDisabledReasons {
    unknown @0;
    brakePressed @1;
    gasPressed @2;
    heatbeatLost @3;
    canNotValid @4;
    ...
  }

jyoung8607 avatar Jul 14 '22 04:07 jyoung8607

Hasn't been as necessary for my use cases anymore. It's pretty easy to reproduce offline now.

adeebshihadeh avatar Jan 05 '24 23:01 adeebshihadeh