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

Generic Input - abstraction class for button/trigger inputs #63

Closed
jon-bassi opened this issue Feb 5, 2023 · 5 comments · May be fixed by #85
Closed

Generic Input - abstraction class for button/trigger inputs #63

jon-bassi opened this issue Feb 5, 2023 · 5 comments · May be fixed by #85
Labels
story overarching requirement

Comments

@jon-bassi
Copy link
Collaborator

wrapper for types of inputs from controller, mainly buttons and triggers
Abstracts some of the work out of operator controller and makes things a bit more extensible
main functionality would be:

  • determining whether a trigger is pressed based on % input
  • adding a button.onPress() and onHold() function (potentially onRelease() as well) - reasoning being that there are a few inputs (such as selecting auto mode) that can be accidentally triggered multiple times by holding the button down
    some of this functionality exists in Latch but it may be more intuitive to refactor into this
@jon-bassi jon-bassi added the story overarching requirement label Feb 5, 2023
@jon-bassi
Copy link
Collaborator Author

jon-bassi commented Feb 7, 2023

@boomertink123 @jttr-59
can you start on this by adding GenericInput.cpp/.h in Controllers/

we don't need to worry about the logic in the functions for the first step, so just creating the definitions should be sufficient
within GenericInput.h we'd like

  • 3 classes: GenericInput, Button, and Trigger
  • Button and Trigger should have 4 functions to start: constructor that sets an int ID, OnPress(), OnHold(), Handle()

GenericInput will be the parent class to Button and Trigger but I can go over how to do that with you if you need me to

let me know if you have questions

branch is already created and linked on this page

@jon-bassi
Copy link
Collaborator Author

@jttr-59 let me know when you have some code for this to push

@jttr-59
Copy link
Contributor

jttr-59 commented Feb 10, 2023

@jon-bassi I believe that @boomertink123 pushed the code, correct me if I'm wrong.

@jon-bassi
Copy link
Collaborator Author

@boomertink123 @jttr-59 I don't see anything new on branch 63 at all and if there's a different branch, I don't see it

@jon-bassi
Copy link
Collaborator Author

jon-bassi commented Feb 20, 2023

@jttr-59 I pulled the code down and rebased it on current develop since we made some big changes.

Biggest of which for you all is that the GenericInput is now gonna be in the ControlBoards/ directory rather than Controllers/

I also went through and determined what else needs to be done

  • update the constructor for both Button and Trigger to add an frc::Joystick as a argument, we should add this joystick as a member variable: m_Controller
  • you will need to include <frc/Joystick.h> for this
  • in Handle() for Button and Trigger, set the member variable m_Value to m_Controller->GetRawButton(ID); or m_DriverControlStick->GetRawAxis(ID); respectively

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

Successfully merging a pull request may close this issue.

2 participants