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

Add Alerts to RobotConfig #964

Merged
merged 3 commits into from
Jan 5, 2025

Conversation

JosephTLockwood
Copy link
Contributor

This pull request adds the ability to check whether hard-coded RobotConfig matches the configuration in GUI.

@github-actions github-actions bot added the PathPlannerLib Changes to PathPlannerLib label Jan 4, 2025
@mjansen4857
Copy link
Owner

Could you invert the methods (and their names) to return true if the config is valid instead of false? Its pretty common for a false return value to indicate an error so I'd like to stick to that.

@JosephTLockwood
Copy link
Contributor Author

I don't have a problem with that. That is how I originally had them. I switched them because they would return the opposite of what you set your Alert to, which seemed counterintuitive. If there are going to be test cases, then would you want them to return the same?

It's totally up to you. I'm good with either.

@mjansen4857
Copy link
Owner

I think its better to have true be a "normal" return value and then the user code/tests can react to false as an error. The alerts and the method return value or sort of separate things so having different values there isn't a huge deal.

Comment on lines 343 to 346
return validatePhysicalProperties(guiConfig)
&& validateDriveSystem(guiConfig)
&& validateWheelProperties(guiConfig)
&& validateModuleLocations(guiConfig);
Copy link
Owner

Choose a reason for hiding this comment

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

If one of these methods fails, all methods afterwards would not be run, meaning that alerts that should be set might not actually get set.

@mjansen4857 mjansen4857 enabled auto-merge (squash) January 5, 2025 01:26
@mjansen4857 mjansen4857 merged commit e6ca7e7 into mjansen4857:main Jan 5, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PathPlannerLib Changes to PathPlannerLib
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants