Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GKC 2024 Changes (Disaster) #179

Merged
merged 60 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from 59 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
aef72a6
theoretically fix limelight aiming
willitcode Apr 4, 2024
44790f9
WHY ON EARTH WERE RELAY IDS BROKEN
Jack-Haefele Apr 4, 2024
ccff581
Add auto to chooser
Jack-Haefele Apr 4, 2024
85d695c
LL angle and height
Jack-Haefele Apr 4, 2024
092ddbc
heading snapping sprint quickfix
Jack-Haefele Apr 4, 2024
c91457b
shorten compressor deadband
Jack-Haefele Apr 4, 2024
745ef5d
move belt follower call
Jack-Haefele Apr 4, 2024
7357a64
limelight theoretically works I hope
Jack-Haefele Apr 5, 2024
0caf91d
don't seek in auto
Jack-Haefele Apr 5, 2024
8fd7a02
Revert "limelight theoretically works I hope"
Jack-Haefele Apr 5, 2024
0888267
Revert "don't seek in auto"
Jack-Haefele Apr 5, 2024
53ca2db
adjusted steer strength and lost a light
Jack-Haefele Apr 5, 2024
d5f3c4b
shorter taxi
Jack-Haefele Apr 5, 2024
6c3339b
adjusted math
Jack-Haefele Apr 6, 2024
e94ba23
created red and blue drive to amp
Jack-Haefele Apr 6, 2024
cae1030
create dump note
Jack-Haefele Apr 6, 2024
4434e49
create one porce auto but it works i swear
Jack-Haefele Apr 6, 2024
9a01517
create pick up from center auto
Jack-Haefele Apr 6, 2024
8fe5760
create taxi long auto
Jack-Haefele Apr 6, 2024
1cd20cd
spotless
Jack-Haefele Apr 6, 2024
3c01f80
adjusted taxi duration
Jack-Haefele Apr 6, 2024
ccc33c3
rebound left bumper to sprint on operatorless
Jack-Haefele Apr 6, 2024
bd78e61
updated tobot container with autos
Jack-Haefele Apr 6, 2024
02df367
what
Jack-Haefele Apr 7, 2024
0641695
what is a parallel deadline group
Jack-Haefele Apr 7, 2024
783b305
create drive to center auto
Jack-Haefele Apr 7, 2024
3254130
bye bye translation
Jack-Haefele Apr 7, 2024
8da3a4f
set drive to stop in heading snapping end
Jack-Haefele Apr 7, 2024
f7b902d
updated robotcontainer with drive to center auto
Jack-Haefele Apr 7, 2024
a695784
Revert "move belt follower call"
Jack-Haefele Apr 9, 2024
1cd5f0f
updated SDPFOHS to actually set the drive perspective to field orient…
Jack-Haefele Apr 22, 2024
791ff8b
updated operatorless right bumper to drive field oriented sprint
Jack-Haefele Apr 22, 2024
8587168
Merge pull request #186 from frc937/heading-snap-gross
Jack-Haefele Apr 22, 2024
c9ee874
add constants to DriveToAmpBlue
quackitsquinn Apr 22, 2024
dcebbd2
add constants to DriveToAmpRed
quackitsquinn Apr 22, 2024
9a9ed7e
AddressableLightStrip setColorLight javadoc
AraReighard Apr 22, 2024
6e89bf0
add DriveToCenter wait time constant
quackitsquinn Apr 22, 2024
ac08d99
DriveToAmps javadocs
AraReighard Apr 22, 2024
a4d09b8
javadoc DriveToCenterAuto
AraReighard Apr 22, 2024
02f53ab
DumpNote javadoc
AraReighard Apr 22, 2024
cf0324e
OnePieceAutoButItWorksISwear javadoc
AraReighard Apr 22, 2024
8afa2fd
PickUpFromCenterAuto javadoc
AraReighard Apr 22, 2024
9c6cdd5
added javadoc to public instances in robotContainer
AraReighard Apr 22, 2024
8ea04d6
javadoc autos
AraReighard Apr 22, 2024
7cdcb53
Merge branch 'gkc-2024' into gkc-javadoc
AraReighard Apr 29, 2024
663e4e1
spotless
AraReighard Apr 29, 2024
149d70a
Merge pull request #188 from frc937/gkc-javadoc
AraReighard Apr 29, 2024
b4e9711
Add getAlliance connivence method
quackitsquinn Apr 29, 2024
fc6fb12
remove WPIlib comments
quackitsquinn Apr 29, 2024
b82308f
Basic skeleton
MarissaKoglesby Apr 29, 2024
5d56048
Merge remote-tracking branch 'origin/gkc-2024' into gkc-constant-cleanup
quackitsquinn Apr 29, 2024
96049b0
Added to RobotContainer
MarissaKoglesby Apr 29, 2024
83057e1
Removed comments
MarissaKoglesby Apr 29, 2024
762eba4
Merge pull request #190 from frc937/delayed-taxi-auto
MarissaKoglesby Apr 29, 2024
4a307a5
Merge remote-tracking branch 'origin/gkc-2024' into gkc-constant-cleanup
quackitsquinn Apr 29, 2024
e7bf22a
fix more stuff
quackitsquinn May 6, 2024
220173a
more tiny fixes
quackitsquinn May 13, 2024
17264d4
tiny constant
quackitsquinn May 13, 2024
13fe373
Merge pull request #189 from frc937/gkc-constant-cleanup
quackitsquinn May 13, 2024
bfcf1be
fix duplicated constants
willitcode May 13, 2024
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
50 changes: 43 additions & 7 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static final class Mailbox {
/** Constants for the Pneumatics system. */
public static final class MailboxPneumatics {
/** The ID for the relay that controls the mailbox's solenoids */
public static final int MAILBOX_SOLENOID_RELAY_ID = 0;
public static final int MAILBOX_SOLENOID_RELAY_ID = 1;
}

/** Constants for the Belts system. */
Expand Down Expand Up @@ -113,7 +113,7 @@ public static class Auto {
public static final double TAXI_AUTO_METERS_PER_SECOND = 1.0;

/** The number of seconds that we want to taxi for */
public static final double TAXI_AUTO_DURATION_SECONDS = 2.0;
public static final double TAXI_AUTO_DURATION_SECONDS = 1.25;

/** The amount of time we want/need to drive away from the amp in auto. */
public static final double DRIVE_AWAY_FROM_AMP_TIME = 2.0;
Expand All @@ -123,6 +123,42 @@ public static class Auto {

/** The amount of time that we want to run the fire note command in auto. */
public static final double FIRE_NOTE_FOR_TIME = 4.0;

/** Time in seconds that we delay our taxi in the delayed taxi auto. */
public static final double TAXI_DELAY_TIME = 10.0;

/** Time in seconds that we wait for FireNoteRoutine to end. */
public static final double DUMP_NOTE_WAIT_TIME = 4.0;

/** Time in seconds that we wait for PickupFromCenter to end. */
public static final double PICKUP_CENTER_WAIT_TIME = 5.0;

/** Time in seconds that we wait for TaxiLongAuto to end. */
public static final double TAXI_LONG_WAIT_TIME = 2.0;

/** Constants for the DriveToAmpBlue auto */
public static class DriveToAmpBlue {
/** The time for the robot to drive left towards the amp. */
public static final double LEFT_WAIT_TIME = 1;

/** The time for the robot to drive forwards towards the amp. */
public static final double FORWARD_WAIT_TIME = 0.5;
}

/** Constants for the DriveToAmpRed auto */
willitcode marked this conversation as resolved.
Show resolved Hide resolved
public static class DriveToAmpRed {
willitcode marked this conversation as resolved.
Show resolved Hide resolved
/** The time for the robot to drive left towards the amp. */
public static final double LEFT_WAIT_TIME = 1;

/** The time for the robot to drive forwards towards the amp. */
public static final double FORWARD_WAIT_TIME = 0.5;
}

/** Constants for the auto that drives bot to center of field. */
public static class DriveToCenter {
/** The time for the robot to drive to the center. */
public static final double DRIVE_CENTER_WAIT_TIME = 5.0;
}
}

/** Constants for the Intake System */
Expand Down Expand Up @@ -161,10 +197,10 @@ public static final class AimingLimelight {
public static final String LIMELIGHT_NAME = "limelight";

/** The number of degrees the Limelight is mounted back from perfectly vertical */
public static final double MOUNT_ANGLE = 50;
public static final double MOUNT_ANGLE = 45;

/** The number of inches from the center of the Limelight lens to the floor */
public static final double MOUNT_HEIGHT = 10.0625;
public static final double MOUNT_HEIGHT = 19.5;

/** The height to the Amp Apriltag off the ground. */
public static final double AMP_APRILTAG_HEIGHT = 53.13;
Expand All @@ -175,7 +211,7 @@ public static final class AimingLimelight {
/**
* How hard to turn toward the target. Double between 0 and 1, standard way to drive a motor
*/
public static final double STEER_STRENGTH = 0.01;
public static final double STEER_STRENGTH = 0.02;

/** How hard to drive toward the target. Same notation as above. */
public static final double DRIVE_STRENGTH = 0.01;
Expand Down Expand Up @@ -233,7 +269,7 @@ public static class LightStrips {
public static final int PWM_ID = 0;

/** The count of LEDs for the lights. */
public static final int LED_COUNT = 150;
public static final int LED_COUNT = 149;

/** The speed of the fade animation. [0, 1] */
public static final double STRIP_FADE_SPEED = 0.05;
Expand Down Expand Up @@ -273,6 +309,6 @@ public static final class Compressor {
* How many periodic loops do we want to wait for to turn off the compressor. Used to prevent
* rapidly turning on and off the compressor.
*/
public static final int COMPRESSOR_PRESSURE_SWITCH_DEADBAND = 100; /* = 2 Seconds */
public static final int COMPRESSOR_PRESSURE_SWITCH_DEADBAND = 50; /* 1 second */
}
}
1 change: 1 addition & 0 deletions src/main/java/frc/robot/Controllers.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ private static void configureOperatorlessKeybinds() {
pilotController.b().whileTrue(RobotContainer.fireNote);
pilotController.x().whileTrue(RobotContainer.climbUp);
pilotController.y().whileTrue(RobotContainer.climbDown);
pilotController.rightBumper().whileTrue(RobotContainer.driveFieldOrientedSprint);

keymapEntry.setString("Operatorless");
}
Expand Down
54 changes: 52 additions & 2 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

import com.pathplanner.lib.auto.AutoBuilder;
import com.pathplanner.lib.auto.NamedCommands;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.DriverStation.Alliance;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj2.command.Command;
Expand All @@ -29,9 +31,14 @@
import frc.robot.commands.RunIntake;
import frc.robot.commands.RunIntakeReverse;
import frc.robot.commands.StartCamera;
import frc.robot.commands.auto.DelayedTaxiAuto;
import frc.robot.commands.auto.DriveToCenterAuto;
import frc.robot.commands.auto.MoveAwayFromAmp;
import frc.robot.commands.auto.OnePieceAuto;
import frc.robot.commands.auto.OnePieceAutoButItWorksISwear;
import frc.robot.commands.auto.PickUpFromCenterAuto;
import frc.robot.commands.auto.TaxiAuto;
import frc.robot.commands.auto.TaxiLongAuto;
import frc.robot.commands.drive.DriveFieldOrientedHeadingSnapping;
import frc.robot.commands.drive.DriveRobot;
import frc.robot.commands.drive.SetDrivePerspectiveFieldOriented;
Expand Down Expand Up @@ -59,6 +66,7 @@
import frc.robot.subsystems.mailbox.Mailbox;
import frc.robot.subsystems.mailbox.MailboxBelts;
import frc.robot.subsystems.mailbox.MailboxPneumatics;
import java.util.Optional;

/** Singleton class that contains all the robot's subsystems, commands, and button bindings. */
@SuppressWarnings("unused")
Expand Down Expand Up @@ -261,9 +269,25 @@ public class RobotContainer {
/** Singleton instance of {@link OnePieceAuto} for the whole robot. */
public static OnePieceAuto onePieceAuto = new OnePieceAuto();

/** Singleton instance of {@link OnePieceAutoButItWorksISwear} for the whole robot. */
public static OnePieceAutoButItWorksISwear onePieceAutoButItWorksISwear =
new OnePieceAutoButItWorksISwear();

/** Singleton instance of {@link TaxiLongAuto} for the whole robot. */
public static TaxiLongAuto taxiLongAuto = new TaxiLongAuto();

/** Singleton instance of {@link PickUpFromCenterAuto} for the whole robot. */
public static PickUpFromCenterAuto pickUpFromCenterAuto = new PickUpFromCenterAuto();

/** Singleton instance of {@link DriveToCenterAuto} for the whole robot. */
public static DriveToCenterAuto driveToCenterAuto = new DriveToCenterAuto();

/** Singleton instance of {@link TaxiAuto} for the whole robot. */
public static TaxiAuto taxiAuto = new TaxiAuto();

/** Singleton instance of {@link DelayedTaxiAuto} for the whole robot. */
public static DelayedTaxiAuto delayedTaxiAuto = new DelayedTaxiAuto();

/** Singleton instance of {@link ClearPDPStickyFaults} for the whole robot. */
public static ClearPDPStickyFaults clearPDPStickyFaults = new ClearPDPStickyFaults();

Expand All @@ -273,7 +297,7 @@ public class RobotContainer {
/** Singleton instance of {@link DisabledLight} for the whole robot. */
public static DisabledLight disabledLights = new DisabledLight();

/** Singleton instance of {@link EnableLights} for the whole robot. */
/** Singleton instance of {@link EnabledLight} for the whole robot. */
public static EnabledLight enabledLights = new EnabledLight();
willitcode marked this conversation as resolved.
Show resolved Hide resolved

/** Singleton instance of {@link NoteLight} for the whole robot. */
Expand Down Expand Up @@ -310,7 +334,7 @@ public RobotContainer() {

startIntakeCamera.schedule();

drive.setDefaultCommand(driveFieldOrientedHeadingSnapping);
drive.setDefaultCommand(driveFieldOriented);
robotLights.setDefaultCommand(enabledLights);
compressor.setDefaultCommand(controlCompressor);
}
Expand All @@ -328,6 +352,18 @@ private void configureAuto() {
/* This is where you put auto commands. Call autoChooser.addOption() to add autos. */
autoChooser.addOption("Taxi", taxiAuto);

// autoChooser.addOption("One Note With Limelight", onePieceAuto);

autoChooser.addOption("WORKING ONE PIECE AUTO I HOPE", onePieceAutoButItWorksISwear);

autoChooser.addOption("LONG taxi auto", taxiLongAuto);

autoChooser.addOption("Pick Up Note From Center", pickUpFromCenterAuto);

autoChooser.addOption("NO INTAKE drive to center", driveToCenterAuto);

autoChooser.addOption("Taxi with 10 second delay", delayedTaxiAuto);

Shuffleboard.getTab("Driver").add("Choose Auto Routine", autoChooser);
}

Expand All @@ -354,4 +390,18 @@ private void configureBindings() {
public Command getAutonomousCommand() {
return autoChooser.getSelected();
}

/**
* Returns true if the robot is on the red alliance. False otherwise.
*
* @return True if the robot is on the red alliance. False otherwise.
*/
public static boolean isRedAlliance() {
Optional<Alliance> alliance = DriverStation.getAlliance();
if (!alliance.isEmpty()) {
return alliance.get() == Alliance.Red;
} else {
return false;
}
}
}
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/commands/AimWithLimelight.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ public void execute() {
/* Remember if we've seen a target so that we can assume we're aimed if we lose sight of the target
* Only reason we assume this is because of where the Limelight is, which results in us not actually seeing the target if we're properly aimed
*/
hasSeenTarget = true;
// hasSeenTarget = true;
willitcode marked this conversation as resolved.
Show resolved Hide resolved

drive.driveRobot(new Translation2d(getX() * -1.0, 0.0), getRotation(), false);
drive.driveRobot(new Translation2d(getX(), getRotation()), 0, false);

/* End the command if we're at our "aimed" threshold */
if (isAngled() && isDistanced()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

package frc.robot.commands;

import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.Constants;
import frc.robot.RobotContainer;
Expand Down Expand Up @@ -52,8 +51,7 @@ public void initialize() {
this.oldPipelineNumber = limelight.getLimelightPipeline();
limelight.setLimelightPipeline(seekingPipelineNumber);

var alliance = DriverStation.getAlliance();
if (alliance.isPresent() ? alliance.get() == DriverStation.Alliance.Red : false) {
if (RobotContainer.isRedAlliance()) {
this.rotationRadiansPerSecond = rotationRadiansPerSecond * -1;
}
}
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/frc/robot/commands/auto/DelayedTaxiAuto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

/*
* Asimov's Laws:
* The First Law: A robot may not injure a human being or, through inaction, allow a human being to come to harm.
* The Second Law: A robot must obey the orders given it by human beings except where such orders would conflict with the First Law.
* The Third Law: A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.
*/

package frc.robot.commands.auto;

import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import edu.wpi.first.wpilibj2.command.WaitCommand;
import frc.robot.Constants;

/** Taxi auto that waits a bit before it taxis. */
public class DelayedTaxiAuto extends SequentialCommandGroup {
/** Creates a new DelayedTaxiAuto. */
public DelayedTaxiAuto() {
addCommands(new WaitCommand(Constants.Auto.TAXI_DELAY_TIME), new TaxiAuto());
}
}
47 changes: 47 additions & 0 deletions src/main/java/frc/robot/commands/auto/DriveToAmpBlue.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

/*
* Asimov's Laws:
* The First Law: A robot may not injure a human being or, through inaction, allow a human being to come to harm.
* The Second Law: A robot must obey the orders given it by human beings except where such orders would conflict with the First Law.
* The Third Law: A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.
*/

package frc.robot.commands.auto;

import edu.wpi.first.wpilibj2.command.ParallelDeadlineGroup;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import edu.wpi.first.wpilibj2.command.WaitCommand;
import frc.robot.Constants;
import frc.robot.commands.drive.DriveFieldOrientedHeadingSnapping;

/** Auto that manually drives bot to blue amp. Made due to faulty limelight at comp. */
public class DriveToAmpBlue extends SequentialCommandGroup {

/** Creates a new DriveToAmpBlue. */
public DriveToAmpBlue() {
super(
new ParallelDeadlineGroup(
new WaitCommand(Constants.Auto.DriveToAmpBlue.LEFT_WAIT_TIME),
new DriveFieldOrientedHeadingSnapping(
() -> 0.0,
() -> 0.0,
() -> 0.0,
() -> false,
() -> false,
() -> true,
() -> false)),
new ParallelDeadlineGroup(
new WaitCommand(Constants.Auto.DriveToAmpBlue.FORWARD_WAIT_TIME),
new DriveFieldOrientedHeadingSnapping(
() -> 0.0,
() -> 1.0,
() -> 0.0,
() -> false,
() -> false,
() -> false,
() -> false)));
}
}
47 changes: 47 additions & 0 deletions src/main/java/frc/robot/commands/auto/DriveToAmpRed.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

/*
* Asimov's Laws:
* The First Law: A robot may not injure a human being or, through inaction, allow a human being to come to harm.
* The Second Law: A robot must obey the orders given it by human beings except where such orders would conflict with the First Law.
* The Third Law: A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.
*/

package frc.robot.commands.auto;

import edu.wpi.first.wpilibj2.command.ParallelDeadlineGroup;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import edu.wpi.first.wpilibj2.command.WaitCommand;
import frc.robot.Constants;
import frc.robot.commands.drive.DriveFieldOrientedHeadingSnapping;

/** Auto that manually drives bot to red amp. Made due to faulty limelight at comp. */
public class DriveToAmpRed extends SequentialCommandGroup {

/** Creates a new DriveToAmpRed. */
public DriveToAmpRed() {
super(
new ParallelDeadlineGroup(
new WaitCommand(Constants.Auto.DriveToAmpRed.LEFT_WAIT_TIME),
new DriveFieldOrientedHeadingSnapping(
() -> 0.0,
() -> 0.0,
() -> 0.0,
() -> false,
() -> false,
() -> false,
() -> true)),
new ParallelDeadlineGroup(
new WaitCommand(Constants.Auto.DriveToAmpRed.FORWARD_WAIT_TIME),
new DriveFieldOrientedHeadingSnapping(
() -> 0.0,
() -> -1.0,
() -> 0.0,
() -> false,
() -> false,
() -> false,
() -> false)));
}
}
Loading
Loading