Skip to content

Commit 876405d

Browse files
committed
more drive practice tweaks
1 parent 666e4ab commit 876405d

File tree

4 files changed

+60
-16
lines changed

4 files changed

+60
-16
lines changed

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

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import frc.robot.commands.elevator.ZeroElevatorCommand;
4242
import frc.robot.commands.robotState.AutoReefCycleCommand;
4343
import frc.robot.commands.robotState.FloorAlgaeCommand;
44+
import frc.robot.commands.robotState.ForceProcessorCommand;
4445
import frc.robot.commands.robotState.HPAlgaeCommand;
4546
import frc.robot.commands.robotState.InterruptAutoCommand;
4647
import frc.robot.commands.robotState.ReefCycleCommand;
@@ -289,21 +290,15 @@ private void configureDriverBindings() {
289290

290291
// Reset Gyro Command, stow, interrupt Auton, and zero elev
291292
new JoystickButton(driveJoystick, Button.M_SWC.id).onTrue(new ResetGyroCommand(driveSubsystem));
293+
294+
// Force Processor
292295
new JoystickButton(driveJoystick, Button.SWD.id)
293296
.onTrue(
294-
new StowCommand(
295-
robotStateSubsystem,
296-
elevatorSubsystem,
297-
coralSubsystem,
298-
biscuitSubsystem,
299-
algaeSubsystem))
297+
new ForceProcessorCommand(
298+
robotStateSubsystem, elevatorSubsystem, biscuitSubsystem, algaeSubsystem))
300299
.onFalse(
301-
new StowCommand(
302-
robotStateSubsystem,
303-
elevatorSubsystem,
304-
coralSubsystem,
305-
biscuitSubsystem,
306-
algaeSubsystem));
300+
new ForceProcessorCommand(
301+
robotStateSubsystem, elevatorSubsystem, biscuitSubsystem, algaeSubsystem));
307302

308303
// Interupt
309304
new JoystickButton(driveJoystick, Button.SWG_UP.id)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package frc.robot.commands.robotState;
2+
3+
import edu.wpi.first.wpilibj2.command.Command;
4+
import frc.robot.subsystems.algae.AlgaeSubsystem;
5+
import frc.robot.subsystems.biscuit.BiscuitSubsystem;
6+
import frc.robot.subsystems.elevator.ElevatorSubsystem;
7+
import frc.robot.subsystems.robotState.RobotStateSubsystem;
8+
import frc.robot.subsystems.robotState.RobotStateSubsystem.AlgaeHeight;
9+
import frc.robot.subsystems.robotState.RobotStateSubsystem.RobotStates;
10+
11+
public class ForceProcessorCommand extends Command {
12+
RobotStateSubsystem robotStateSubsystem;
13+
ElevatorSubsystem elevatorSubsystem;
14+
boolean hasTriedToPickup = false;
15+
private RobotStates startState;
16+
private boolean startingElevatorFinished;
17+
18+
public ForceProcessorCommand(
19+
RobotStateSubsystem robotStateSubsystem,
20+
ElevatorSubsystem elevatorSubsystem,
21+
BiscuitSubsystem biscuitSubsystem,
22+
AlgaeSubsystem algaeSubsystem) {
23+
this.robotStateSubsystem = robotStateSubsystem;
24+
this.elevatorSubsystem = elevatorSubsystem;
25+
addRequirements(elevatorSubsystem, biscuitSubsystem, algaeSubsystem);
26+
}
27+
28+
@Override
29+
public void initialize() {
30+
startState = robotStateSubsystem.getState();
31+
startingElevatorFinished = elevatorSubsystem.isFinished();
32+
robotStateSubsystem.setAlgaeHeight(AlgaeHeight.LOW);
33+
if (startState == RobotStates.PROCESSOR_ALGAE) robotStateSubsystem.releaseAlgae();
34+
else robotStateSubsystem.toScoreAlgae();
35+
}
36+
37+
@Override
38+
public boolean isFinished() {
39+
if (startState == RobotStates.PROCESSOR_ALGAE || startState == RobotStates.BARGE_ALGAE) {
40+
return robotStateSubsystem.getState() == RobotStates.FUNNEL_LOAD
41+
|| robotStateSubsystem.getState() == RobotStates.STOW
42+
|| !startingElevatorFinished;
43+
} else {
44+
return robotStateSubsystem.getState() == RobotStates.BARGE_ALGAE
45+
|| robotStateSubsystem.getState() == RobotStates.PROCESSOR_ALGAE
46+
|| !robotStateSubsystem.getIsBargeSafe();
47+
}
48+
}
49+
}

src/main/java/frc/robot/constants/TagServoingConstants.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ public class TagServoingConstants {
4747
public static final double kNoUpdateMicrosec = 500_000;
4848

4949
// Drive
50-
public static final double kCoralInitialDriveRadius = 1.7; // 0.36 away from reef wall
50+
public static final double kCoralInitialDriveRadius = 1.75; // 0.36 away from reef wall
5151
public static final double kCoralAlignRadius = 1.32; // 1.293823 is perfectly against the reef
5252
// public static final double kCoralStopXDriveRadius =
5353
// kCoralInitialDriveRadius; // Should be closer to reef than target pose
54-
public static final double kAlgaeInitialDriveRadius = 1.6;
55-
public static final double kAlgaeAlignRadius = 1.49; // was 1.34
54+
public static final double kAlgaeInitialDriveRadius = 1.;
55+
public static final double kAlgaeAlignRadius = 1.34; // was 1.34
5656
public static final double kAlgaeStopXDriveRadius =
5757
kAlgaeInitialDriveRadius; // Should be closer to reef than target pose
5858
// public static final double kMinVelX = 0.85;

src/main/java/frc/robot/subsystems/algae/AlgaeSubsystem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void scoreBarge() {
5050

5151
public void hold() {
5252
// setSpeed(AlgaeConstants.kHoldSpeed);
53-
setPct(-0);
53+
setPct(0.04);
5454
}
5555

5656
public boolean hasAlgae() {

0 commit comments

Comments
 (0)