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

Literally everything #12

Merged
merged 16 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/main/deploy/pathplanner/LeftSideRamTotes.path
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@
},
{
"anchorPoint": {
"x": 1.8192560273087832,
"y": 7.604582658723591
"x": 6.523724069785241,
"y": 7.575362360323116
},
"prevControl": {
"x": 2.856576620525642,
"y": 7.538836987322523
"x": 7.57565481220234,
"y": 7.589972509523353
},
"nextControl": null,
"holonomicAngle": 0,
Expand Down
8 changes: 4 additions & 4 deletions src/main/deploy/pathplanner/RightSideRamTotes.path
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@
},
{
"anchorPoint": {
"x": 2.023125717200052,
"y": 0.5613285732500316
"x": 6.604079890386546,
"y": 2.7101826766440467
},
"prevControl": {
"x": 2.687364528879256,
"y": 0.5800395256916998
"x": 7.758281677205304,
"y": 2.7101826766440467
},
"nextControl": null,
"holonomicAngle": 0,
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/team1540/bunnybotTank2023/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static class ShooterConstants {
public static final double KV = 0.113;

public static final double ERROR_TOLERANCE_RPM = 30;
public static final double SHOOTER_ACTIVE_RPM = 3218;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐈‍⬛

public static final double SHOOTER_ACTIVE_RPM = 2200;

public static final double MOI = 0.0014924622;
}
Expand All @@ -86,7 +86,7 @@ public static class TurretConstants{
public static final double CRUISE_VELOCITY_RPS = 100;
public static final double MAX_ACCEL_RPS2 = 600;

public static final Rotation2d FORWARD_LIMIT_POSITION = Rotation2d.fromDegrees(66.064);
public static final Rotation2d FORWARD_LIMIT_POSITION = Rotation2d.fromDegrees(68.064);
public static final Rotation2d REVERSE_LIMIT_POSITION = Rotation2d.fromDegrees(-180);
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/team1540/bunnybotTank2023/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void robotInit() {

// Setup data receivers and replay source
if (isReal()) {
if (DriverStation.isFMSAttached()) new WPILOGWriter("/U");
logger.addDataReceiver(new WPILOGWriter("/U"));
logger.addDataReceiver(new NT4Publisher());
} else {
if (Constants.simulationMode == Constants.SimulationMode.SIM) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,12 @@ private void configureButtonBindings() {
new IndexerCommand(indexer)
)
);
copilot.b().whileTrue(new IntakeCommand(intake, -1));

copilot.y().whileTrue(new TurretZeroSequenceCommand(turret));
copilot.x().whileTrue(new AutoAimShoot5(turret, shooter, indexer, limelight));
copilot.leftBumper().whileTrue(new TurretSetpointCommand(turret, Rotation2d.fromDegrees(0)));
copilot.rightTrigger().onTrue(new ShootSequenceCommand(shooter, indexer, 3218));
copilot.rightTrigger().onTrue(new ShootSequenceCommand(shooter, indexer, Constants.ShooterConstants.SHOOTER_ACTIVE_RPM));
copilot.leftTrigger().whileTrue(new TurretTrackTargetCommand(turret, limelight));

// copilot.x().onTrue(new InstantCommand(() -> intake.setFold(false))).onFalse(new InstantCommand(() -> intake.setFold(true)));
Expand Down Expand Up @@ -130,8 +131,8 @@ private void initAutoChooser() {
autoChooser.addDefaultOption("ZeroTurret", new TurretZeroSequenceCommand(turret));
autoChooser.addOption("DoNothing", new InstantCommand());
autoChooser.addOption("AutoTaxi", new AutoTaxi(drivetrain, turret));
autoChooser.addOption("LeftSideRamTotes", new AutoLeftSideRamTotesShoot5(drivetrain, indexer, turret, shooter, limelight));
autoChooser.addOption("RightSideRamTotes", new AutoRightSideRamTotesShoot5(drivetrain, indexer, turret, shooter, limelight));
autoChooser.addOption("LeftSideRamTotes", new AutoLeftSideRamTotes(drivetrain, indexer, turret, shooter, limelight));
autoChooser.addOption("RightSideRamTotes", new AutoRightSideRamTotes(drivetrain, indexer, turret, shooter, limelight));
autoChooser.addOption("LeftSideRamSinusoid", new AutoLeftSideRamSinusoid(drivetrain, indexer, turret, shooter, limelight));
autoChooser.addOption("RightSideRamSinusoid", new AutoRightSideRamSinusoid(drivetrain, indexer, turret, shooter, limelight));
autoChooser.addOption("TaxiShoot5", new AutoTaxiShoot5(drivetrain, indexer, turret, shooter, limelight));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,17 @@ public class AutoLeftSideRamSinusoid extends AutoCommand {
public AutoLeftSideRamSinusoid(Drivetrain drivetrain, Indexer indexer, Turret turret, Shooter shooter, Limelight limelight) {
List<Command> pathCommands = getPathPlannerDriveCommandGroup(
drivetrain,
"LeftSideRamTotes",
"LeftSideRamSinusoid",
new PathConstraints[]{new PathConstraints(4, 2), new PathConstraints(3, 2)},
true
);

addRequirements(drivetrain, indexer, turret, shooter);

addCommands(
Commands.deadline(
Commands.parallel(
pathCommands.get(0),
new TurretZeroSequenceCommand(turret).asProxy()
),
new IndexerIdleCommand(indexer).asProxy()
),
Commands.parallel(
pathCommands.get(1),
new AutoAimShoot5(turret, shooter, indexer, limelight).asProxy()
)
pathCommands.get(0),
new TurretZeroSequenceCommand(turret).asProxy()
),
pathCommands.get(1)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.team1540.bunnybotTank2023.commands.auto.utilSequences.AutoAimShoot5;
import org.team1540.bunnybotTank2023.commands.drivetrain.Drivetrain;
import org.team1540.bunnybotTank2023.commands.indexer.Indexer;
import org.team1540.bunnybotTank2023.commands.indexer.IndexerIdleCommand;
import org.team1540.bunnybotTank2023.commands.shooter.Shooter;
import org.team1540.bunnybotTank2023.commands.turret.Turret;
import org.team1540.bunnybotTank2023.commands.turret.TurretZeroSequenceCommand;
Expand All @@ -15,27 +14,20 @@

import java.util.List;

public class AutoLeftSideRamTotesShoot5 extends AutoCommand {
public AutoLeftSideRamTotesShoot5(Drivetrain drivetrain, Indexer indexer, Turret turret, Shooter shooter, Limelight limelight) {
public class AutoLeftSideRamTotes extends AutoCommand {
public AutoLeftSideRamTotes(Drivetrain drivetrain, Indexer indexer, Turret turret, Shooter shooter, Limelight limelight) {
List<Command> pathCommands = getPathPlannerDriveCommandGroup(
drivetrain,
"LeftSideRamTotes",
new PathConstraints[] {new PathConstraints(4, 2), new PathConstraints(3, 2)},
true
);
addRequirements(turret, drivetrain, indexer, shooter);
addCommands(
Commands.deadline(
Commands.parallel(
pathCommands.get(0),
new TurretZeroSequenceCommand(turret).asProxy()
),
new IndexerIdleCommand(indexer).asProxy()
),
Commands.parallel(
pathCommands.get(1),
new AutoAimShoot5(turret, shooter, indexer, limelight).asProxy()
)
pathCommands.get(0),
new TurretZeroSequenceCommand(turret).asProxy()
),
pathCommands.get(1)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,18 @@ public class AutoRightSideRamSinusoid extends AutoCommand {
public AutoRightSideRamSinusoid(Drivetrain drivetrain, Indexer indexer, Turret turret, Shooter shooter, Limelight limelight) {
List<Command> pathCommands = getPathPlannerDriveCommandGroup(
drivetrain,
"RightSideRamTotes",
"RightSideRamSinusoid",
new PathConstraints[]{new PathConstraints(4, 2), new PathConstraints(3, 2)},
true
);


addRequirements(drivetrain, indexer, turret, shooter);

addCommands(
Commands.deadline(
Commands.parallel(
pathCommands.get(0),
new TurretZeroSequenceCommand(turret).asProxy()
),
new IndexerIdleCommand(indexer).asProxy()
),
Commands.parallel(
pathCommands.get(1),
new AutoAimShoot5(turret, shooter, indexer, limelight).asProxy()
)
pathCommands.get(0),
new TurretZeroSequenceCommand(turret).asProxy()
),
pathCommands.get(1)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.team1540.bunnybotTank2023.commands.auto.utilSequences.AutoAimShoot5;
import org.team1540.bunnybotTank2023.commands.drivetrain.Drivetrain;
import org.team1540.bunnybotTank2023.commands.indexer.Indexer;
import org.team1540.bunnybotTank2023.commands.indexer.IndexerIdleCommand;
import org.team1540.bunnybotTank2023.commands.shooter.Shooter;
import org.team1540.bunnybotTank2023.commands.turret.Turret;
import org.team1540.bunnybotTank2023.commands.turret.TurretZeroSequenceCommand;
Expand All @@ -15,27 +14,20 @@

import java.util.List;

public class AutoRightSideRamTotesShoot5 extends AutoCommand {
public AutoRightSideRamTotesShoot5(Drivetrain drivetrain, Indexer indexer, Turret turret, Shooter shooter, Limelight limelight) {
public class AutoRightSideRamTotes extends AutoCommand {
public AutoRightSideRamTotes(Drivetrain drivetrain, Indexer indexer, Turret turret, Shooter shooter, Limelight limelight) {
List<Command> pathCommands = getPathPlannerDriveCommandGroup(
drivetrain,
"RightSideRamTotes",
new PathConstraints[] {new PathConstraints(4, 2), new PathConstraints(3, 2)},
true
);
addRequirements(turret, drivetrain, indexer, shooter);
addCommands(
Commands.deadline(
Commands.parallel(
pathCommands.get(0),
new TurretZeroSequenceCommand(turret).asProxy()
),
new IndexerIdleCommand(indexer).asProxy()
),
Commands.parallel(
pathCommands.get(1),
new AutoAimShoot5(turret, shooter, indexer, limelight).asProxy()
)
pathCommands.get(0),
new TurretZeroSequenceCommand(turret).asProxy()
),
pathCommands.get(1)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public AutoTaxi(Drivetrain drivetrain, Turret turret) {
addCommands(
Commands.parallel(
pathCommands.get(0),
new TurretZeroSequenceCommand(turret)
new TurretZeroSequenceCommand(turret).asProxy()
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.pathplanner.lib.PathConstraints;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.PrintCommand;
import org.team1540.bunnybotTank2023.commands.auto.utilSequences.AutoAimShoot5;
import org.team1540.bunnybotTank2023.commands.drivetrain.Drivetrain;
import org.team1540.bunnybotTank2023.commands.indexer.Indexer;
Expand All @@ -23,16 +24,11 @@ public AutoTaxiShoot5(Drivetrain drivetrain, Indexer indexer, Turret turret, Sho
new PathConstraints[] {new PathConstraints(4, 2)},
true
);
addRequirements(drivetrain, indexer, turret, shooter);
addCommands(
Commands.deadline(
Commands.parallel(
pathCommands.get(0),
new TurretZeroSequenceCommand(turret).asProxy()
),
new IndexerIdleCommand(indexer).asProxy()
),
new AutoAimShoot5(turret, shooter, indexer, limelight).asProxy()
Commands.parallel(
pathCommands.get(0),
new TurretZeroSequenceCommand(turret).asProxy()
)
);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.team1540.bunnybotTank2023.commands.auto.utilSequences;

import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.InstantCommand;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import org.team1540.bunnybotTank2023.commands.indexer.Indexer;
import org.team1540.bunnybotTank2023.commands.shooter.ShootSequenceCommand;
Expand All @@ -14,17 +15,18 @@
public class AutoAimShoot5 extends SequentialCommandGroup {
public AutoAimShoot5(Turret turret, Shooter shooter, Indexer indexer, Limelight limelight) {
addCommands(
Commands.parallel(
new TurretTrackTargetCommand(turret, limelight),
Commands.deadline(
// Trust me, not scuffed at all ;D
new SequentialCommandGroup(
new ShootSequenceCommand(shooter, indexer, ShooterConstants.SHOOTER_ACTIVE_RPM),
new ShootSequenceCommand(shooter, indexer, ShooterConstants.SHOOTER_ACTIVE_RPM),
new ShootSequenceCommand(shooter, indexer, ShooterConstants.SHOOTER_ACTIVE_RPM),
new ShootSequenceCommand(shooter, indexer, ShooterConstants.SHOOTER_ACTIVE_RPM),
new ShootSequenceCommand(shooter, indexer, ShooterConstants.SHOOTER_ACTIVE_RPM)
)
)
),
new TurretTrackTargetCommand(turret, limelight)
),
new InstantCommand(shooter::stop)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public IndexerIdleCommand(Indexer indexer) {

@Override
public void initialize() {
indexer.setBottomSpeed(0.4);
indexer.setBottomSpeed(0.3);
indexer.setTopSpeed(-0.2);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@

public class IntakeCommand extends CommandBase {
private final Intake intake;
private final double speed;

public IntakeCommand(Intake intake) {
public IntakeCommand(Intake intake, double speed) {
this.intake = intake;
this.speed = speed;
}

public IntakeCommand(Intake intake) {
this(intake, 1);
}

@Override
public void initialize() {
intake.setFold(false);
intake.setMotorSpeed(1);
intake.setMotorSpeed(speed);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public TurretManualCommand(Turret turret, CommandXboxController controller) {

@Override
public void execute() {
turret.setVoltage(-MathUtil.applyDeadband(controller.getRightX(), Constants.DEADZONE_RADIUS) * 12.0);
turret.setVoltage(-0.75 * MathUtil.applyDeadband(controller.getRightX(), Constants.DEADZONE_RADIUS) * 12.0);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public abstract class AutoCommand extends SequentialCommandGroup {

public Command getPathPlannerDriveCommand(Drivetrain drivetrain, String pathName, PathConstraints constraints, boolean resetToPath) {
PathPlannerTrajectory trajectory = PathPlanner.loadPath(pathName, constraints);
return new PathPlannerDriveCommand(drivetrain, trajectory, resetToPath).asProxy();
return new PathPlannerDriveCommand(drivetrain, trajectory, resetToPath);
}

public List<Command> getPathPlannerDriveCommandGroup(
Expand Down
Loading