Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Gleason committed Nov 4, 2017
1 parent 71bdf9a commit 511abb1
Show file tree
Hide file tree
Showing 329 changed files with 4,592 additions and 1,175 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.usfirst.frc.team449.robot.other.MotionProfileData;
import org.usfirst.frc.team449.robot.subsystem.complex.climber.ClimberCurrentLimited;
import org.usfirst.frc.team449.robot.subsystem.complex.intake.IntakeFixedAndActuated;
import org.usfirst.frc.team449.robot.subsystem.complex.shooter.LoggingShooter;
import org.usfirst.frc.team449.robot.subsystem.complex.shooter.LoggingFlywheel;
import org.usfirst.frc.team449.robot.subsystem.interfaces.solenoid.SolenoidSimple;
import org.usfirst.frc.team449.robot.subsystem.singleImplementation.camera.CameraNetwork;
import org.usfirst.frc.team449.robot.subsystem.singleImplementation.pneumatics.Pneumatics;
Expand Down Expand Up @@ -75,7 +75,7 @@ public class RobotMap2017 {
* The multiSubsystem for shooting fuel. Can be null.
*/
@Nullable
private final LoggingShooter shooter;
private final LoggingFlywheel shooter;

/**
* The cameras on this robot. Can be null.
Expand Down Expand Up @@ -268,7 +268,7 @@ public RobotMap2017(@Nullable @JsonProperty(required = true) List<CommandButton>
@NotNull @JsonProperty(required = true) YamlCommand defaultDriveCommand,
@NotNull @JsonProperty(required = true) MappedRunnable updater,
@Nullable ClimberCurrentLimited climber,
@Nullable LoggingShooter shooter,
@Nullable LoggingFlywheel shooter,
@Nullable CameraNetwork camera,
@Nullable IntakeFixedAndActuated intake,
@Nullable Pneumatics pneumatics,
Expand Down Expand Up @@ -371,7 +371,7 @@ public ClimberCurrentLimited getClimber() {
* @return The multiSubsystem for shooting fuel. Can be null.
*/
@Nullable
public LoggingShooter getShooter() {
public LoggingFlywheel getShooter() {
return shooter;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public class Auto2017Boiler extends YamlCommandGroupWrapper {
* @param allianceSwitch The switch indicating which alliance we're on.
* @param runRedPegToKeyProfile The command for moving from the peg to the key, on the red side of the field.
* @param runBluePegToKeyProfile The command for moving from the peg to the key, on the blue side of the field.
* @param spinUpShooter The command for revving up the shooter. Can be null.
* @param fireShooter The command for firing the shooter. Can be null.
* @param spinUpShooter The command for revving up the flywheel. Can be null.
* @param fireShooter The command for firing the flywheel. Can be null.
* @param waitBetweenProfilesMillis How long to wait between each motion profile. Defaults to 50 if less than 50.
*/
@JsonCreator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import org.usfirst.frc.team449.robot.jacksonWrappers.YamlCommandGroupWrapper;
import org.usfirst.frc.team449.robot.subsystem.interfaces.intake.SubsystemIntake;
import org.usfirst.frc.team449.robot.subsystem.interfaces.intake.commands.SetIntakeMode;
import org.usfirst.frc.team449.robot.subsystem.interfaces.shooter.SubsystemShooter;
import org.usfirst.frc.team449.robot.subsystem.interfaces.shooter.commands.TurnAllOn;
import org.usfirst.frc.team449.robot.subsystem.interfaces.flywheel.SubsystemFlywheel;
import org.usfirst.frc.team449.robot.subsystem.interfaces.flywheel.commands.TurnAllOn;

/**
* Command group for firing the shooter. Runs flywheel, runs static intake, stops dynamic intake, raises intake, and
* Command group for firing the flywheel. Runs flywheel, runs static intake, stops dynamic intake, raises intake, and
* runs feeder.
*/
@JsonIdentityInfo(generator = ObjectIdGenerators.StringIdGenerator.class)
Expand All @@ -20,14 +20,14 @@ public class FireShooter extends YamlCommandGroupWrapper {
/**
* Constructs a FireShooter command group
*
* @param subsystemShooter shooter subsystem. Can be null.
* @param subsystemFlywheel flywheel subsystem. Can be null.
* @param subsystemIntake intake subsystem. Can be null.
*/
@JsonCreator
public FireShooter(@Nullable SubsystemShooter subsystemShooter,
public FireShooter(@Nullable SubsystemFlywheel subsystemFlywheel,
@Nullable SubsystemIntake subsystemIntake) {
if (subsystemShooter != null) {
addParallel(new TurnAllOn(subsystemShooter));
if (subsystemFlywheel != null) {
addParallel(new TurnAllOn(subsystemFlywheel));
}
if (subsystemIntake != null) {
addParallel(new SetIntakeMode(subsystemIntake, SubsystemIntake.IntakeMode.IN_SLOW));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.jetbrains.annotations.Nullable;
import org.usfirst.frc.team449.robot.jacksonWrappers.YamlCommandGroupWrapper;
import org.usfirst.frc.team449.robot.subsystem.interfaces.flywheel.SubsystemFlywheel;
import org.usfirst.frc.team449.robot.subsystem.interfaces.intake.SubsystemIntake;
import org.usfirst.frc.team449.robot.subsystem.interfaces.intake.commands.SetIntakeMode;
import org.usfirst.frc.team449.robot.subsystem.interfaces.shooter.SubsystemShooter;
import org.usfirst.frc.team449.robot.subsystem.interfaces.shooter.commands.TurnAllOff;
import org.usfirst.frc.team449.robot.subsystem.interfaces.flywheel.commands.TurnAllOff;
import org.usfirst.frc.team449.robot.subsystem.interfaces.solenoid.SubsystemSolenoid;
import org.usfirst.frc.team449.robot.subsystem.interfaces.solenoid.commands.SolenoidReverse;

Expand All @@ -22,14 +22,14 @@ public class LoadShooter <T extends SubsystemIntake & SubsystemSolenoid> extends
/**
* Constructs a LoadShooter command group
*
* @param subsystemShooter shooter subsystem. Can be null.
* @param subsystemFlywheel flywheel subsystem. Can be null.
* @param subsystemIntake intake subsystem. Can be null.
*/
@JsonCreator
public LoadShooter(@Nullable SubsystemShooter subsystemShooter,
public LoadShooter(@Nullable SubsystemFlywheel subsystemFlywheel,
@Nullable T subsystemIntake) {
if (subsystemShooter != null) {
addParallel(new TurnAllOff(subsystemShooter));
if (subsystemFlywheel != null) {
addParallel(new TurnAllOff(subsystemFlywheel));
}
if (subsystemIntake != null) {
addParallel(new SolenoidReverse(subsystemIntake));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.jetbrains.annotations.Nullable;
import org.usfirst.frc.team449.robot.jacksonWrappers.YamlCommandGroupWrapper;
import org.usfirst.frc.team449.robot.subsystem.interfaces.flywheel.SubsystemFlywheel;
import org.usfirst.frc.team449.robot.subsystem.interfaces.intake.SubsystemIntake;
import org.usfirst.frc.team449.robot.subsystem.interfaces.intake.commands.SetIntakeMode;
import org.usfirst.frc.team449.robot.subsystem.interfaces.shooter.SubsystemShooter;
import org.usfirst.frc.team449.robot.subsystem.interfaces.shooter.commands.SpinUpShooter;
import org.usfirst.frc.team449.robot.subsystem.interfaces.flywheel.commands.SpinUpFlywheel;
import org.usfirst.frc.team449.robot.subsystem.interfaces.solenoid.SubsystemSolenoid;
import org.usfirst.frc.team449.robot.subsystem.interfaces.solenoid.commands.SolenoidReverse;

/**
* Command group for preparing the shooter to fire. Starts flywheel, runs static intake, stops dynamic intake, raises
* Command group for preparing the flywheel to fire. Starts flywheel, runs static intake, stops dynamic intake, raises
* intake, and stops feeder.
*/
@JsonIdentityInfo(generator = ObjectIdGenerators.StringIdGenerator.class)
Expand All @@ -22,14 +22,14 @@ public class RackShooter <T extends SubsystemIntake & SubsystemSolenoid> extends
/**
* Constructs a RackShooter command group
*
* @param subsystemShooter shooter subsystem. Can be null.
* @param subsystemFlywheel flywheel subsystem. Can be null.
* @param subsystemIntake intake subsystem. Can be null.
*/
@JsonCreator
public RackShooter(@Nullable SubsystemShooter subsystemShooter,
public RackShooter(@Nullable SubsystemFlywheel subsystemFlywheel,
@Nullable T subsystemIntake) {
if (subsystemShooter != null) {
addParallel(new SpinUpShooter(subsystemShooter));
if (subsystemFlywheel != null) {
addParallel(new SpinUpFlywheel(subsystemFlywheel));
}
if (subsystemIntake != null) {
addParallel(new SolenoidReverse(subsystemIntake));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import org.usfirst.frc.team449.robot.jacksonWrappers.YamlCommandGroupWrapper;
import org.usfirst.frc.team449.robot.subsystem.interfaces.intake.SubsystemIntake;
import org.usfirst.frc.team449.robot.subsystem.interfaces.intake.commands.SetIntakeMode;
import org.usfirst.frc.team449.robot.subsystem.interfaces.shooter.SubsystemShooter;
import org.usfirst.frc.team449.robot.subsystem.interfaces.shooter.commands.TurnAllOff;
import org.usfirst.frc.team449.robot.subsystem.interfaces.flywheel.SubsystemFlywheel;
import org.usfirst.frc.team449.robot.subsystem.interfaces.flywheel.commands.TurnAllOff;
import org.usfirst.frc.team449.robot.subsystem.interfaces.solenoid.SubsystemSolenoid;
import org.usfirst.frc.team449.robot.subsystem.interfaces.solenoid.commands.SolenoidReverse;

Expand All @@ -21,14 +21,14 @@ public class ResetShooter <T extends SubsystemIntake & SubsystemSolenoid> extend
/**
* Constructs a ResetShooter command group
*
* @param subsystemShooter shooter subsystem. Can be null.
* @param subsystemFlywheel flywheel subsystem. Can be null.
* @param subsystemIntake intake subsystem. Can be null.
*/
@JsonCreator
public ResetShooter(@Nullable SubsystemShooter subsystemShooter,
public ResetShooter(@Nullable SubsystemFlywheel subsystemFlywheel,
@Nullable T subsystemIntake) {
if (subsystemShooter != null) {
addParallel(new TurnAllOff(subsystemShooter));
if (subsystemFlywheel != null) {
addParallel(new TurnAllOff(subsystemFlywheel));
}
if (subsystemIntake != null) {
addParallel(new SolenoidReverse(subsystemIntake));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class DriveTalonCluster extends YamlSubsystem implements SubsystemAHRS, D
* The NavX gyro
*/
@NotNull
private final MappedAHRS navX;
private final MappedAHRS ahrs;

/**
* Whether or not to use the NavX for driving straight
Expand All @@ -62,20 +62,20 @@ public class DriveTalonCluster extends YamlSubsystem implements SubsystemAHRS, D
*
* @param leftMaster The master talon on the left side of the drive.
* @param rightMaster The master talon on the right side of the drive.
* @param navX The NavX gyro for calculating this drive's heading and angular velocity.
* @param ahrs The NavX gyro for calculating this drive's heading and angular velocity.
* @param VelScale The amount to scale the output to the motor by. Defaults to 1.
*/
@JsonCreator
public DriveTalonCluster(@NotNull @JsonProperty(required = true) FPSTalon leftMaster,
@NotNull @JsonProperty(required = true) FPSTalon rightMaster,
@NotNull @JsonProperty(required = true) MappedAHRS navX,
@NotNull @JsonProperty(required = true) MappedAHRS ahrs,
@Nullable Double VelScale) {
super();
//Initialize stuff
this.VEL_SCALE = VelScale != null ? VelScale : 1.;
this.rightMaster = rightMaster;
this.leftMaster = leftMaster;
this.navX = navX;
this.ahrs = ahrs;
this.overrideGyro = false;
}

Expand Down Expand Up @@ -223,7 +223,7 @@ public void setDefaultCommandManual(Command defaultCommand) {
*/
@Override
public double getHeading() {
return navX.getHeading();
return ahrs.getHeading();
}

/**
Expand All @@ -233,7 +233,7 @@ public double getHeading() {
*/
@Override
public void setHeading(double heading) {
navX.setHeading(heading);
ahrs.setHeading(heading);
}

/**
Expand All @@ -253,7 +253,7 @@ public double getHeadingCached() {
*/
@Override
public double getAngularVel() {
return navX.getAngularVelocity();
return ahrs.getAngularVelocity();
}

/**
Expand All @@ -273,7 +273,7 @@ public double getAngularVelCached() {
*/
@Override
public double getAngularDisplacement() {
return navX.getAngularVelocity();
return ahrs.getAngularVelocity();
}

/**
Expand Down Expand Up @@ -352,11 +352,11 @@ public Object[] getData() {
leftMaster.getError(),
rightMaster.getError(),
cachedHeading,
navX.get9AxisHeading(),
ahrs.get9AxisHeading(),
cachedAngularVel,
cachedAngularDisplacement,
navX.getXAccel(),
navX.getYAccel()};
ahrs.getXAccel(),
ahrs.getYAccel()};
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
import org.usfirst.frc.team449.robot.generalInterfaces.simpleMotor.SimpleMotor;
import org.usfirst.frc.team449.robot.jacksonWrappers.FPSTalon;
import org.usfirst.frc.team449.robot.jacksonWrappers.YamlSubsystem;
import org.usfirst.frc.team449.robot.subsystem.interfaces.shooter.SubsystemShooter;
import org.usfirst.frc.team449.robot.subsystem.interfaces.flywheel.SubsystemFlywheel;

/**
* A flywheel multiSubsystem with a single flywheel and a single-motor feeder system.
*/
@JsonIdentityInfo(generator = ObjectIdGenerators.StringIdGenerator.class)
public class LoggingShooter extends YamlSubsystem implements Loggable, SubsystemShooter {
public class LoggingFlywheel extends YamlSubsystem implements Loggable, SubsystemFlywheel {

/**
* The flywheel's Talon
Expand Down Expand Up @@ -48,7 +48,7 @@ public class LoggingShooter extends YamlSubsystem implements Loggable, Subsystem
* Whether the flywheel is currently commanded to spin
*/
@NotNull
private ShooterState state;
private FlywheelState state;

/**
* Default constructor
Expand All @@ -61,16 +61,16 @@ public class LoggingShooter extends YamlSubsystem implements Loggable, Subsystem
* Defaults to 0.
*/
@JsonCreator
public LoggingShooter(@NotNull @JsonProperty(required = true) FPSTalon shooterTalon,
@JsonProperty(required = true) double shooterThrottle,
@NotNull @JsonProperty(required = true) SimpleMotor feederMotor,
@JsonProperty(required = true) double feederThrottle,
double spinUpTimeSecs) {
public LoggingFlywheel(@NotNull @JsonProperty(required = true) FPSTalon shooterTalon,
@JsonProperty(required = true) double shooterThrottle,
@NotNull @JsonProperty(required = true) SimpleMotor feederMotor,
@JsonProperty(required = true) double feederThrottle,
double spinUpTimeSecs) {
this.shooterTalon = shooterTalon;
this.shooterThrottle = shooterThrottle;
this.feederMotor = feederMotor;
this.feederThrottle = feederThrottle;
state = ShooterState.OFF;
state = FlywheelState.OFF;
spinUpTime = (long) (spinUpTimeSecs * 1000.);
}

Expand Down Expand Up @@ -127,7 +127,7 @@ public String getName() {
* Turn the multiSubsystem on to a map-specified speed.
*/
@Override
public void turnShooterOn() {
public void turnFlywheelOn() {
shooterTalon.enable();
shooterTalon.setVelocity(shooterThrottle);
}
Expand All @@ -136,7 +136,7 @@ public void turnShooterOn() {
* Turn the multiSubsystem off.
*/
@Override
public void turnShooterOff() {
public void turnFlywheelOff() {
shooterTalon.disable();
}

Expand All @@ -162,15 +162,15 @@ public void turnFeederOff() {
*/
@NotNull
@Override
public ShooterState getShooterState() {
public FlywheelState getFlywheelState() {
return state;
}

/**
* @param state The state to switch the multiSubsystem to.
*/
@Override
public void setShooterState(@NotNull ShooterState state) {
public void setFlywheelState(@NotNull FlywheelState state) {
this.state = state;
}

Expand Down
Loading

0 comments on commit 511abb1

Please sign in to comment.