openpilot icon indicating copy to clipboard operation
openpilot copied to clipboard

test_models: add tx fuzzy test

Open bongbui321 opened this issue 1 year ago • 1 comments

resolve #32425

Uses FuzzyGenerator to generate fuzzy CarControl messages

hypothesis example generation is extremly slow.

bongbui321 avatar Jul 03 '24 14:07 bongbui321

Thanks for contributing to openpilot! In order for us to review your PR as quickly as possible, check the following:

  • Convert your PR to a draft unless it's ready to review
  • Read the contributing docs
  • Before marking as "ready for review", ensure:
    • the goal is clearly stated in the description
    • all the tests are passing
    • the change is something we merge
    • include a route or your device' dongle ID if relevant

github-actions[bot] avatar Jul 03 '24 14:07 github-actions[bot]

Let me know when you want a review!

sshane avatar Jul 08 '24 21:07 sshane

Nice work - it's a great sign that it's finding bugs!

adeebshihadeh avatar Jul 16 '24 22:07 adeebshihadeh

Bounty locked!

hypothesis example generation is extremly slow.

Might be worth looking into https://github.com/commaai/openpilot/issues/32693

adeebshihadeh avatar Jul 17 '24 02:07 adeebshihadeh

yeah, ideally, I want to create a list of CarControl messages rather than only one such as now, but it takes nearly 18min on my machine to finish half the tx_fuzzy test.

Might be worth looking into https://github.com/commaai/openpilot/issues/32693

Our current Hypothesis is already the faster version, the latest release of hypothesis is 2x slower :).

bongbui321 avatar Jul 17 '24 02:07 bongbui321

Might merge tx fuzzy with carstate fuzzy.

Occasionally catches https://github.com/commaai/panda/pull/1948. Not entirely sure why hypothesis doesn't consistenly repro that failed data generation

bongbui321 avatar Jul 18 '24 03:07 bongbui321

@sshane ready for review

bongbui321 avatar Jul 19 '24 21:07 bongbui321

I don't think we merged all your bugfixes yet, so how is this passing? Are we not getting good coverage on a single run?

I don't think we merged all your bugfixes yet, so how is this passing? Are we not getting good coverage on a single run?

Nissan max steering angle [issue](https://github.com/commaai/openpilot/issues/32978) is opened and included in this PR

Tesla [issue](https://github.com/commaai/openpilot/issues/32999): This might happen with a few runs, and I suspect that if run locally, hypothesis will try to recreate that failing examples pretty consistently. That requires a more thoughtful fix, which I'm hesitant to open a fix PR since I'm not familiar with the expected behaviour of the platform

The Nissan speed issue is addressed here:

    # Nissan calculate vEgoRaw with avg speed of 4 wheels
    # while panda get vehicle_speed from rear wheels only,
    # so there might be a big enough difference between the two
    if self.CP.carName == "nissan":
      panda_vehicle_speed_last = self.safety.get_vehicle_speed_last() / VEHICLE_SPEED_FACTOR
      if abs(self.CI.CS.out.vEgoRaw - panda_vehicle_speed_last) > 0.2:
        cs_msg = self.CI.CS.out.to_dict()
        cs_msg["vEgoRaw"] = panda_vehicle_speed_last
        self.CI.CS.out = car.CarState.new_message(**cs_msg).as_reader()

This realistically shouldn't happen front wheels and rear wheel speed should be close

bongbui321 avatar Jul 25 '24 20:07 bongbui321

Can you rebase?

adeebshihadeh avatar Sep 01 '24 17:09 adeebshihadeh

This PR was closed because of a git history rewrite. Please read https://github.com/commaai/openpilot/issues/33399 for what to do with your fork and your PRs.

maxime-desroches avatar Sep 04 '24 06:09 maxime-desroches