Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public final class VisionConstants {
}

public final class DrivetrainConstants {
public static final double SLOW_MODE_CONSTANT = 20.0;
public static boolean SLOW_MODE = false;
// Fill in
}

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import edu.wpi.first.math.VecBuilder;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.CommandScheduler;
import frc.robot.Constants.DrivetrainConstants;
import frc.robot.Constants.FieldConstants.Targets;
import frc.robot.autos.AutoRoutines;
import frc.robot.commands.DriveCommands;
Expand Down Expand Up @@ -151,6 +152,9 @@ public void updateUserInput() {
superstructure.armDown();
} else if (input.rightJoystickButton(6)) {
superstructure.climb();
} else if (input.rightJoystickButton(7)) {
DrivetrainConstants.SLOW_MODE = !DrivetrainConstants.SLOW_MODE;
System.out.println("you are toggling slowmode");
} else {
superstructure.idle();
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/frc/robot/Superstructure.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
package frc.robot;

import com.ctre.phoenix6.controls.DutyCycleOut;
import com.ctre.phoenix6.hardware.TalonFX;
import edu.wpi.first.math.util.Units;
import frc.robot.Constants.ArmConstants;
import frc.robot.subsystems.conveyor.Conveyor;
import frc.robot.subsystems.elevatorarm.Arm;
import frc.robot.subsystems.elevatorarm.Arm.ArmStates;
Expand All @@ -22,7 +22,6 @@
import frc.robot.util.LoggedTunableNumber;
import frc.robot.util.LookupTable;
import org.littletonrobotics.junction.Logger;
import frc.robot.Constants.ArmConstants;

/**
* This class is where the bulk of the robot should be declared. Since Command-based is a
Expand Down
17 changes: 14 additions & 3 deletions src/main/java/frc/robot/commands/DriveCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import edu.wpi.first.wpilibj.DriverStation.Alliance;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
import frc.robot.Constants.DrivetrainConstants;
import frc.robot.Constants.FieldConstants;
import frc.robot.RobotContainer;
import frc.robot.subsystems.drive.Drive;
Expand All @@ -33,6 +34,7 @@

public class DriveCommands {
private static final double DEADBAND = 0.1;
private static double linearMagnitude;

private DriveCommands() {}

Expand All @@ -47,9 +49,18 @@ public static Command joystickDrive(
return Commands.run(
() -> {
// Apply deadband
double linearMagnitude =
MathUtil.applyDeadband(
Math.hypot(xSupplier.getAsDouble(), ySupplier.getAsDouble()), DEADBAND);
if (DrivetrainConstants.SLOW_MODE == false) {
linearMagnitude =
MathUtil.applyDeadband(
Math.hypot(xSupplier.getAsDouble(), ySupplier.getAsDouble()), DEADBAND);
} else {
linearMagnitude =
MathUtil.applyDeadband(
Math.hypot(
xSupplier.getAsDouble() / DrivetrainConstants.SLOW_MODE_CONSTANT,
ySupplier.getAsDouble() / DrivetrainConstants.SLOW_MODE_CONSTANT),
DEADBAND);
}
Rotation2d linearDirection =
new Rotation2d(xSupplier.getAsDouble(), ySupplier.getAsDouble());
double omega = MathUtil.applyDeadband(omegaSupplier.getAsDouble(), DEADBAND);
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/frc/robot/subsystems/drive/ModuleIOTalonFX.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,31 +98,31 @@ public ModuleIOTalonFX(int index) {
driveTalon = new TalonFX(13, "Takeover");
turnTalon = new TalonFX(11, "Takeover");
cancoder = new CANcoder(12, "Takeover");
absoluteEncoderOffset = new Rotation2d(0.069); // 0.069
absoluteEncoderOffset = new Rotation2d(-2.979); // 0.069
// Uncomment for jynx
// absoluteEncoderOffset = new Rotation2d(-3.123 + Math.PI);
break;
case 1: // Front Right
driveTalon = new TalonFX(23, "Takeover");
turnTalon = new TalonFX(21, "Takeover");
cancoder = new CANcoder(22, "Takeover");
absoluteEncoderOffset = new Rotation2d(-1.805); // -1.805
absoluteEncoderOffset = new Rotation2d(-.927); // -1.805
// Uncomment for jynx
// absoluteEncoderOffset = new Rotation2d(-.928 + Math.PI); // 2.778
break;
case 2: // Back RIGHT
driveTalon = new TalonFX(43, "Takeover");
turnTalon = new TalonFX(41, "Takeover");
cancoder = new CANcoder(32, "Takeover");
absoluteEncoderOffset = new Rotation2d(0.604); // 0.604
absoluteEncoderOffset = new Rotation2d(-1.68); // 0.604
// Uncomment for jynx
// absoluteEncoderOffset = new Rotation2d(1.474 + Math.PI); // -2.551
break;
case 3: // Back LEFT
driveTalon = new TalonFX(33, "Takeover");
turnTalon = new TalonFX(31, "Takeover");
cancoder = new CANcoder(42, "Takeover");
absoluteEncoderOffset = new Rotation2d(1.977); // 1.977
absoluteEncoderOffset = new Rotation2d(0.313); // 1.977
// Uncomment for jynx
// absoluteEncoderOffset = new Rotation2d(-2.686 + Math.PI); // -1/717
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public static UserInput getInstance() {
private final XboxController operatorController;

private UserInput() {

leftJoystick = new BandedJoystick(LEFT_JOYSTICK, 0.1, 0.1);
rightJoystick = new BandedJoystick(RIGHT_JOYSTICK, 0.1, 0.1);
leftXInput = Smoother.wrap(2, leftJoystick::getXBanded);
Expand Down
6 changes: 3 additions & 3 deletions vendordeps/PathplannerLib.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"fileName": "PathplannerLib.json",
"name": "PathplannerLib",
"version": "2024.2.3",
"version": "2024.2.4",
"uuid": "1b42324f-17c6-4875-8e77-1c312bc8c786",
"frcYear": "2024",
"mavenUrls": [
Expand All @@ -12,15 +12,15 @@
{
"groupId": "com.pathplanner.lib",
"artifactId": "PathplannerLib-java",
"version": "2024.2.3"
"version": "2024.2.4"
}
],
"jniDependencies": [],
"cppDependencies": [
{
"groupId": "com.pathplanner.lib",
"artifactId": "PathplannerLib-cpp",
"version": "2024.2.3",
"version": "2024.2.4",
"libName": "PathplannerLib",
"headerClassifier": "headers",
"sharedLibrary": false,
Expand Down
10 changes: 5 additions & 5 deletions vendordeps/REVLib.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"fileName": "REVLib.json",
"name": "REVLib",
"version": "2024.2.1",
"version": "2024.2.2",
"frcYear": "2024",
"uuid": "3f48eb8c-50fe-43a6-9cb7-44c86353c4cb",
"mavenUrls": [
Expand All @@ -12,14 +12,14 @@
{
"groupId": "com.revrobotics.frc",
"artifactId": "REVLib-java",
"version": "2024.2.1"
"version": "2024.2.2"
}
],
"jniDependencies": [
{
"groupId": "com.revrobotics.frc",
"artifactId": "REVLib-driver",
"version": "2024.2.1",
"version": "2024.2.2",
"skipInvalidPlatforms": true,
"isJar": false,
"validPlatforms": [
Expand All @@ -37,7 +37,7 @@
{
"groupId": "com.revrobotics.frc",
"artifactId": "REVLib-cpp",
"version": "2024.2.1",
"version": "2024.2.2",
"libName": "REVLib",
"headerClassifier": "headers",
"sharedLibrary": false,
Expand All @@ -55,7 +55,7 @@
{
"groupId": "com.revrobotics.frc",
"artifactId": "REVLib-driver",
"version": "2024.2.1",
"version": "2024.2.2",
"libName": "REVLibDriver",
"headerClassifier": "headers",
"sharedLibrary": false,
Expand Down