Skip to content

Commit

Permalink
Day 3 adventures
Browse files Browse the repository at this point in the history
  • Loading branch information
frc1987 committed Mar 17, 2024
1 parent 14d47f7 commit 880167b
Show file tree
Hide file tree
Showing 17 changed files with 376 additions and 61 deletions.
12 changes: 12 additions & 0 deletions src/main/deploy/pathplanner/autos/overture_amp.auto
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
"pathName": "overture_amp_0"
}
},
{
"type": "named",
"data": {
"name": "ShootNoteAimbot"
}
},
{
"type": "path",
"data": {
Expand All @@ -29,6 +35,12 @@
"pathName": "overture_amp_2"
}
},
{
"type": "named",
"data": {
"name": "ShootNoteAimbot"
}
},
{
"type": "path",
"data": {
Expand Down
16 changes: 11 additions & 5 deletions src/main/deploy/pathplanner/paths/amp_close_reversal_sub-4_e.path
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,25 @@
},
{
"anchor": {
"x": 7.6177984615381975,
"y": 6.91941025949483
"x": 7.633517717492807,
"y": 3.8149036537898207
},
"prevControl": {
"x": 3.9822566467591227,
"y": 6.906595445453224
"x": 3.99977237024525,
"y": 3.5045525859482125
},
"nextControl": null,
"isLocked": false,
"linkedName": null
}
],
"rotationTargets": [],
"rotationTargets": [
{
"waypointRelativePos": 0.65,
"rotationDegrees": -27.543829642895453,
"rotateFast": false
}
],
"constraintZones": [],
"eventMarkers": [],
"globalConstraints": {
Expand Down
37 changes: 27 additions & 10 deletions src/main/deploy/pathplanner/paths/overture_amp_0.path
Original file line number Diff line number Diff line change
Expand Up @@ -64,31 +64,31 @@
},
{
"anchor": {
"x": 7.194253311564654,
"x": 7.5,
"y": 7.0
},
"prevControl": {
"x": 6.402424582516889,
"x": 6.708171270952235,
"y": 7.210232411587029
},
"nextControl": {
"x": 7.947585505405897,
"x": 8.253332193841244,
"y": 6.7999885101064095
},
"isLocked": true,
"linkedName": null
},
{
"anchor": {
"x": 7.628010522164691,
"x": 7.93,
"y": 6.017151190342814
},
"prevControl": {
"x": 7.695197986386751,
"x": 7.99718746422206,
"y": 6.425644590202782
},
"nextControl": {
"x": 7.447591996362826,
"x": 7.749581474198135,
"y": 4.920223692693214
},
"isLocked": false,
Expand Down Expand Up @@ -134,10 +134,10 @@
{
"name": "Amp Slow",
"minWaypointRelativePos": 0.5,
"maxWaypointRelativePos": 1.25,
"maxWaypointRelativePos": 1.5,
"constraints": {
"maxVelocity": 0.75,
"maxAcceleration": 3.0,
"maxVelocity": 0.5,
"maxAcceleration": 2.0,
"maxAngularVelocity": 540.0,
"maxAngularAcceleration": 720.0
}
Expand All @@ -154,7 +154,7 @@
{
"type": "named",
"data": {
"name": "ShootAmp"
"name": "NewShootAmpAuto"
}
}
]
Expand Down Expand Up @@ -194,6 +194,23 @@
]
}
}
},
{
"name": "GoHome",
"waypointRelativePos": 2.1999999999999997,
"command": {
"type": "sequential",
"data": {
"commands": [
{
"type": "named",
"data": {
"name": "GoHome"
}
}
]
}
}
}
],
"globalConstraints": {
Expand Down
24 changes: 21 additions & 3 deletions src/main/deploy/pathplanner/paths/overture_amp_1.path
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
},
{
"anchor": {
"x": 7.394068465304582,
"x": 7.69,
"y": 3.8304899402120722
},
"prevControl": {
"x": 6.394068465304582,
"x": 6.69,
"y": 3.8304899402120722
},
"nextControl": null,
Expand All @@ -30,7 +30,25 @@
],
"rotationTargets": [],
"constraintZones": [],
"eventMarkers": [],
"eventMarkers": [
{
"name": "IntakeNote",
"waypointRelativePos": 0.3,
"command": {
"type": "sequential",
"data": {
"commands": [
{
"type": "named",
"data": {
"name": "IntakeNote"
}
}
]
}
}
}
],
"globalConstraints": {
"maxVelocity": 4.0,
"maxAcceleration": 3.0,
Expand Down
4 changes: 2 additions & 2 deletions src/main/deploy/pathplanner/paths/overture_amp_2.path
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"waypoints": [
{
"anchor": {
"x": 7.394068465304582,
"x": 7.69,
"y": 3.8304899402120722
},
"prevControl": null,
"nextControl": {
"x": 5.7568616380957485,
"x": 6.052793172791167,
"y": 3.8766496255780165
},
"isLocked": false,
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

package frc.robot;

import com.ctre.phoenix.led.LarsonAnimation;
import com.ctre.phoenix.led.LarsonAnimation.BounceMode;
import com.ctre.phoenix.led.SingleFadeAnimation;
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.CommandScheduler;
Expand All @@ -16,6 +19,8 @@ public class Robot extends TimedRobot {
@Override
public void robotInit() {
m_robotContainer = new RobotContainer();
m_robotContainer.CANDLES.setAnimationBoth(
new LarsonAnimation(255, 255, 0, 0, 1.0, 8, BounceMode.Front, 1));
}

@Override
Expand All @@ -24,7 +29,9 @@ public void robotPeriodic() {
}

@Override
public void disabledInit() {}
public void disabledInit() {
m_robotContainer.CANDLES.setAnimationBoth(new SingleFadeAnimation(255, 0, 0, 0, 0.7, 8));
}

@Override
public void disabledPeriodic() {}
Expand All @@ -34,6 +41,9 @@ public void disabledExit() {}

@Override
public void autonomousInit() {
// m_robotContainer.CANDLES.setAnimationBoth(new SingleFadeAnimation(255, 255, 255, 0, 1.5, 8));
m_robotContainer.CANDLES.setAnimationRight(
new LarsonAnimation(255, 255, 255, 0, 0.1, 8, BounceMode.Front, 1));
m_autonomousCommand = m_robotContainer.getAutonomousCommand();

if (m_autonomousCommand != null) {
Expand All @@ -49,6 +59,7 @@ public void autonomousExit() {}

@Override
public void teleopInit() {
m_robotContainer.CANDLES.stop();
if (m_autonomousCommand != null) {
m_autonomousCommand.cancel();
}
Expand Down
78 changes: 55 additions & 23 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

package frc.robot;

import com.ctre.phoenix.motorcontrol.NeutralMode;
import com.ctre.phoenix6.Utils;
import com.ctre.phoenix6.mechanisms.swerve.SwerveModule.DriveRequestType;
import com.ctre.phoenix6.signals.NeutralModeValue;
import com.ctre.phoenix6.mechanisms.swerve.SwerveRequest;
import com.ctre.phoenix6.signals.NeutralModeValue;
import com.pathplanner.lib.auto.NamedCommands;
import com.pathplanner.lib.commands.PathPlannerAuto;
import edu.wpi.first.math.geometry.Pose2d;
Expand All @@ -29,7 +28,9 @@
import frc.robot.commands.control.Climb;
import frc.robot.commands.control.GoHome;
import frc.robot.commands.control.IdleShooter;
import frc.robot.commands.control.NewShootAmpAuto;
import frc.robot.commands.control.ReverseIntake;
import frc.robot.commands.control.ShootAmp;
import frc.robot.commands.control.ShootSubwoofer;
import frc.robot.commands.control.ShootSubwooferFlat;
import frc.robot.commands.control.ShootTall;
Expand All @@ -40,6 +41,7 @@
import frc.robot.commands.control.note.LobNote;
import frc.robot.commands.control.note.PoopNote;
import frc.robot.commands.control.note.ShootNote;
import frc.robot.commands.control.note.ShootNoteAimbotFixed;
import frc.robot.commands.control.note.ShootNoteSequence;
import frc.robot.commands.control.note.SpitNote;
import frc.robot.commands.movement.CollectNoteAuto;
Expand All @@ -65,6 +67,7 @@

public class RobotContainer {
private final SendableChooser<Command> AUTO_CHOOSER = new SendableChooser<>();
// public final PowerDistribution PDH = new PowerDistribution(1, ModuleType.kRev);
public final ShuffleboardTab COMMANDS_TAB = Shuffleboard.getTab("COMMANDS");
public final ShuffleboardTab MATCH_TAB = Shuffleboard.getTab("MATCH");
public final ShuffleboardTab PHOTON_TAB = Shuffleboard.getTab("PHOTON");
Expand Down Expand Up @@ -125,7 +128,6 @@ public RobotContainer() {
configureCoDriverController();
configureDefaultCommands();
}


private void configureDriverController() {
DRIVER_CONTROLLER.b().onTrue(new ShootSubwoofer(ELEVATOR, WRIST, SHOOTER));
Expand Down Expand Up @@ -266,28 +268,52 @@ public void configureShuffleboard() {
SHOOTER.setupShuffleboard();
INTAKE.setupShuffleboard();
ELEVATOR.setupShuffleboard();
COMMANDS_TAB.add("Unjam Shooter",
new InstantCommand(() -> {SHOOTER.setFeederVoltage(12); SHOOTER.setShooterVoltage(12);})
.andThen(new WaitCommand(1.0))
.andThen(new InstantCommand(() -> {SHOOTER.setFeederVoltage(-12); SHOOTER.setShooterVoltage(-12);}))
.andThen(new InstantCommand(() -> {SHOOTER.stopFeeder(); SHOOTER.stopShooter();})
));
COMMANDS_TAB.add(
"Unjam Shooter",
new InstantCommand(
() -> {
SHOOTER.setFeederVoltage(12);
SHOOTER.setShooterVoltage(12);
})
.andThen(new WaitCommand(1.0))
.andThen(
new InstantCommand(
() -> {
SHOOTER.setFeederVoltage(-12);
SHOOTER.setShooterVoltage(-12);
}))
.andThen(
new InstantCommand(
() -> {
SHOOTER.stopFeeder();
SHOOTER.stopShooter();
})));
PHOTON_TAB.addDouble("DISTANCE_TO_SPEAKER", () -> Util.getInterpolatedDistance(SPEAKER_PHOTON));

COMMANDS_TAB.add("Coast Swerve", new InstantCommand(() -> {
for (int i = 0; i < 3; i++) {
drivetrain.getModule(i).getDriveMotor().setNeutralMode(NeutralModeValue.Coast);
drivetrain.getModule(i).getSteerMotor().setNeutralMode(NeutralModeValue.Coast);
}
}).ignoringDisable(true));
COMMANDS_TAB.add("Brake Swerve", new InstantCommand(() -> {
for (int i = 0; i < 3; i++) {
drivetrain.getModule(i).getDriveMotor().setNeutralMode(NeutralModeValue.Brake);
drivetrain.getModule(i).getSteerMotor().setNeutralMode(NeutralModeValue.Brake);
}
}).ignoringDisable(true));
COMMANDS_TAB.add(
"Coast Swerve",
new InstantCommand(
() -> {
for (int i = 0; i < 3; i++) {
drivetrain.getModule(i).getDriveMotor().setNeutralMode(NeutralModeValue.Coast);
drivetrain.getModule(i).getSteerMotor().setNeutralMode(NeutralModeValue.Coast);
}
})
.ignoringDisable(true));
COMMANDS_TAB.add("ShootAmp", new ShootAmp(SHOOTER, ELEVATOR, WRIST));
COMMANDS_TAB.add(
"Brake Swerve",
new InstantCommand(
() -> {
for (int i = 0; i < 3; i++) {
drivetrain.getModule(i).getDriveMotor().setNeutralMode(NeutralModeValue.Brake);
drivetrain.getModule(i).getSteerMotor().setNeutralMode(NeutralModeValue.Brake);
}
})
.ignoringDisable(true));
COMMANDS_TAB.add("Lob Note", new LobNote(SHOOTER, WRIST, ELEVATOR));
COMMANDS_TAB.add("Fast Point", new FastPoint(DRIVETRAIN, SPEAKER_PHOTON));
COMMANDS_TAB.add("NewShootAMpAuto", new NewShootAmpAuto(SHOOTER, ELEVATOR, WRIST));
COMMANDS_TAB.add(
"Force Zero All",
new InstantCommand(
Expand Down Expand Up @@ -352,7 +378,11 @@ public void configureNamedCommands() {
NamedCommands.registerCommand(
"ShootNote", new ShootNoteSequence(SHOOTER, WRIST, Constants.Shooter.SHOOTER_RPM, 40));
NamedCommands.registerCommand(
"ShootNoteRegular",new ShootNote(SHOOTER, ELEVATOR, Constants.Shooter.SHOOTER_RPM));
"ShootNoteRegular",
new ShootNoteAimbotFixed(
SHOOTER, ELEVATOR, Constants.Shooter.SHOOTER_RPM, SPEAKER_PHOTON, WRIST)
.withTimeout(3.0)
.andThen(new PoopNote(SHOOTER, 1000).withTimeout(0.7)));
NamedCommands.registerCommand(
"ShootNoteAimbot",
new ShootNoteSequence(
Expand Down Expand Up @@ -399,7 +429,9 @@ public void configureNamedCommands() {
SHOOTER,
INTAKE));
NamedCommands.registerCommand("ShootSubwoofer", new ShootSubwoofer(ELEVATOR, WRIST, SHOOTER));
// NamedCommands.registerCommand("ShootAmp", new ShootAmp(SHOOTER, ELEVATOR, WRIST));
NamedCommands.registerCommand("ShootAmp", new ShootAmp(SHOOTER, ELEVATOR, WRIST));
NamedCommands.registerCommand("GoHome", new GoHome(ELEVATOR, WRIST, SHOOTER, INTAKE));
NamedCommands.registerCommand("NewShootAmp", new NewShootAmpAuto(SHOOTER, ELEVATOR, WRIST));
NamedCommands.registerCommand(
"DriveToNoteAuto",
new ParallelDeadlineGroup(
Expand Down
Loading

0 comments on commit 880167b

Please sign in to comment.