mirror of
https://github.com/Team4388/2022NoWayHome.git
synced 2026-06-09 00:38:05 -06:00
Created subsystem and initial behavior
This commit is contained in:
@@ -67,6 +67,15 @@ public final class Constants {
|
|||||||
public static final int SMARTDASHBOARD_UPDATE_FRAME = 2;
|
public static final int SMARTDASHBOARD_UPDATE_FRAME = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final class SerializerConstants {
|
||||||
|
public static final double SERIALIZER_BELT_SPEED = 1.0; // TODO (currently max power, DO NOT RUN)
|
||||||
|
public static final double SERIALIZER_SHOOTER_BELT_SPEED = 1.0; // TODO (currently max power, DO NOT RUN)
|
||||||
|
|
||||||
|
// CAN IDs
|
||||||
|
public static final int SERIALIZER_BELT = 1; // TODO
|
||||||
|
public static final int SERIALIZER_SHOOTER_BELT = 1; // TODO
|
||||||
|
}
|
||||||
|
|
||||||
public static final class LEDConstants {
|
public static final class LEDConstants {
|
||||||
public static final int LED_SPARK_ID = 0;
|
public static final int LED_SPARK_ID = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import edu.wpi.first.wpilibj2.command.RunCommand;
|
|||||||
import edu.wpi.first.wpilibj2.command.button.JoystickButton;
|
import edu.wpi.first.wpilibj2.command.button.JoystickButton;
|
||||||
import frc4388.robot.Constants.*;
|
import frc4388.robot.Constants.*;
|
||||||
import frc4388.robot.subsystems.LED;
|
import frc4388.robot.subsystems.LED;
|
||||||
|
import frc4388.robot.subsystems.Serializer;
|
||||||
import frc4388.robot.subsystems.SwerveDrive;
|
import frc4388.robot.subsystems.SwerveDrive;
|
||||||
import frc4388.utility.LEDPatterns;
|
import frc4388.utility.LEDPatterns;
|
||||||
import frc4388.utility.controller.IHandController;
|
import frc4388.utility.controller.IHandController;
|
||||||
@@ -39,6 +40,8 @@ public class RobotContainer {
|
|||||||
m_robotMap.rightBackEncoder
|
m_robotMap.rightBackEncoder
|
||||||
);
|
);
|
||||||
|
|
||||||
|
private final Serializer m_robotSerializer = new Serializer();
|
||||||
|
|
||||||
private final LED m_robotLED = new LED(m_robotMap.LEDController);
|
private final LED m_robotLED = new LED(m_robotMap.LEDController);
|
||||||
|
|
||||||
/* Controllers */
|
/* Controllers */
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package frc4388.robot.subsystems;
|
||||||
|
|
||||||
|
import edu.wpi.first.wpilibj.command.Subsystem;
|
||||||
|
import edu.wpi.first.wpilibj.motorcontrol.Spark;
|
||||||
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||||
|
import frc4388.robot.Constants;
|
||||||
|
|
||||||
|
public class Serializer extends SubsystemBase{
|
||||||
|
private Spark m_serializerBelt;
|
||||||
|
private Spark m_serializerShooterBelt;
|
||||||
|
|
||||||
|
private boolean serializerState;
|
||||||
|
|
||||||
|
public Serializer(Spark serializerBelt, Spark serializerShooterBelt) {
|
||||||
|
m_serializerBelt = serializerBelt;
|
||||||
|
m_serializerShooterBelt = serializerShooterBelt;
|
||||||
|
|
||||||
|
serializerState = false;
|
||||||
|
setSerializerState(serializerState);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSerializerState(boolean state) {
|
||||||
|
double serializerBeltSpeed = state ? Constants.SerializerConstants.SERIALIZER_BELT_SPEED : 0.d;
|
||||||
|
double serializerShooterBeltSpeed = state ? Constants.SerializerConstants.SERIALIZER_SHOOTER_BELT_SPEED : 0.d;
|
||||||
|
|
||||||
|
m_serializerBelt.set(serializerBeltSpeed);
|
||||||
|
m_serializerShooterBelt.set(serializerShooterBeltSpeed);
|
||||||
|
|
||||||
|
serializerState = state;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user