mirror of
https://github.com/Team4388/Robot-Essentials.git
synced 2026-06-09 00:38:01 -06:00
Merge branch 'master' into inline-commands
This commit is contained in:
@@ -68,21 +68,32 @@ public class RobotContainer {
|
|||||||
return new InstantCommand();
|
return new InstantCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your docs here.
|
||||||
|
*/
|
||||||
public IHandController getDriverController() {
|
public IHandController getDriverController() {
|
||||||
return m_driverXbox;
|
return m_driverXbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your docs here.
|
||||||
|
*/
|
||||||
public IHandController getOperatorController()
|
public IHandController getOperatorController()
|
||||||
{
|
{
|
||||||
return m_operatorXbox;
|
return m_operatorXbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your docs here.
|
||||||
|
*/
|
||||||
public Joystick getOperatorJoystick()
|
public Joystick getOperatorJoystick()
|
||||||
{
|
{
|
||||||
return m_operatorXbox.getJoyStick();
|
return m_operatorXbox.getJoyStick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your docs here.
|
||||||
|
*/
|
||||||
public Joystick getDriverJoystick()
|
public Joystick getDriverJoystick()
|
||||||
{
|
{
|
||||||
return m_driverXbox.getJoyStick();
|
return m_driverXbox.getJoyStick();
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ package frc4388.robot.commands.LED;
|
|||||||
|
|
||||||
import edu.wpi.first.wpilibj2.command.InstantCommand;
|
import edu.wpi.first.wpilibj2.command.InstantCommand;
|
||||||
|
|
||||||
import frc4388.robot.constants.LEDPatterns;
|
|
||||||
import frc4388.robot.subsystems.LED;
|
import frc4388.robot.subsystems.LED;
|
||||||
|
import frc4388.utility.LEDPatterns;
|
||||||
|
|
||||||
// NOTE: Consider using this command inline, rather than writing a subclass. For more
|
// NOTE: Consider using this command inline, rather than writing a subclass. For more
|
||||||
// information, see:
|
// information, see:
|
||||||
@@ -20,6 +20,9 @@ public class SetLEDPattern extends InstantCommand {
|
|||||||
private final LED m_led;
|
private final LED m_led;
|
||||||
public static LEDPatterns m_pattern;
|
public static LEDPatterns m_pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your docs here.
|
||||||
|
*/
|
||||||
public SetLEDPattern(LED subsystem, LEDPatterns pattern) {
|
public SetLEDPattern(LED subsystem, LEDPatterns pattern) {
|
||||||
m_led = subsystem;
|
m_led = subsystem;
|
||||||
m_pattern = pattern;
|
m_pattern = pattern;
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ public class Drive extends SubsystemBase {
|
|||||||
|
|
||||||
public static DifferentialDrive m_driveTrain = new DifferentialDrive(m_leftFrontMotor, m_rightFrontMotor);
|
public static DifferentialDrive m_driveTrain = new DifferentialDrive(m_leftFrontMotor, m_rightFrontMotor);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your docs here.
|
||||||
|
*/
|
||||||
public Drive(){
|
public Drive(){
|
||||||
/* factory default values */
|
/* factory default values */
|
||||||
m_leftFrontMotor.configFactoryDefault();
|
m_leftFrontMotor.configFactoryDefault();
|
||||||
@@ -54,14 +57,10 @@ public class Drive extends SubsystemBase {
|
|||||||
m_rightBackMotor.setInverted(InvertType.FollowMaster);
|
m_rightBackMotor.setInverted(InvertType.FollowMaster);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your docs here.
|
||||||
|
*/
|
||||||
public void driveWithInput(double move, double steer){
|
public void driveWithInput(double move, double steer){
|
||||||
m_driveTrain.arcadeDrive(move, steer);
|
m_driveTrain.arcadeDrive(move, steer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @Override
|
|
||||||
public void initDefaultCommand(){
|
|
||||||
// Set the default command for a subsystem here.
|
|
||||||
// setDefaultCommand(new MySpecialCommand());
|
|
||||||
setDefaultCommand(new DriveWithJoystick());
|
|
||||||
} */
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
|||||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
|
|
||||||
import frc4388.robot.Constants.LEDConstants;
|
import frc4388.robot.Constants.LEDConstants;
|
||||||
import frc4388.robot.constants.LEDPatterns;
|
import frc4388.utility.LEDPatterns;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows for the control of a 5v LED Strip using a Rev Robotics Blinkin LED
|
* Allows for the control of a 5v LED Strip using a Rev Robotics Blinkin LED
|
||||||
@@ -23,6 +23,9 @@ public class LED extends SubsystemBase {
|
|||||||
public static float currentLED;
|
public static float currentLED;
|
||||||
public static Spark LEDController;
|
public static Spark LEDController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your docs here.
|
||||||
|
*/
|
||||||
public LED(){
|
public LED(){
|
||||||
LEDController = new Spark(LEDConstants.LED_SPARK_ID);
|
LEDController = new Spark(LEDConstants.LED_SPARK_ID);
|
||||||
setPattern(LEDPatterns.FOREST_WAVES);
|
setPattern(LEDPatterns.FOREST_WAVES);
|
||||||
@@ -30,10 +33,16 @@ public class LED extends SubsystemBase {
|
|||||||
System.err.println("In the Beginning, there was Joe.\nAnd he said, 'Let there be LEDs.'\nAnd it was good.");
|
System.err.println("In the Beginning, there was Joe.\nAnd he said, 'Let there be LEDs.'\nAnd it was good.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your docs here.
|
||||||
|
*/
|
||||||
public void updateLED(){
|
public void updateLED(){
|
||||||
LEDController.set(currentLED);
|
LEDController.set(currentLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your docs here.
|
||||||
|
*/
|
||||||
public void setPattern(LEDPatterns pattern){
|
public void setPattern(LEDPatterns pattern){
|
||||||
currentLED = pattern.getValue();
|
currentLED = pattern.getValue();
|
||||||
LEDController.set(currentLED);
|
LEDController.set(currentLED);
|
||||||
@@ -43,11 +52,4 @@ public class LED extends SubsystemBase {
|
|||||||
public void periodic(){
|
public void periodic(){
|
||||||
SmartDashboard.putNumber("LED", currentLED);
|
SmartDashboard.putNumber("LED", currentLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @Override
|
|
||||||
public void initDefaultCommand() {
|
|
||||||
// Set the default command for a subsystem here.
|
|
||||||
// setDefaultCommand(new MySpecialCommand());
|
|
||||||
setDefaultCommand(new UpdateLED());
|
|
||||||
} */
|
|
||||||
}
|
}
|
||||||
+10
-7
@@ -1,7 +1,10 @@
|
|||||||
package frc4388.robot.constants;
|
package frc4388.utility;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your docs here.
|
||||||
|
*/
|
||||||
public enum LEDPatterns {
|
public enum LEDPatterns {
|
||||||
// PALLETTE PATTERNS
|
/* PALLETTE PATTERNS */
|
||||||
RAINBOW_RAINBOW(-0.99f), PARTY_RAINBOW(-0.97f), OCEAN_RAINBOW(-0.95f), LAVA_RAINBOW(-0.93f), FOREST_RAINBOW(-0.91f),
|
RAINBOW_RAINBOW(-0.99f), PARTY_RAINBOW(-0.97f), OCEAN_RAINBOW(-0.95f), LAVA_RAINBOW(-0.93f), FOREST_RAINBOW(-0.91f),
|
||||||
RAINBOW_GLITTER(-0.89f), CONFETTI(-0.87f), RED_SHOT(-0.85f), BLUE_SHOT(-0.83f), WHITE_SHOT(-0.81f), RAINBOW_SINELON(-0.79f),
|
RAINBOW_GLITTER(-0.89f), CONFETTI(-0.87f), RED_SHOT(-0.85f), BLUE_SHOT(-0.83f), WHITE_SHOT(-0.81f), RAINBOW_SINELON(-0.79f),
|
||||||
PARTY_SINELON(-0.77f), OCEAN_SINELON(-0.75f), LAVA_SINELON(-0.73f), FOREST_SINELON(-0.71f), RAINBOW_BPM(-0.69f),
|
PARTY_SINELON(-0.77f), OCEAN_SINELON(-0.75f), LAVA_SINELON(-0.73f), FOREST_SINELON(-0.71f), RAINBOW_BPM(-0.69f),
|
||||||
@@ -12,26 +15,26 @@ public enum LEDPatterns {
|
|||||||
BLUE_HEARTBEAT(-0.23f), WHITE_HEARTBEAT(-0.21f), GRAY_HEARBEAT(-0.19f), RED_BREATH(-0.17f), BLUE_BREATH(-0.15f),
|
BLUE_HEARTBEAT(-0.23f), WHITE_HEARTBEAT(-0.21f), GRAY_HEARBEAT(-0.19f), RED_BREATH(-0.17f), BLUE_BREATH(-0.15f),
|
||||||
GRAY_BREATH(-0.13f), RED_STROBE(-0.11f), BLUE_STROBE(-0.09f), GOLD_STROBE(-0.07f), WHITE_STROBE(-0.05f),
|
GRAY_BREATH(-0.13f), RED_STROBE(-0.11f), BLUE_STROBE(-0.09f), GOLD_STROBE(-0.07f), WHITE_STROBE(-0.05f),
|
||||||
|
|
||||||
// COLOR 1 PATTERNS
|
/* COLOR 1 PATTERNS */
|
||||||
C1_END_TO_END(-0.03f), C1_SCANNER(-0.01f), C1_CHASE(0.01f), C1_HEARTBEAT_SLOW(0.03f), C1_HEARTBEAT_MEDIUM(0.05f),
|
C1_END_TO_END(-0.03f), C1_SCANNER(-0.01f), C1_CHASE(0.01f), C1_HEARTBEAT_SLOW(0.03f), C1_HEARTBEAT_MEDIUM(0.05f),
|
||||||
C1_HEARTBEAT_FAST(0.07f), C1_BREATH_SLOW(0.09f), C1_BREATH_FAST(0.11f), C1_SHOT(0.13f), C1_STROBE(0.15f),
|
C1_HEARTBEAT_FAST(0.07f), C1_BREATH_SLOW(0.09f), C1_BREATH_FAST(0.11f), C1_SHOT(0.13f), C1_STROBE(0.15f),
|
||||||
|
|
||||||
// COLOR 2 PATTERNS
|
/* COLOR 2 PATTERNS */
|
||||||
C2_END_TO_END(0.17f), C2_SCANNER(0.19f), C2_CHASE(0.21f), C2_HEARTBEAT_SLOW(0.23f), C2_HEARTBEAT_MEDIUM(0.25f),
|
C2_END_TO_END(0.17f), C2_SCANNER(0.19f), C2_CHASE(0.21f), C2_HEARTBEAT_SLOW(0.23f), C2_HEARTBEAT_MEDIUM(0.25f),
|
||||||
C2_HEARTBEAT_FAST(0.27f), C2_BREATH_SLOW(0.29f), C2_BREATH_FAST(0.31f), C2_SHOT(0.33f), C2_STROBE(0.35f),
|
C2_HEARTBEAT_FAST(0.27f), C2_BREATH_SLOW(0.29f), C2_BREATH_FAST(0.31f), C2_SHOT(0.33f), C2_STROBE(0.35f),
|
||||||
|
|
||||||
// COLOR 1 AND 2 PATTERNS
|
/* COLOR 1 AND 2 PATTERNS */
|
||||||
C1C2_SPARKLE(0.37f), C2C1_SPARKLE(0.39f), C1C2_GRADIENT(0.41f), C1C2_BPM(0.43f), C1C2_BLEND(0.45f), C1C2_TWINKLES(0.51f),
|
C1C2_SPARKLE(0.37f), C2C1_SPARKLE(0.39f), C1C2_GRADIENT(0.41f), C1C2_BPM(0.43f), C1C2_BLEND(0.45f), C1C2_TWINKLES(0.51f),
|
||||||
C1C2_WAVES(0.53f), C1C2_SINELON(0.55f),
|
C1C2_WAVES(0.53f), C1C2_SINELON(0.55f),
|
||||||
|
|
||||||
// SOLID COLORS
|
/* SOLID COLORS */
|
||||||
SOLID_PINK_HOT(0.57f), SOLID_RED_DARK(0.59f), SOLID_RED(0.61f), SOLID_RED_ORANGE(0.63f), SOLID_ORANGE(0.65f),
|
SOLID_PINK_HOT(0.57f), SOLID_RED_DARK(0.59f), SOLID_RED(0.61f), SOLID_RED_ORANGE(0.63f), SOLID_ORANGE(0.65f),
|
||||||
SOLID_GOLD(0.67f), SOLID_YELLOW(0.69f), SOLID_GREEN_LAWN(0.71f), SOLID_GREEN_LIME(0.73f), SOLID_GREEN_DARK(0.75f),
|
SOLID_GOLD(0.67f), SOLID_YELLOW(0.69f), SOLID_GREEN_LAWN(0.71f), SOLID_GREEN_LIME(0.73f), SOLID_GREEN_DARK(0.75f),
|
||||||
SOLID_GREEN(0.77f), SOLID_BLUE_GREEN(0.79f), SOLID_BLUE_AQUA(0.81f), SOLID_BLUE_SKY(0.83f), SOLID_BLUE_DARK(0.85f),
|
SOLID_GREEN(0.77f), SOLID_BLUE_GREEN(0.79f), SOLID_BLUE_AQUA(0.81f), SOLID_BLUE_SKY(0.83f), SOLID_BLUE_DARK(0.85f),
|
||||||
SOLID_BLUE(0.87f), SOLID_BLUE_VIOLET(0.89f), SOLID_VIOLET(0.91f), SOLID_WHITE(0.93f), SOLID_GRAY(0.95f),
|
SOLID_BLUE(0.87f), SOLID_BLUE_VIOLET(0.89f), SOLID_VIOLET(0.91f), SOLID_WHITE(0.93f), SOLID_GRAY(0.95f),
|
||||||
SOLID_GRAY_DARK(0.97f), SOLID_BLACK(0.99f);
|
SOLID_GRAY_DARK(0.97f), SOLID_BLACK(0.99f);
|
||||||
|
|
||||||
// GETTERS/SETTERS
|
/* GETTERS/SETTERS */
|
||||||
private final float id;
|
private final float id;
|
||||||
LEDPatterns(float id) {
|
LEDPatterns(float id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
package frc4388.utility.controller;
|
package frc4388.utility.controller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your docs here.
|
||||||
|
*/
|
||||||
public interface IHandController {
|
public interface IHandController {
|
||||||
|
|
||||||
public double getLeftXAxis();
|
public double getLeftXAxis();
|
||||||
|
|||||||
@@ -52,10 +52,16 @@ public class XboxController implements IHandController
|
|||||||
|
|
||||||
private Joystick m_stick;
|
private Joystick m_stick;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your docs here.
|
||||||
|
*/
|
||||||
public XboxController(int portNumber){
|
public XboxController(int portNumber){
|
||||||
m_stick = new Joystick(portNumber);
|
m_stick = new Joystick(portNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add your docs here.
|
||||||
|
*/
|
||||||
public Joystick getJoyStick() {
|
public Joystick getJoyStick() {
|
||||||
return m_stick;
|
return m_stick;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user