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

Style changes to buildAutoChooser #862

Merged
merged 2 commits into from
Oct 13, 2024
Merged

Conversation

ThePhoenixFox
Copy link
Contributor

@ThePhoenixFox ThePhoenixFox commented Oct 13, 2024

Changed filtering function from const PathPlannerAuto* const-> const PathPlannerAuto&: Easier syntax, reference act like varible instead of pointer
const_cast<> can still change the const-ness of PathPlannerAuto& which allows them to edit directly (I despise this feature, however there is no copy constructor for PathPlannerAuto due to unique_ptr)
Replace dynamic_cast<> to static_cast<> since we know relationship at compile time
Set filter as first parameter and defaultAutoName as second (which is defaulted), which prevents confusion as to why there is an empty string input (in user code)
Separated buildAutoChooser into buildAutoChooser, buildAutoChooserFilter, and buildAutoChooserFilterPath for different degrees of concern and to mirror java version more neatly (allows people to change from both languages)
Updated function descriptions

Degrees of concern for buildAutoChooser

  • Person who just wants to get a SendableChooser of all PathPlannerAutos just needs to worry about buildAutoChooser
  • Person who wants to filter out some PathPlannerAutos just needs to worry about buildAutoChooserFilter
  • Person who wants to filter out some PathPlannerAutos based on filepath (std::filesystem::path libary) needs to worry about buildAutoChooserFilterPath

I know I have made a lot of changes to this feature however I just want it to be right before backward compatibility requirements happen. I am probably not going to edit this any further as it performs all the roles it need to Java version while maintaining C++ style.
Good luck rolling out for the 2025 season btw👍

Changed filtering function from const PathPlannerAuto* const -> const PathPlannerAuto&:Easier syntax, ref act like varible instead of pointer
const_cast<> can still change the const-ness of PathPlannerAuto& which allows them to edit directly
Replace dynamic_cast<> to static_cast<> since we know relationship at compile time
Set filter as first parameter and defaultAutoName as second (which is defaulted), which prevents confusion as to why there is an empty string input
Separated buildAutoChooser into buildAutoChooser, buildAutoChooserFilter, and buildAutoChooserFilterPath for different degrees of concern.
* Person who just wants to get a SendableChooser of all PathPlannerAutos just needs to worry about buildAutoChooser
* Person who wants to filter out some PathPlannerAutos just needs to worry about buildAutoChooserFilter
* Person who wants to filter out some PathPlannerAutos bases on filepath needs to worry about buildAutoChooserFilterPath
Updated function descriptions
@github-actions github-actions bot added PathPlannerLib Changes to PathPlannerLib documentation Pull requests that update the documentation site files labels Oct 13, 2024
@mjansen4857
Copy link
Owner

Tiniest nitpick ever but it looks like a few of the function descriptions have a typo in “recurively”

@ThePhoenixFox
Copy link
Contributor Author

Yeah you change it to "recursively". That is what happens when spell check isn't there for you.

@ThePhoenixFox
Copy link
Contributor Author

PPLib-macOS is commented out in in pplib-ci.yml so that is why it not finishing. I do not know if that is intentional but that is why the workflow isn't completing (since it also marked as require).
https://github.com/mjansen4857/pathplanner/blob/4e74a202d6332f3025a607dc0f58e6a8ab5dc304/.github/workflows/pplib-ci.yml#L172C1-L174C29

@mjansen4857
Copy link
Owner

Yeah I meant to merge this earlier and forgot. macOS is disabled because it fails to build with 2024 WPILib for whatever reason. Works fine with 2025 so I just disabled it temporarily.

@mjansen4857 mjansen4857 merged commit f910b8d into mjansen4857:main Oct 13, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Pull requests that update the documentation site files PathPlannerLib Changes to PathPlannerLib
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants