-
Notifications
You must be signed in to change notification settings - Fork 0
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
Arms_Deployable #3
base: main
Are you sure you want to change the base?
Changes from all commits
73827e4
15729f4
3de70b4
2d15e2e
19ab892
80c070e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
package org.wildstang.year2023.subsystems.Intake; | ||
|
||
import org.wildstang.framework.io.inputs.Input; | ||
import org.wildstang.framework.subsystems.Subsystem; | ||
import org.wildstang.hardware.roborio.inputs.WsJoystickButton; | ||
import org.wildstang.hardware.roborio.outputs.WsSolenoid; | ||
import org.wildstang.hardware.roborio.outputs.WsSparkMax; | ||
import org.wildstang.year2023.robot.WSInputs; | ||
import org.wildstang.year2023.robot.WSOutputs; | ||
|
||
public class Intake implements Subsystem { | ||
|
||
private WsSparkMax intake1; | ||
private WsJoystickButton deployRevIntake; | ||
private WsJoystickButton backwards; | ||
|
||
private WsSolenoid deployable1; | ||
private WsSolenoid deployable2; | ||
|
||
//All variables used | ||
private boolean intakeCall; | ||
private boolean backCall; | ||
|
||
|
||
|
||
|
||
@Override | ||
public void inputUpdate(Input source) { | ||
// TODO Auto-generated method stub | ||
|
||
if (source == deployRevIntake){ | ||
intakeCall = !(intakeCall); | ||
|
||
} | ||
|
||
if (source == backwards){ | ||
backCall = !(backCall); | ||
} | ||
} | ||
|
||
@Override | ||
public void init() { | ||
// TODO Auto-generated method stub | ||
intake1 = (WsSparkMax) WSOutputs.INTAKE1.get(); | ||
|
||
deployRevIntake = (WsJoystickButton) WSInputs.MANIPULATOR_DPAD_DOWN.get(); | ||
deployRevIntake.addInputListener(this); | ||
backwards = (WsJoystickButton) WSInputs.MANIPULATOR_DPAD_UP.get(); | ||
|
||
deployable1 = (WsSolenoid) WSOutputs.DEPLOYABLE1.get(); | ||
deployable2 = (WsSolenoid) WSOutputs.DEPLOYABLE2.get(); | ||
|
||
intakeCall = false; | ||
backCall = false; | ||
|
||
|
||
} | ||
|
||
@Override | ||
public void selfTest() { | ||
// TODO Auto-generated method stub | ||
|
||
} | ||
|
||
@Override | ||
public void update() { | ||
// TODO Auto-generated method stub | ||
if (intakeCall){ | ||
intake1.setValue(1); | ||
deployable1.setValue(true); | ||
deployable2.setValue(true); | ||
} else { | ||
intake1.setValue(0); | ||
deployable1.setValue(false); | ||
deployable2.setValue(false); | ||
} | ||
|
||
if (backCall){ | ||
intake1.setValue(-1); | ||
deployable1.setValue(true); | ||
deployable2.setValue(true); | ||
} else { | ||
intake1.setValue(0); | ||
deployable1.setValue(false); | ||
deployable2.setValue(false); | ||
} | ||
Comment on lines
+68
to
+86
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So what happens when both buttons have been pressed? Should backCall always take precedent or should the last one pressed take precedent? If its the last one pressed you could use an int to store -1, 0, or 1 instead of intakeCall and backCall then having to decide which is more important |
||
} | ||
|
||
@Override | ||
public void resetState() { | ||
// TODO Auto-generated method stub | ||
intakeCall = false; | ||
|
||
} | ||
|
||
@Override | ||
public String getName() { | ||
// TODO Auto-generated method stub | ||
return "Intake"; | ||
} | ||
|
||
|
||
|
||
} |
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.
This ended up being just 1 solenoid, but we can leave this for now