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

Bounds checking could use improvement #23

Open
mduffor opened this issue Mar 15, 2023 · 2 comments
Open

Bounds checking could use improvement #23

mduffor opened this issue Mar 15, 2023 · 2 comments

Comments

@mduffor
Copy link

mduffor commented Mar 15, 2023

https://github.com/FRC5411/Lofty-2023/blob/89c03d89e93596035ac60450451b82608aee2649/src/main/java/frc/robot/subsystems/Arm.java#L171

Current code compares output values against themselves, which doesn't solve anything.
Bounds checking both high and low, forward and back, would be useful.
Bounds should be defined with constants, not using magic numbers.

@RDc12Programming
Copy link
Contributor

the check against itself is actually a check for NaN, which would indicate a value outside or inside the reach of the arm. the x/y checks are to ensure we do not breach frame perimiter, and do need to me notated and moved to constants. will do

@mduffor
Copy link
Author

mduffor commented Mar 15, 2023

It is much clearer to do output[0].isNan() or (Double.isFinite(output[0]) == false)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants