Skip to content

Commit cf6e951

Browse files
committed
for roogies
1 parent 4da4032 commit cf6e951

File tree

4 files changed

+8
-107
lines changed

4 files changed

+8
-107
lines changed

src/main/deploy/pathplanner/autos/Planned Auto.auto

Whitespace-only changes.

src/main/java/frc/robot/RobotContainer.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -465,9 +465,9 @@ private void configureBindings() {
465465
/* ElEVATOR TEST */
466466

467467
dPadUp.onTrue(new ElevatorToTrapCommand(elevatorSubsystem));
468-
dPadUp.onTrue(new InstantCommand(() -> intakePivotSubsystem.enablePowerLimit(false)));
468+
//dPadUp.onTrue(new InstantCommand(() -> intakePivotSubsystem.enablePowerLimit(false)));
469469
dPadDown.onTrue(new ElevatorToZeroCommand(elevatorSubsystem));
470-
dPadDown.onTrue(new InstantCommand(() -> intakePivotSubsystem.enablePowerLimit(true)));
470+
//dPadDown.onTrue(new InstantCommand(() -> intakePivotSubsystem.enablePowerLimit(true)));
471471

472472

473473
dPadLeft.onTrue(new ElevatorToMidCommand(elevatorSubsystem));
@@ -520,7 +520,7 @@ private void configureBindings() {
520520
// if elevator is up
521521
new ElevatorToZeroCommand(elevatorSubsystem).alongWith(
522522
Commands.runOnce(() -> {
523-
intakePivotSubsystem.enablePowerLimit(true);
523+
//intakePivotSubsystem.enablePowerLimit(true);
524524
intakePivotSubsystem.setPosition(0);
525525
}, intakePivotSubsystem)
526526
), // stow the pivot
@@ -541,13 +541,13 @@ private void configureBindings() {
541541
new ConditionalCommand(
542542
new ElevatorToZeroCommand(elevatorSubsystem).alongWith(new InstantCommand(// lower the elevator
543543
() -> {
544-
intakePivotSubsystem.enablePowerLimit(true);
544+
//intakePivotSubsystem.enablePowerLimit(true);
545545
intakePivotSubsystem.setPosition(0);
546546
}, intakePivotSubsystem)), // stow intake
547547
new ConditionalCommand(
548548
new ElevatorToTrapCommand(elevatorSubsystem).andThen(
549549
new InstantCommand(() -> {
550-
intakePivotSubsystem.enablePowerLimit(false);
550+
//intakePivotSubsystem.enablePowerLimit(false);
551551
intakePivotSubsystem.setPosition(.45);
552552
})
553553
),

src/main/java/frc/robot/subsystems/intake/IntakePivotSubsystem.java

+1-52
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,8 @@
33
import static frc.robot.Constants.IntakeConstants;
44

55
import com.ctre.phoenix6.configs.Slot0Configs;
6-
import com.ctre.phoenix6.configs.VoltageConfigs;
7-
import com.ctre.phoenix6.controls.PositionVoltage;
86
import com.ctre.phoenix6.hardware.TalonFX;
97
import com.ctre.phoenix6.signals.NeutralModeValue;
10-
import edu.wpi.first.networktables.NetworkTable;
11-
import edu.wpi.first.networktables.NetworkTableEntry;
12-
import edu.wpi.first.networktables.NetworkTableInstance;
138
import edu.wpi.first.wpilibj2.command.SubsystemBase;
149

1510

@@ -18,16 +13,8 @@ public class IntakePivotSubsystem extends SubsystemBase {
1813

1914
private final TalonFX pivotMotor;
2015

21-
private PositionVoltage request = new PositionVoltage(0).withSlot(0);
22-
private VoltageConfigs voltageConfig = new VoltageConfigs();
2316
private double setPos = 0;
2417
private static final double FORWARD_VOLTAGE = 1.75;
25-
26-
private NetworkTableInstance ntInstance;
27-
private NetworkTable motorsNTTable;
28-
private NetworkTableEntry intake16CurrentEntry;
29-
private NetworkTableEntry intake16VoltageEntry;
30-
private NetworkTableEntry intake16TemperatureEntry;
3118

3219
/**
3320
* Subsystem for controlling the pivot on the intake.
@@ -36,32 +23,14 @@ public IntakePivotSubsystem() {
3623
pivotMotor = new TalonFX(IntakeConstants.PIVOT_MOTOR_ID);
3724
pivotMotor.setNeutralMode(NeutralModeValue.Brake);
3825

39-
// intakeencoder = new Encoder(1, 2);
40-
// extendedlimitswitch = new DigitalInput(extendedlimitswitchID);
41-
// retractedlimitswitch = new DigitalInput(retractedlimitswitchID);
42-
4326
Slot0Configs slot0Configs = new Slot0Configs();
4427

4528
slot0Configs.kP = IntakeConstants.PIVOT_P;
4629
slot0Configs.kI = IntakeConstants.PIVOT_I;
4730
slot0Configs.kD = IntakeConstants.PIVOT_D;
4831

49-
voltageConfig.PeakForwardVoltage = FORWARD_VOLTAGE;
50-
voltageConfig.PeakReverseVoltage = -16;
51-
52-
5332
pivotMotor.getConfigurator().apply(slot0Configs);
5433
pivotMotor.setPosition(0);
55-
// pivotMotor.getConfigurator().apply(voltageConfig);
56-
57-
58-
request.withLimitForwardMotion(false);
59-
60-
ntInstance = NetworkTableInstance.getDefault();
61-
motorsNTTable = ntInstance.getTable("Motors");
62-
intake16CurrentEntry = motorsNTTable.getEntry("Intake16Current");
63-
intake16VoltageEntry = motorsNTTable.getEntry("Intake16Voltage");
64-
intake16TemperatureEntry = motorsNTTable.getEntry("Intake16Temperature");
6534
}
6635

6736
/**
@@ -71,7 +40,6 @@ public IntakePivotSubsystem() {
7140
*/
7241

7342
public void setPosition(double position) {
74-
pivotMotor.setControl(request.withPosition(position / IntakeConstants.PIVOT_CONVERSION_FACTOR));
7543
setPos = position;
7644
}
7745

@@ -103,28 +71,9 @@ public void movePivot(double speed) {
10371
pivotMotor.set(speed);
10472
}
10573

106-
/**
107-
* Enables/disables the pivot motor's forward voltage limit for deploying the intake.
108-
* When enabled, the linkage will not slam down when deploying.
109-
*
110-
* @param enabled True enables the limit, false disables it.
111-
*/
112-
public void enablePowerLimit(boolean enabled) {
113-
if (enabled) {
114-
voltageConfig.PeakForwardVoltage = FORWARD_VOLTAGE;
115-
} else {
116-
voltageConfig.PeakForwardVoltage = 16;
117-
}
118-
119-
// pivotMotor.getConfigurator().apply(voltageConfig);
120-
}
12174

12275
@Override
12376
public void periodic() {
124-
pivotMotor.setControl(request.withPosition(setPos / IntakeConstants.PIVOT_CONVERSION_FACTOR));
125-
126-
intake16CurrentEntry.setDouble(pivotMotor.getSupplyCurrent().getValueAsDouble());
127-
intake16VoltageEntry.setDouble(pivotMotor.getMotorVoltage().getValueAsDouble());
128-
intake16TemperatureEntry.setDouble(pivotMotor.getDeviceTemp().getValueAsDouble());
77+
12978
}
13079
}

src/main/java/frc/robot/subsystems/intake/IntakeRollerSubsystem.java

+2-50
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@
1919
import com.revrobotics.ColorSensorV3;
2020
import com.revrobotics.CANSparkBase.IdleMode;
2121

22-
import edu.wpi.first.networktables.BooleanPublisher;
23-
import edu.wpi.first.networktables.NetworkTable;
24-
import edu.wpi.first.networktables.NetworkTableEntry;
25-
import edu.wpi.first.networktables.NetworkTableInstance;
22+
2623
import edu.wpi.first.wpilibj.AnalogPotentiometer;
2724
import edu.wpi.first.wpilibj.DigitalInput;
2825
import edu.wpi.first.wpilibj.DigitalOutput;
@@ -45,24 +42,6 @@ public class IntakeRollerSubsystem extends SubsystemBase {
4542

4643
private boolean prevFrontSensorValue = false;
4744

48-
private NetworkTableInstance ntInstance;
49-
private NetworkTable ntTable;
50-
private BooleanPublisher ntFrontPublisher;
51-
private BooleanPublisher ntBackPublisher;
52-
53-
private NetworkTable motorsNTTable;
54-
private NetworkTableEntry frontMotorCurrentEntry;
55-
private NetworkTableEntry frontMotorVoltageEntry;
56-
private NetworkTableEntry frontMotorTemperatureEntry;
57-
private NetworkTableEntry integrationMotorCurrentEntry;
58-
private NetworkTableEntry integrationMotorVoltageEntry;
59-
private NetworkTableEntry integrationMotorTemperatureEntry;
60-
61-
private NetworkTable intakeNTTable;
62-
private NetworkTableEntry frontSensorEntry;
63-
private NetworkTableEntry rockwellSensorEntry;
64-
private NetworkTableEntry ampSenSorEntry;
65-
6645
private final LightBarSubsystem lightBarSubsystem;
6746

6847
private Timer colorResetTimer;
@@ -80,22 +59,6 @@ public IntakeRollerSubsystem(LightBarSubsystem lightBarSubsystem) {
8059
rockwellSensor = new DigitalInput(4);
8160
ampSensor = new DigitalInput(5);
8261

83-
ntInstance = NetworkTableInstance.getDefault();
84-
ntTable = ntInstance.getTable("RobotStatus");
85-
intakeNTTable = ntInstance.getTable("Intake");
86-
frontSensorEntry = intakeNTTable.getEntry("FrontSensor");
87-
rockwellSensorEntry = intakeNTTable.getEntry("Rockwell");
88-
ampSenSorEntry = intakeNTTable.getEntry("AMPSensor");
89-
ntFrontPublisher = ntTable.getBooleanTopic("FrontSensor").publish();
90-
ntBackPublisher = ntTable.getBooleanTopic("BackSensor").publish();
91-
92-
motorsNTTable = ntInstance.getTable("Motors");
93-
frontMotorCurrentEntry = motorsNTTable.getEntry("Intake17Current");
94-
frontMotorVoltageEntry = motorsNTTable.getEntry("Intake17Voltage");
95-
frontMotorTemperatureEntry = motorsNTTable.getEntry("Intake17Temperature");
96-
integrationMotorCurrentEntry = motorsNTTable.getEntry("Intake19Current");
97-
integrationMotorVoltageEntry = motorsNTTable.getEntry("Intake19Voltage");
98-
integrationMotorTemperatureEntry = motorsNTTable.getEntry("Intake19Temperature");
9962
this.lightBarSubsystem = lightBarSubsystem;
10063

10164
// colorResetTimer = new Timer();
@@ -160,18 +123,7 @@ public boolean getAmpSensor() {
160123

161124
@Override
162125
public void periodic() {
163-
frontSensorEntry.setBoolean(getFrontSensorValue());
164-
rockwellSensorEntry.setBoolean(getRockwellSensorValue());
165-
ampSenSorEntry.setBoolean(getAmpSensor());
166-
167-
frontMotorCurrentEntry.setDouble(frontMotors.getOutputCurrent());
168-
frontMotorVoltageEntry.setDouble(frontMotors.getBusVoltage());
169-
frontMotorTemperatureEntry.setDouble(frontMotors.getMotorTemperature());
170-
integrationMotorCurrentEntry.setDouble(integrationMotor.getSupplyCurrent());
171-
integrationMotorVoltageEntry.setDouble(integrationMotor.getMotorOutputVoltage());
172-
integrationMotorTemperatureEntry.setDouble(integrationMotor.getTemperature());
173-
174-
ntFrontPublisher.set(getFrontSensorReached());
126+
175127
prevFrontSensorValue = getFrontSensorValue();
176128
if (getFrontSensorValue()) {
177129
lightBarSubsystem.setLightBarStatus(LightBarStatus.HOLDING_NOTE, 2);

0 commit comments

Comments
 (0)