Compare commits
No commits in common. "e6e16b891e34c5c76d9a9b1c9b0ef42597e406af" and "4906c7f0fb4d051a38416c39349e2874f47d4016" have entirely different histories.
e6e16b891e
...
4906c7f0fb
@ -2,5 +2,5 @@
|
||||
"enableCppIntellisense": false,
|
||||
"currentLanguage": "java",
|
||||
"projectYear": "2025",
|
||||
"teamNumber": 9998
|
||||
"teamNumber": 2648
|
||||
}
|
||||
@ -1,92 +0,0 @@
|
||||
{
|
||||
"keyboardJoysticks": [
|
||||
{
|
||||
"axisConfig": [
|
||||
{
|
||||
"decKey": 65,
|
||||
"incKey": 68
|
||||
},
|
||||
{
|
||||
"decKey": 87,
|
||||
"incKey": 83
|
||||
},
|
||||
{
|
||||
"decKey": 69,
|
||||
"decayRate": 0.0,
|
||||
"incKey": 82,
|
||||
"keyRate": 0.009999999776482582
|
||||
}
|
||||
],
|
||||
"axisCount": 3,
|
||||
"buttonCount": 4,
|
||||
"buttonKeys": [
|
||||
90,
|
||||
88,
|
||||
67,
|
||||
86
|
||||
],
|
||||
"povConfig": [
|
||||
{
|
||||
"key0": 328,
|
||||
"key135": 323,
|
||||
"key180": 322,
|
||||
"key225": 321,
|
||||
"key270": 324,
|
||||
"key315": 327,
|
||||
"key45": 329,
|
||||
"key90": 326
|
||||
}
|
||||
],
|
||||
"povCount": 1
|
||||
},
|
||||
{
|
||||
"axisConfig": [
|
||||
{
|
||||
"decKey": 74,
|
||||
"incKey": 76
|
||||
},
|
||||
{
|
||||
"decKey": 73,
|
||||
"incKey": 75
|
||||
}
|
||||
],
|
||||
"axisCount": 2,
|
||||
"buttonCount": 4,
|
||||
"buttonKeys": [
|
||||
77,
|
||||
44,
|
||||
46,
|
||||
47
|
||||
],
|
||||
"povCount": 0
|
||||
},
|
||||
{
|
||||
"axisConfig": [
|
||||
{
|
||||
"decKey": 263,
|
||||
"incKey": 262
|
||||
},
|
||||
{
|
||||
"decKey": 265,
|
||||
"incKey": 264
|
||||
}
|
||||
],
|
||||
"axisCount": 2,
|
||||
"buttonCount": 6,
|
||||
"buttonKeys": [
|
||||
260,
|
||||
268,
|
||||
266,
|
||||
261,
|
||||
269,
|
||||
267
|
||||
],
|
||||
"povCount": 0
|
||||
},
|
||||
{
|
||||
"axisCount": 0,
|
||||
"buttonCount": 0,
|
||||
"povCount": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -4,27 +4,19 @@
|
||||
|
||||
package frc.robot;
|
||||
|
||||
import static edu.wpi.first.units.Units.Second;
|
||||
|
||||
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
|
||||
|
||||
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||
import edu.wpi.first.wpilibj.util.Color;
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import edu.wpi.first.wpilibj2.command.Commands;
|
||||
import edu.wpi.first.wpilibj2.command.RunCommand;
|
||||
import edu.wpi.first.wpilibj2.command.WaitCommand;
|
||||
import edu.wpi.first.wpilibj2.command.button.CommandPS5Controller;
|
||||
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
|
||||
import edu.wpi.first.wpilibj2.command.button.Trigger;
|
||||
import frc.robot.constants.ArmConstants;
|
||||
import frc.robot.constants.IOConstants;
|
||||
import frc.robot.constants.LEDConstants;
|
||||
import frc.robot.subsystems.Arm;
|
||||
import frc.robot.subsystems.DriveTrain;
|
||||
import frc.robot.subsystems.Grabber;
|
||||
import frc.robot.subsystems.HighFive;
|
||||
import frc.robot.subsystems.LEDs;
|
||||
|
||||
public class RobotContainer {
|
||||
private CommandPS5Controller driver;
|
||||
@ -32,8 +24,6 @@ public class RobotContainer {
|
||||
private DriveTrain driveTrain;
|
||||
private Grabber grabber;
|
||||
private HighFive highFive;
|
||||
private LEDs leds;
|
||||
|
||||
|
||||
public RobotContainer() {
|
||||
arm = new Arm();
|
||||
@ -41,7 +31,6 @@ public class RobotContainer {
|
||||
grabber = new Grabber();
|
||||
driver = new CommandPS5Controller(IOConstants.kDriverID0);
|
||||
highFive = new HighFive();
|
||||
leds = new LEDs(LEDConstants.kPWMPortID, LEDConstants.kNumLEDs);
|
||||
configureBindings();
|
||||
}
|
||||
|
||||
@ -65,19 +54,6 @@ public class RobotContainer {
|
||||
|
||||
driver.povDown().whileTrue(arm.runArmMotor(-1));
|
||||
|
||||
Trigger highFiveTrigger = new Trigger(highFive::SwitchDigitalInput);
|
||||
|
||||
highFiveTrigger.onFalse(
|
||||
leds.blinkColorchange(Color.kGreen, Color.kRed, Color.kBlue, 0.5, 2)
|
||||
.andThen(
|
||||
//new WaitCommand(5),
|
||||
leds.setAll(Color.kBlack)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
Shuffleboard.getTab("HighFive")
|
||||
.addBoolean("Switch Pressed", () -> highFive.SwitchDigitalInput());
|
||||
}
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
package frc.robot.constants;
|
||||
|
||||
public class LEDConstants {
|
||||
public static final int kPWMPortID = 0;
|
||||
public static final int kNumLEDs = 256;
|
||||
}
|
||||
@ -1,90 +0,0 @@
|
||||
package frc.robot.subsystems;
|
||||
|
||||
import edu.wpi.first.wpilibj.AddressableLED;
|
||||
import edu.wpi.first.wpilibj.AddressableLEDBuffer;
|
||||
import edu.wpi.first.wpilibj.util.Color;
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import edu.wpi.first.wpilibj2.command.Commands;
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
import edu.wpi.first.wpilibj2.command.WaitCommand;
|
||||
|
||||
public class LEDs extends SubsystemBase {
|
||||
private AddressableLED leds;
|
||||
private AddressableLEDBuffer buffer;
|
||||
|
||||
private int fluidColorIndex;
|
||||
|
||||
public LEDs(int pwmPort, int numLEDs) {
|
||||
buffer = new AddressableLEDBuffer(numLEDs);
|
||||
leds = new AddressableLED(pwmPort);
|
||||
leds.setLength(numLEDs);
|
||||
leds.setData(buffer);
|
||||
leds.start();
|
||||
|
||||
fluidColorIndex = 0;
|
||||
}
|
||||
|
||||
public Command fluidColor(double delayTime) {
|
||||
return Commands.repeatingSequence(
|
||||
runOnce(() -> {
|
||||
for(int i = 0; i < buffer.getLength(); i++) {
|
||||
buffer.setHSV(i, (i + fluidColorIndex) % 180, 255, 255);
|
||||
}
|
||||
leds.setData(buffer);
|
||||
fluidColorIndex++;
|
||||
}),
|
||||
new WaitCommand(delayTime)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public Command blinkColor(Color color, double delayTime, int times) {
|
||||
Command sequence = Commands.none(); // start with an empty command
|
||||
|
||||
for (int i = 0; i < times; i++) {
|
||||
sequence = Commands.sequence(
|
||||
sequence,
|
||||
setAll(color),
|
||||
new WaitCommand(delayTime),
|
||||
setAll(Color.kBlack),
|
||||
new WaitCommand(delayTime)
|
||||
);
|
||||
}
|
||||
|
||||
return sequence;
|
||||
}
|
||||
|
||||
public Command blinkColorchange(Color color, Color color2, Color color3, double delayTime, int times) {
|
||||
Command sequence = Commands.none(); // start with an empty command
|
||||
|
||||
for (int i = 0; i < times; i++) {
|
||||
sequence = Commands.sequence(
|
||||
sequence,
|
||||
setAll(color),
|
||||
new WaitCommand(delayTime),
|
||||
setAll(color2),
|
||||
new WaitCommand(delayTime),
|
||||
setAll(color3),
|
||||
new WaitCommand(delayTime)
|
||||
);
|
||||
}
|
||||
|
||||
return sequence;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public Command setAll(Color color) {
|
||||
return runOnce(() -> {
|
||||
for(int i = 0; i < buffer.getLength(); i++) {
|
||||
buffer.setLED(i, color);
|
||||
}
|
||||
|
||||
leds.setData(buffer);
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user