Skip to content

Commit

Permalink
Another subsystem shuffle
Browse files Browse the repository at this point in the history
  • Loading branch information
ZachOrr committed Feb 21, 2022
1 parent 84d74ca commit 3fb1b96
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 17 deletions.
3 changes: 1 addition & 2 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import frc.robot.commands.shooter.RunKicker;
import frc.robot.commands.shooter.StartShooter;
import frc.robot.subsystems.*;
import frc.robot.subsystems.hardware.PixyCam;

public class RobotContainer {
private final XboxController driverController = new XboxController(0);
Expand All @@ -40,8 +41,6 @@ public class RobotContainer {
private final Drivetrain drivetrain = new Drivetrain(pigeon);
private final Heading heading = new Heading(drivetrain::getGyroscopeRotation, drivetrain::isMoving);

private final TimeOfFlightSensor timeOfFlight = new TimeOfFlightSensor();

private final SendableChooser<Command> autonChooser = new SendableChooser<>();

public RobotContainer() {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/frc/robot/commands/auto/Pos3RightFiveBall.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ public Pos3RightFiveBall(AutoDrive autoDrive, Delivery delivery, Drivetrain driv
new AutoStartIntake(intake),
new ProfiledPointToPointCommand(Constants.Auto.kBallR3Pickup, drivetrain::getTranslation, 2.5, 0.05, Units.inchesToMeters(120), 12, autoDrive, heading).withTimeout(2)
),
new AutoKickerCommand(kicker, 0).withTimeout(0.5),
new AutoKickerCommand(kicker, 0).withTimeout(0.5),
new ParallelCommandGroup(
new ProfiledPointToPointCommand(Constants.Auto.kBallR2Pickup, drivetrain::getTranslation, 3.0, 0.05, Units.inchesToMeters(120), 12, autoDrive, heading).withTimeout(3),
new AutoStartDelivery(delivery).withTimeout(0.75)
),
),
new AutoKickerCommand(kicker, 0).withTimeout(0.5),
new ProfiledPointToPointCommand(Constants.Auto.kBallR2ShootPosition, drivetrain::getTranslation, 3.0, 0.05, Units.inchesToMeters(120), 15, autoDrive, heading).withTimeout(1),
new ParallelCommandGroup(
new AutoKickerCommand(kicker, 0).withTimeout(1.5),
new AutoKickerCommand(kicker, 0).withTimeout(1.5),
new AutoStartDelivery(delivery).withTimeout(1.5)
),
new WaitCommand(5),
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/frc/robot/subsystems/Delivery.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants;
import frc.robot.nerdyfiles.utilities.CTREUtils;
import frc.robot.subsystems.hardware.ColorSensorTCS;

/**
* Subsystem for the delivery mechanism
Expand All @@ -21,7 +22,7 @@ public static enum Direction {
}

private final TalonFX motor = new TalonFX(Constants.DELIVERY_MOTOR_ID);

private final ColorSensorTCS sensor = new ColorSensorTCS(I2C.Port.kMXP);


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package frc.robot.subsystems;
package frc.robot.subsystems.hardware;

import com.revrobotics.ColorSensorV3;
import com.revrobotics.ColorMatchResult;
Expand All @@ -7,12 +7,13 @@
import edu.wpi.first.wpilibj.util.Color;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants.BallColor;
import frc.robot.subsystems.hardware.interfaces.ColorSensor;

/**
* Subsystem for the REV Robotics Color Sensor V3. Plugs in to the I2C port.
*
*
* @author Michael Francis
*
*
* @apiNote https://github.com/REVrobotics/Color-Sensor-v3-Examples/tree/master/Java
*/
public class ColorSensorREV extends SubsystemBase implements ColorSensor {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package frc.robot.subsystems;
package frc.robot.subsystems.hardware;

import com.revrobotics.ColorMatchResult;
import com.revrobotics.ColorMatch;
import edu.wpi.first.wpilibj.I2C;
import edu.wpi.first.wpilibj.util.Color;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants.BallColor;
import frc.robot.subsystems.hardware.interfaces.ColorSensor;

/**
* Subsystem for the TCS34275 color sensor. Plugs in to the I2C port. Based on {@link ColorSensorREV}
*
*
* @author Michael Francis
*/
public class ColorSensorTCS extends SubsystemBase implements ColorSensor {
Expand Down Expand Up @@ -74,7 +75,7 @@ public BallColor getColor() {
public boolean seesBall() {
/**
* Luminance max threshold
*
*
* This is a terrible way to go about this. If we can find a better way to do this, such as
* using a Time of Flight sensor instead (there is code in the 2020 repo), it would be much
* better. The current solution works, but it's a very sketchy solution.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package frc.robot.subsystems;
package frc.robot.subsystems.hardware;

import edu.wpi.first.wpilibj.shuffleboard.*;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package frc.robot.subsystems;
package frc.robot.subsystems.hardware;

import edu.wpi.first.wpilibj.PowerDistribution;
import edu.wpi.first.wpilibj.PowerDistribution.ModuleType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package frc.robot.hardware;
package frc.robot.subsystems.hardware;

import edu.wpi.first.wpilibj.I2C;
import edu.wpi.first.wpilibj.util.Color;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package frc.robot.subsystems;
package frc.robot.subsystems.hardware;

import com.playingwithfusion.TimeOfFlight;
import com.playingwithfusion.TimeOfFlight.Status;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package frc.robot.subsystems;
package frc.robot.subsystems.hardware.interfaces;

import frc.robot.Constants.BallColor;

Expand Down

0 comments on commit 3fb1b96

Please sign in to comment.