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

#31713 Script that enables automatic modification of platform configs #32446

Conversation

teodoramilanovic
Copy link

The provided output has not been formatted yet. However, if the solution meets your requirements, please feel free to specify your preferences regarding the formatting. Also, using this method sometimes requires importing additional elements from other files (e.g. Device).
Thanks!

Copy link
Contributor

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 github-actions bot added the car vehicle-specific label May 16, 2024
Copy link
Contributor

@sshane sshane left a comment

Choose a reason for hiding this comment

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

Even if you don't change anything, save_config will add the default fields we have defined which we don't want (package='All' for example, and the extra enums you mentioned like Device). I think we need a way of determining if something's changed to only modify/add that field as needed.

Also, is there a more generic/smaller attr_repr function we can use? It looks like it mostly is just for formatting the enum values.

This should stay the same:

  TOYOTA_CAMRY = PlatformConfig(
    [
      ToyotaCarDocs("Toyota Camry 2018-20", video_link="https://www.youtube.com/watch?v=fkcjviZY9CM", footnotes=[Footnote.CAMRY]),
      ToyotaCarDocs("Toyota Camry Hybrid 2018-20", video_link="https://www.youtube.com/watch?v=Q2DYY0AWKgk"),
    ],
    CarSpecs(mass=3400. * CV.LB_TO_KG, wheelbase=2.82448, steerRatio=13.7, tireStiffnessFactor=0.7933),
    dbc_dict('toyota_nodsu_pt_generated', 'toyota_adas'),
    flags=ToyotaFlags.NO_DSU,
  )

But it becomes:

  TOYOTA_CAMRY = PlatformConfig(
    car_docs=[
      ToyotaCarDocs(name='Toyota Camry 2018-20', package='All', requirements=None, video_link='https://www.youtube.com/watch?v=fkcjviZY9CM', footnotes=[Footnote.CAMRY], min_steer_speed=None, min_enable_speed=None, auto_resume=None, car_parts=CarParts(parts=[CarHarness.toyota_a, Device.threex])),
      ToyotaCarDocs(name='Toyota Camry Hybrid 2018-20', package='All', requirements=None, video_link='https://www.youtube.com/watch?v=Q2DYY0AWKgk', footnotes=[], min_steer_speed=None, min_enable_speed=None, auto_resume=None, car_parts=CarParts(parts=[CarHarness.toyota_a, Device.threex]))
    ],
    specs=CarSpecs(mass=1542.2128, wheelbase=2.82448, steerRatio=13.7, centerToFrontRatio=0.5, minSteerSpeed=0.0, minEnableSpeed=-1.0, tireStiffnessFactor=0.7933),
    dbc_dict={'pt': 'toyota_nodsu_pt_generated', 'radar': 'toyota_adas', 'chassis': None, 'body': None},
    flags=ToyotaFlags.NO_DSU,
    platform_str='TOYOTA_CAMRY')

@sshane
Copy link
Contributor

sshane commented May 28, 2024

Closing for inactivity for a week, feel free to re-open if you address the issues.

@sshane sshane closed this May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
car vehicle-specific
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[$100 bounty] ability to modify any part of a platformconfig with python
2 participants