-
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
New indexer #17
base: master
Are you sure you want to change the base?
New indexer #17
Changes from 57 commits
be2fc4a
7904908
8f96d64
234b2ce
53260b2
951b761
f90fbaf
ff0bdf9
ca3c3f2
e75fc1e
834e0b6
76bbb2e
a018a78
4884a62
19ddf97
b9f3ab3
f74400e
eb7ca4e
9a26e3d
889452c
fe5384b
3d6656a
1aacecc
af8a3c6
ad0f3a7
8bdf2af
303e849
93b5a5a
5a8860c
597f6fb
1102a4a
1093f11
d671283
105722d
1444934
9d5c93f
a9c1d92
7b2a734
506aba5
ec06273
82f7984
337d40b
e9dd7f0
abeb017
391c92b
d3625dd
b0fbe05
114d349
dd7fe70
ff94695
c002833
ab91839
7aa7063
902c1a6
8747ceb
8a69d2b
9bb29c6
51e50ca
1b65def
7ac38ba
3bbbc2d
cd31a4e
3a294f4
9179d0a
48a98d1
3aa8140
7376003
9944e29
6d27c91
23ac442
f0dbc4c
e230c9f
816b6e9
6a277b7
07a1804
678bdbf
49fe18c
f517a72
642860e
8720820
2a7ae66
d8455b7
757d16b
0d62db1
ae9572a
1c4794d
f4aa3c9
04f5a3b
4f0a5a8
9f7a914
980f91f
712b289
aa4865b
d67e40c
6549829
f35e41f
95410ed
3322249
48c565f
3f9806b
5ff3392
ac98fc1
12da3a8
fca443a
9ce8cd1
6e92875
1b7e795
93114e1
eab1183
4c4ffce
66d5434
2696746
41081ff
34cb988
da391b9
11035e1
46a109a
3475117
a6c7ef1
81147ab
85ccebb
2045b86
05082e0
826481d
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,10 @@ | ||
package org.usfirst.frc4904.robot.commands; | ||
|
||
import org.usfirst.frc4904.robot.subsystems.RollyBOI; | ||
|
||
public class IndexerGrabberClasp extends IndexerGrabberSet { | ||
|
||
public IndexerGrabberClasp() { | ||
super(RollyBOI.GrabberState.CLASPED); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.usfirst.frc4904.robot.commands; | ||
|
||
import org.usfirst.frc4904.robot.subsystems.RollyBOI; | ||
|
||
public class IndexerGrabberRelease extends IndexerGrabberSet { | ||
|
||
public IndexerGrabberRelease() { | ||
super(RollyBOI.GrabberState.RELEASED); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.usfirst.frc4904.robot.commands; | ||
|
||
|
||
import org.usfirst.frc4904.robot.RobotMap; | ||
import org.usfirst.frc4904.robot.subsystems.RollyBOI; | ||
import edu.wpi.first.wpilibj.command.Command; | ||
|
||
public class IndexerGrabberSet extends Command { | ||
protected final RollyBOI.GrabberState state; | ||
|
||
public IndexerGrabberSet(RollyBOI.GrabberState state) { | ||
this.state = state; | ||
} | ||
|
||
@Override | ||
protected void initialize() { | ||
RobotMap.Component.rollyBOI.setState(state); | ||
} | ||
|
||
@Override | ||
protected void interrupted() { | ||
RobotMap.Component.rollyBOI.setState(RollyBOI.GrabberState.CLASPED); | ||
} | ||
|
||
@Override | ||
protected boolean isFinished() { | ||
return true; | ||
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. Let it run indefinitely. |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.usfirst.frc4904.robot.commands; | ||
|
||
|
||
import org.usfirst.frc4904.robot.RobotMap; | ||
import org.usfirst.frc4904.robot.subsystems.RollyBOI; | ||
import org.usfirst.frc4904.standard.commands.motor.MotorConstant; | ||
import edu.wpi.first.wpilibj.command.CommandGroup; | ||
|
||
public class IndexerIntake extends CommandGroup { | ||
public IndexerIntake() { | ||
requires(RobotMap.Component.rollyBOI); | ||
addParallel(new MotorConstant(RobotMap.Component.rollyBOIRollerLeft, RollyBOI.INTAKE_SPEED)); | ||
addParallel(new MotorConstant(RobotMap.Component.rollyBOIRollerRight, RollyBOI.INTAKE_SPEED)); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.usfirst.frc4904.robot.commands; | ||
|
||
import org.usfirst.frc4904.robot.RobotMap; | ||
import org.usfirst.frc4904.robot.subsystems.RollyBOI; | ||
import org.usfirst.frc4904.standard.commands.motor.MotorConstant; | ||
import edu.wpi.first.wpilibj.command.CommandGroup; | ||
|
||
|
||
public class IndexerOuttake extends CommandGroup { | ||
|
||
public IndexerOuttake() { | ||
super("IndexerRollersOuttake"); | ||
requires(RobotMap.Component.rollyBOI); | ||
addParallel(new MotorConstant(RobotMap.Component.rollyBOI.rollerLeft, RollyBOI.OUTTAKE_SPEED)); | ||
addParallel(new MotorConstant(RobotMap.Component.rollyBOI.rollerRight, RollyBOI.OUTTAKE_SPEED)); | ||
} | ||
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.usfirst.frc4904.robot.commands; | ||
|
||
|
||
import org.usfirst.frc4904.robot.RobotMap; | ||
import org.usfirst.frc4904.robot.subsystems.CrateIO; | ||
import org.usfirst.frc4904.standard.commands.motor.MotorConstant; | ||
import edu.wpi.first.wpilibj.command.CommandGroup; | ||
|
||
public class IntakeRollersIntake extends CommandGroup { | ||
public IntakeRollersIntake() { | ||
super("IntakeRollersIntake"); | ||
requires(RobotMap.Component.crateIO); | ||
addParallel(new MotorConstant(RobotMap.Component.crateIO.rollerLeft, CrateIO.INTAKE_SPEED)); | ||
addParallel(new MotorConstant(RobotMap.Component.crateIO.rollerRight, CrateIO.INTAKE_SPEED)); | ||
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. Stop using both of these seperately, instead use the |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.usfirst.frc4904.robot.commands; | ||
|
||
|
||
import org.usfirst.frc4904.robot.RobotMap; | ||
import org.usfirst.frc4904.robot.subsystems.CrateIO; | ||
import org.usfirst.frc4904.standard.commands.motor.MotorConstant; | ||
import edu.wpi.first.wpilibj.command.CommandGroup; | ||
|
||
public class IntakeRollersOuttake extends CommandGroup { | ||
public IntakeRollersOuttake() { | ||
super("IntakeRollersOuttake"); | ||
requires(RobotMap.Component.crateIO); | ||
addParallel(new MotorConstant(RobotMap.Component.crateIO.rollerLeft, CrateIO.OUTTAKE_SPEED)); | ||
addParallel(new MotorConstant(RobotMap.Component.crateIO.rollerRight, CrateIO.OUTTAKE_SPEED)); | ||
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. use the |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.usfirst.frc4904.robot.commands; | ||
|
||
|
||
import org.usfirst.frc4904.robot.RobotMap; | ||
import edu.wpi.first.wpilibj.command.CommandGroup; | ||
|
||
public class IntakeSquared extends CommandGroup { | ||
public IntakeSquared() { | ||
super("IntakeSquared"); | ||
requires(RobotMap.Component.crateIO); | ||
requires(RobotMap.Component.rollyBOI); | ||
addParallel(new IndexerIntake()); | ||
addParallel(new IntakeRollersIntake()); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package org.usfirst.frc4904.robot.commands; | ||
|
||
|
||
import org.usfirst.frc4904.standard.LogKitten; | ||
import org.usfirst.frc4904.standard.commands.KittenCommand; | ||
import org.usfirst.frc4904.standard.commands.motor.MotorIdle; | ||
import org.usfirst.frc4904.standard.subsystems.motor.Motor; | ||
import edu.wpi.first.wpilibj.command.CommandGroup; | ||
import edu.wpi.first.wpilibj.command.Subsystem; | ||
|
||
/** | ||
* Idles motors of a subsystem. | ||
* Used as a default command | ||
* | ||
*/ | ||
public class MotorIdleGroup extends CommandGroup{ | ||
|
||
/** | ||
* Run MotorIdle (from WPILib) in parallel on every motor | ||
* from a list of motors with unrestricted size. | ||
* | ||
* @param name | ||
* @param subsystem | ||
* @param motors | ||
*/ | ||
public MotorIdleGroup(String name, Subsystem subsystem, boolean isDebug, Motor... motors) { | ||
super(name); | ||
requires(subsystem); | ||
String logMessage = ""; | ||
for (Motor motor : motors) { | ||
requires(motor); | ||
addParallel(new MotorIdle(motor)); | ||
if (isDebug){ | ||
if (motor.getName() != null) { | ||
logMessage += motor.getName() + " "; | ||
} else { | ||
logMessage += "unnamed motor "; | ||
} | ||
logMessage += "idling"; | ||
addParallel(new KittenCommand(logMessage, LogKitten.KittenLevel.WTF)); | ||
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. This is not want I meant. calling super("name") will use that name for prexisting logs. I don't think you should manually log them, but you should pass the name as all of the motors together |
||
} | ||
} | ||
} | ||
|
||
/** | ||
* Run MotorIdle (from WPILib) in parallel on every motor | ||
* from a list of motors with unrestricted size. | ||
* | ||
* @param name | ||
* @param subsystem | ||
* @param motors | ||
*/ | ||
public MotorIdleGroup(String name, Subsystem subsystem, Motor... motors) { | ||
this(name, subsystem, false, motors); | ||
} | ||
|
||
/** | ||
* Run MotorIdle (from WPILib) in parallel on every motor | ||
* from a list of motors with unrestricted size. | ||
* Logs the names of all motors that are being idled | ||
* | ||
* @param subsystem | ||
* @param motors | ||
*/ | ||
public MotorIdleGroup(Subsystem subsystem, Motor... motors) { | ||
this("Idling Motors", subsystem, motors); | ||
} | ||
} | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.usfirst.frc4904.robot.commands; | ||
|
||
|
||
import org.usfirst.frc4904.robot.RobotMap; | ||
import edu.wpi.first.wpilibj.command.CommandGroup; | ||
|
||
public class OuttakeSquared extends CommandGroup { | ||
|
||
public OuttakeSquared() { | ||
super("OuttakeSquared"); | ||
requires(RobotMap.Component.crateIO); | ||
requires(RobotMap.Component.rollyBOI); | ||
addParallel(new IndexerOuttake()); | ||
addParallel(new IntakeRollersOuttake()); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.usfirst.frc4904.robot.humaninterface.operators; | ||
|
||
|
||
import org.usfirst.frc4904.robot.RobotMap; | ||
import org.usfirst.frc4904.robot.commands.IndexerGrabberClasp; | ||
import org.usfirst.frc4904.robot.commands.IndexerGrabberRelease; | ||
import org.usfirst.frc4904.robot.commands.IntakeSquared; | ||
import org.usfirst.frc4904.robot.commands.OuttakeSquared; | ||
import org.usfirst.frc4904.standard.humaninput.Operator; | ||
|
||
public class DefaultOperator extends Operator { | ||
public DefaultOperator() { | ||
super("DefaultOperator"); | ||
} | ||
|
||
public DefaultOperator(String name) { | ||
super(name); | ||
} | ||
|
||
@Override | ||
public void bindCommands() { | ||
RobotMap.Component.joystick.button3.onlyWhileHeld(new IntakeSquared()); | ||
RobotMap.Component.joystick.button3.whenPressed(new IndexerGrabberRelease()); | ||
RobotMap.Component.joystick.button3.whenReleased(new IndexerGrabberClasp()); | ||
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. This feels janky. Is there any way you can set the default state by clasping? 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. We can't make it part of the default command because it might act weirdly if we tell it to go to a certain state repeatedly 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. I just looked @ what we did for GearIO last year, which you will want to model. Essentially we have two commands mapped to button3, one of them being 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. That is what this code is doing now. This code is in a format like GearIO, we have two commands mapped to button3 and button 4 |
||
RobotMap.Component.joystick.button4.onlyWhileHeld(new OuttakeSquared()); | ||
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. we need buttons 5 & 6 to be mapped to forcefully opening and closing the rollyBOI pistons, in that order. |
||
RobotMap.Component.joystick.button4.whenPressed(new IndexerGrabberRelease()); | ||
RobotMap.Component.joystick.button4.whenReleased(new IndexerGrabberClasp()); | ||
} | ||
} |
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 wouldn't put anything here.