-
Notifications
You must be signed in to change notification settings - Fork 614
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
[wpilib, commands] Cache controller BooleanEvents/Triggers and directly construct Triggers #6738
[wpilib, commands] Cache controller BooleanEvents/Triggers and directly construct Triggers #6738
Conversation
This PR modifies commands. Please open a corresponding PR in Python Commands and include a link to this PR. |
I don't think I need to do anything for Python? Python Commands already directly constructs Triggers, and since objects are ref-counted, I don't think there's much of a GC concern either. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned about the axis caches, since there's no guarantee that the threshold is in the range [0, 50). (First, it's plausible that someone would want a negative threshold for e.g. the left x axis (which would lead to a conflict between the axisGreaterThan
and axisLessThan
caches), and second, although it wouldn't make sense, a user could pass a really high number, which should be handled in some way to avoid having a really difficult to track bug.)
Yeah, I'm not sure how to handle axis caches because they're done in a unique way. I suppose I could nest the Map even further ( |
I try to lean towards keeping maps as flat a possible. How about |
57803f4
to
cd7a489
Compare
wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/CommandGenericHID.java
Outdated
Show resolved
Hide resolved
wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/button/CommandGenericHID.java
Outdated
Show resolved
Hide resolved
97e500a
to
84a76e8
Compare
84a76e8
to
68dda7b
Compare
146b18e
to
ed8fb6b
Compare
This is a common footgun for teams.
ed8fb6b
to
319d6c0
Compare
The C++ classes need mutexes as well. |
C++ classes don't cache BooleanEvents or Triggers, so they don't need mutexes. |
Fixes #5903, resolves #6445 by updating it to work with the HID templates. (Updating those is great by the way, you just have to change a few lines and regenerate!)