Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
autonomous tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
totbas1 committed Mar 27, 2023
1 parent 2e3ebca commit c2e5d34
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class RobotContainer {
private final BalanceCommand m_BalanceCommand = new BalanceCommand(m_PID, m_Tank);
private final AutoCommand m_AutoCommand = new AutoCommand(m_PID, m_Tank, m_claw, m_Arm);
private final PlaceConeSecondLevelCommand m_PlaceConeSecondLevelCommand =
new PlaceConeSecondLevelCommand(m_Tank, m_Arm);
new PlaceConeSecondLevelCommand(m_Tank, m_Arm, m_claw);
private final IncreaseMaxSpeedCommand m_IncreaseMaxSpeedCommand =
new IncreaseMaxSpeedCommand(m_Tank);
private final DecreaseMaxSpeedCommand m_DecreaseMaxSpeedCommand =
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/commands/AutoCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public class AutoCommand extends SequentialCommandGroup {
public AutoCommand(PID m_pid, Tank m_driveBase, Claw m_claw, Arm m_arm) {
addCommands(new PlaceConeSecondLevelCommand(m_driveBase, m_arm));
addCommands(new PlaceConeSecondLevelCommand(m_driveBase, m_arm, m_claw));

// new BalanceCommand(m_pid, m_driveBase);
// new PlaceCubeFirstLevelCommand(m_driveBase, m_claw, m_arm)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
public class PlaceConeSecondLevelCommand extends CommandBase {
@SuppressWarnings({"PMD.UnusedPrivateField", "PMD.SingularField"})
private final Tank drive;

private final Claw claw;
private final Arm arm;

private boolean firstStep = true;

public PlaceConeSecondLevelCommand(Tank drive, Arm arm) {
public PlaceConeSecondLevelCommand(Tank drive, Arm arm, Claw claw) {
this.drive = drive;
this.arm = arm;
this.claw = claw;
addRequirements(drive);
addRequirements(arm);
}
Expand All @@ -37,6 +38,7 @@ public void initialize() {
public void execute() {
if (firstStep) {
if (Math.abs(arm.armMotor.getEncoder().getPosition()) < 105) {
claw.closeClaw();
arm.armMotor.set(0.4);
}

Expand All @@ -48,6 +50,7 @@ public void execute() {

// go over charge station
if (Math.abs(drive.getAverageDistance()) < 4.6 && firstStep == false) {
claw.stopClaw();
drive.setAllMotors(-0.3); // move back so that cone falls in
arm.armMotor.set(-0.45);
}
Expand Down

0 comments on commit c2e5d34

Please sign in to comment.