Skip to content

Commit

Permalink
asdf
Browse files Browse the repository at this point in the history
  • Loading branch information
legoguy1000 committed Oct 20, 2024
1 parent eb50d9a commit 9368986
Show file tree
Hide file tree
Showing 7 changed files with 212 additions and 78 deletions.
Empty file.
41 changes: 41 additions & 0 deletions src/main/java/frc/robot/subsystems/Intake.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package frc.robot.subsystems;

import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.motorcontrol.VictorSP;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.SubsystemBase;

public class Intake extends SubsystemBase {

Check warning on line 9 in src/main/java/frc/robot/subsystems/Intake.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] src/main/java/frc/robot/subsystems/Intake.java#L9 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/main/java/frc/robot/subsystems/Intake.java:9:1: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck)

VictorSP intakeMotor1 = new VictorSP(1);
VictorSP intakeMotor2 = new VictorSP(2);

public DigitalInput touchSensor = new DigitalInput(1);

public Intake() {
intakeMotor2.setInverted(true);
intakeMotor1.addFollower(intakeMotor2);
}

public void setPower(double power) {
intakeMotor1.set(power);
}

public void intake() {
setPower(-0.7);
}

public void outtake() {
setPower(0.7);
}

public void stop() {
setPower(0);
}

public Command intakeCommand() {
return Commands.runEnd(this::intake, this::stop, this); // .until(() -> beambrake.get());
}

}
45 changes: 45 additions & 0 deletions src/main/java/frc/robot/subsystems/LEDs.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package frc.robot.subsystems;

import edu.wpi.first.wpilibj.AddressableLED;
import edu.wpi.first.wpilibj.AddressableLEDBuffer;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.DriverStation.Alliance;
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;

public class LEDs extends SubsystemBase {

Check warning on line 12 in src/main/java/frc/robot/subsystems/LEDs.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] src/main/java/frc/robot/subsystems/LEDs.java#L12 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/main/java/frc/robot/subsystems/LEDs.java:12:1: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck)

AddressableLED leds;
AddressableLEDBuffer buffer;

public LEDs(int portNum, int length) {

Check warning on line 17 in src/main/java/frc/robot/subsystems/LEDs.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] src/main/java/frc/robot/subsystems/LEDs.java#L17 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/main/java/frc/robot/subsystems/LEDs.java:17:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
this.leds = new AddressableLED(portNum);
this.buffer = new AddressableLEDBuffer(length);
leds.setLength(buffer.getLength());
leds.setData(buffer);
leds.start();
}

public void setColor(Color color) {

Check warning on line 25 in src/main/java/frc/robot/subsystems/LEDs.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] src/main/java/frc/robot/subsystems/LEDs.java#L25 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/main/java/frc/robot/subsystems/LEDs.java:25:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
for (var i = 0; i < buffer.getLength(); i++) {
buffer.setLED(i, color);
}
leds.setData(buffer);
}

public Command setAllianceColor() {

Check warning on line 32 in src/main/java/frc/robot/subsystems/LEDs.java

View workflow job for this annotation

GitHub Actions / testtool

[testtool] src/main/java/frc/robot/subsystems/LEDs.java#L32 <com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck>

Missing a Javadoc comment.
Raw output
/github/workspace/./src/main/java/frc/robot/subsystems/LEDs.java:32:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)
return Commands.run(() -> {
Color color = Color.kYellow;
if (DriverStation.getAlliance().isPresent()) {
if (DriverStation.getAlliance().get() == Alliance.Red) {
color = Color.kRed;
} else {
color = Color.kBlue;
}
}
setColor(color);
}, this);
}
}
126 changes: 126 additions & 0 deletions src/main/java/frc/robot/subsystems/LEDs.java.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
package frc.robot.subsystems;

import java.util.function.Supplier;
import edu.wpi.first.wpilibj.AddressableLED;
import edu.wpi.first.wpilibj.AddressableLEDBuffer;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.DriverStation.Alliance;
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;

/**
* This is the class header for the LEDs Subsystem
*/
public class LEDs extends SubsystemBase {
private AddressableLEDBuffer controLedBuffer;
private AddressableLED addressableLED;

/**
* constructs a LED Subsystem
*
* @param length length of the addressable LEDS
* @param port port ID for PWM
*/
public LEDs(int length, int port) {
controLedBuffer = new AddressableLEDBuffer(length);
addressableLED = new AddressableLED(port);

addressableLED.setLength(controLedBuffer.getLength());
addressableLED.setData(controLedBuffer);
addressableLED.start();
}

/**
* Get LED strip length
*
* @return number of LEDs
*/
public int getLength() {
return controLedBuffer.getLength();
}

/**
* Set individual LED color via HSV
*
* @param index the LED index to set
* @param h the h value [0-180)
* @param s the s value [0-255]
* @param v the v value [0-255]
*/
public void setHSV(int index, int h, int s, int v) {
controLedBuffer.setHSV(index, h, s, v);
}

/**
* Sets the LED output data.
*/
public void setData() {
addressableLED.setData(controLedBuffer);
}

/**
* Set individual LED color via RGB
*
* @param index the LED index to set
* @param r the r value [0-255]
* @param g the g value [0-255]
* @param b the b value [0-255]
*/
public void setRGB(int index, int r, int g, int b) {
controLedBuffer.setRGB(index, r, g, b);
}

/**
* Sets RGB Color of the entire LED strip
*
* @param r - [0 - 255]
* @param g - [0 - 255]
* @param b - [0 - 255]
*/
public void setRGB(int r, int g, int b) {
for (var i = 0; i < getLength(); i++) {
setRGB(i, r, g, b);
}
setData();
}

/**
* Set individual LED color via Color
*
* @param index the LED index to set
* @param color The color of the LED
*/
public void setColor(int index, Color color) {
controLedBuffer.setLED(index, color);
}

/**
* Sets the Color of the entire LED strip
*
* @param color color set for the LEDs
*/
public void setColor(Color color) {
for (var i = 0; i < getLength(); i++) {
setColor(i, color);
}
setData();
}

public Color getColor(int index) {
return controLedBuffer.getLED(index);
}

public Command setDefaultColor() {
Supplier<Color> colorSupplier = () -> {
Color color = Color.kWhite;
if (DriverStation.getAlliance().isPresent()) {
color =
DriverStation.getAlliance().get() == Alliance.Red ? Color.kRed : Color.kBlue;
}
return color;
};
return Commands.run(() -> setColor(colorSupplier.get()), this).ignoringDisable(true);
}
}
27 changes: 0 additions & 27 deletions src/main/java/frc/robot/subsystems/drive/Drivetrain.java

This file was deleted.

25 changes: 0 additions & 25 deletions src/main/java/frc/robot/subsystems/drive/DrivetrainIO.java

This file was deleted.

26 changes: 0 additions & 26 deletions src/main/java/frc/robot/subsystems/drive/DrivetrainReal.java

This file was deleted.

0 comments on commit 9368986

Please sign in to comment.