Merge branch 'master' into inline-commands

This commit is contained in:
Keenan D. Buckley
2020-01-06 03:50:59 +00:00
committed by GitHub
7 changed files with 51 additions and 24 deletions
@@ -68,21 +68,32 @@ public class RobotContainer {
return new InstantCommand();
}
/**
* Add your docs here.
*/
public IHandController getDriverController() {
return m_driverXbox;
}
/**
* Add your docs here.
*/
public IHandController getOperatorController()
{
return m_operatorXbox;
}
/**
* Add your docs here.
*/
public Joystick getOperatorJoystick()
{
return m_operatorXbox.getJoyStick();
}
/**
* Add your docs here.
*/
public Joystick getDriverJoystick()
{
return m_driverXbox.getJoyStick();
@@ -9,8 +9,8 @@ package frc4388.robot.commands.LED;
import edu.wpi.first.wpilibj2.command.InstantCommand;
import frc4388.robot.constants.LEDPatterns;
import frc4388.robot.subsystems.LED;
import frc4388.utility.LEDPatterns;
// NOTE: Consider using this command inline, rather than writing a subclass. For more
// information, see:
@@ -20,6 +20,9 @@ public class SetLEDPattern extends InstantCommand {
private final LED m_led;
public static LEDPatterns m_pattern;
/**
* Add your docs here.
*/
public SetLEDPattern(LED subsystem, LEDPatterns pattern) {
m_led = subsystem;
m_pattern = pattern;
@@ -30,6 +30,9 @@ public class Drive extends SubsystemBase {
public static DifferentialDrive m_driveTrain = new DifferentialDrive(m_leftFrontMotor, m_rightFrontMotor);
/**
* Add your docs here.
*/
public Drive(){
/* factory default values */
m_leftFrontMotor.configFactoryDefault();
@@ -54,14 +57,10 @@ public class Drive extends SubsystemBase {
m_rightBackMotor.setInverted(InvertType.FollowMaster);
}
/**
* Add your docs here.
*/
public void driveWithInput(double move, double 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 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
@@ -23,6 +23,9 @@ public class LED extends SubsystemBase {
public static float currentLED;
public static Spark LEDController;
/**
* Add your docs here.
*/
public LED(){
LEDController = new Spark(LEDConstants.LED_SPARK_ID);
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.");
}
/**
* Add your docs here.
*/
public void updateLED(){
LEDController.set(currentLED);
}
/**
* Add your docs here.
*/
public void setPattern(LEDPatterns pattern){
currentLED = pattern.getValue();
LEDController.set(currentLED);
@@ -43,11 +52,4 @@ public class LED extends SubsystemBase {
public void periodic(){
SmartDashboard.putNumber("LED", currentLED);
}
/* @Override
public void initDefaultCommand() {
// Set the default command for a subsystem here.
// setDefaultCommand(new MySpecialCommand());
setDefaultCommand(new UpdateLED());
} */
}
@@ -1,7 +1,10 @@
package frc4388.robot.constants;
package frc4388.utility;
/**
* Add your docs here.
*/
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_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),
@@ -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),
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_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_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_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_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_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);
// GETTERS/SETTERS
/* GETTERS/SETTERS */
private final float id;
LEDPatterns(float id) {
this.id = id;
@@ -1,5 +1,8 @@
package frc4388.utility.controller;
/**
* Add your docs here.
*/
public interface IHandController {
public double getLeftXAxis();
@@ -52,10 +52,16 @@ public class XboxController implements IHandController
private Joystick m_stick;
/**
* Add your docs here.
*/
public XboxController(int portNumber){
m_stick = new Joystick(portNumber);
}
/**
* Add your docs here.
*/
public Joystick getJoyStick() {
return m_stick;
}