Skip to content

Commit

Permalink
Merge branch 'main' into 121-enable-linter-to-be-run-manually
Browse files Browse the repository at this point in the history
  • Loading branch information
WindowsVistaisCool committed Jan 29, 2024
2 parents 7c5a071 + 7122dc0 commit 7c5da49
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 63 deletions.
9 changes: 2 additions & 7 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import frc.robot.command.Shoot;
import frc.robot.command.tests.DrivetrainSystemTest;
import frc.robot.command.tests.TurnSystemTest;
import frc.robot.command.tests.testCommands.TurnTest;
import frc.robot.command.ChasePieces;
import frc.robot.command.Climb;
import frc.robot.command.ManualClimb;
Expand Down Expand Up @@ -170,12 +171,6 @@ protected void configureFaultMonitors() {
@Override
protected void configureSystemTests() {
SystemTest.registerTest("Drive Test", new DrivetrainSystemTest(drivetrain, brake, DrivetrainConstants.SYS_TEST_SPEED_DRIVE));

SystemTest.registerTest("Azimuth Test", new SequentialCommandGroup(
new TimedCommand(new TurnSystemTest(drivetrain, () -> DrivetrainConstants.SYS_TEST_SPEED_TURN), 1),
new WaitCommand(0.5),
new TimedCommand(new TurnSystemTest(drivetrain, () -> -DrivetrainConstants.SYS_TEST_SPEED_TURN), 1),
drivetrain.applyRequest(() -> brake)
));
SystemTest.registerTest("Azimuth Test", new TurnSystemTest(drivetrain, brake, DrivetrainConstants.SYS_TEST_SPEED_TURN));
}
}
32 changes: 18 additions & 14 deletions src/main/java/frc/robot/command/tests/DrivetrainSystemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,30 @@

import com.ctre.phoenix6.mechanisms.swerve.SwerveRequest;

import edu.wpi.first.wpilibj2.command.InstantCommand;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import edu.wpi.first.wpilibj2.command.WaitCommand;
import frc.robot.command.tests.testCommands.DriveTest;
import frc.robot.subsystems.Swerve;
import frc.thunder.command.TimedCommand;
import frc.thunder.testing.SystemTestCommandGroup;

public class DrivetrainSystemTest extends SequentialCommandGroup {

public class DrivetrainSystemTest extends SystemTestCommandGroup {
public DrivetrainSystemTest(Swerve drivetrain, SwerveRequest brake, double speed) {
addCommands(
new WaitCommand(0.5),
new TimedCommand(new DriveTest(drivetrain, () -> speed, () -> 0d), 1), // Forward
new WaitCommand(1),
new TimedCommand(new DriveTest(drivetrain, () -> -speed, () -> 0d), 1), // Backward
new WaitCommand(1),
new TimedCommand(new DriveTest(drivetrain, () -> 0d, () -> speed), 1), // Left
new WaitCommand(1),
new TimedCommand(new DriveTest(drivetrain, () -> 0d, () -> -speed), 1), // Right
new WaitCommand(0.5),
drivetrain.applyRequest(() -> brake) // Brake
super(
new SequentialCommandGroup(
new WaitCommand(0.5),
new TimedCommand(new DriveTest(drivetrain, () -> speed, () -> 0d), 1), // Forward
new WaitCommand(1),
new TimedCommand(new DriveTest(drivetrain, () -> -speed, () -> 0d), 1), // Backward
new WaitCommand(1),
new TimedCommand(new DriveTest(drivetrain, () -> 0d, () -> speed), 1), // Left
new WaitCommand(1),
new TimedCommand(new DriveTest(drivetrain, () -> 0d, () -> -speed), 1), // Right
new WaitCommand(0.5),
drivetrain.applyRequest(() -> brake) // Brake
)
);
}

}
55 changes: 19 additions & 36 deletions src/main/java/frc/robot/command/tests/TurnSystemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,28 @@

package frc.robot.command.tests;

import java.util.function.DoubleSupplier;

import com.ctre.phoenix6.mechanisms.swerve.SwerveRequest;

import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import edu.wpi.first.wpilibj2.command.WaitCommand;
import frc.robot.command.tests.testCommands.TurnTest;
import frc.robot.subsystems.Swerve;

public class TurnSystemTest extends Command {

private Swerve drivetrain;
private DoubleSupplier speed;

/**
* System test for testing azimuth motors
* @param drivetrain swerve subsystem
* @param speed rotational rate
*/
public TurnSystemTest(Swerve drivetrain, DoubleSupplier speed) {
this.drivetrain = drivetrain;
this.speed = speed;

addRequirements(drivetrain);
}

@Override
public void initialize() {}

@Override
public void execute() {
drivetrain.setControl(new SwerveRequest.RobotCentric().withVelocityX(0).withVelocityY(0).withRotationalRate(speed.getAsDouble()));
import frc.thunder.command.TimedCommand;
import frc.thunder.testing.SystemTestCommandGroup;

public class TurnSystemTest extends SystemTestCommandGroup {

public TurnSystemTest(Swerve drivetrain, SwerveRequest brake, double speed) {
super(
new SequentialCommandGroup(
new WaitCommand(0.5),
new TimedCommand(new TurnTest(drivetrain, () -> speed), 1),
new WaitCommand(1),
new TimedCommand(new TurnTest(drivetrain, () -> -speed), 1),
new WaitCommand(0.5),
drivetrain.applyRequest(() -> brake)
)
);
}

@Override
public void end(boolean interrupted) {
drivetrain.setControl(new SwerveRequest.RobotCentric().withVelocityX(0).withVelocityY(0).withRotationalRate(0));
}

@Override
public boolean isFinished() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// 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.

package frc.robot.command.tests;
package frc.robot.command.tests.testCommands;

import java.util.function.DoubleSupplier;

Expand All @@ -18,7 +18,7 @@ public class DriveTest extends Command {
private DoubleSupplier speedY;

/**
* Creates a new drive test
* System test command for testing drive motors
* @param drivetrain swerve subsystem
* @param speedX X velocity
* @param speedY Y velocity
Expand Down
48 changes: 48 additions & 0 deletions src/main/java/frc/robot/command/tests/testCommands/TurnTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// 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.

package frc.robot.command.tests.testCommands;

import java.util.function.DoubleSupplier;

import com.ctre.phoenix6.mechanisms.swerve.SwerveRequest;

import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystems.Swerve;

public class TurnTest extends Command {

private Swerve drivetrain;
private DoubleSupplier speed;

/**
* System test command for testing azimuth motors
* @param drivetrain swerve subsystem
* @param speed rotational rate
*/
public TurnTest(Swerve drivetrain, DoubleSupplier speed) {
this.drivetrain = drivetrain;
this.speed = speed;

addRequirements(drivetrain);
}

@Override
public void initialize() {}

@Override
public void execute() {
drivetrain.setControl(new SwerveRequest.RobotCentric().withVelocityX(0).withVelocityY(0).withRotationalRate(speed.getAsDouble()));
}

@Override
public void end(boolean interrupted) {
drivetrain.setControl(new SwerveRequest.RobotCentric().withVelocityX(0).withVelocityY(0).withRotationalRate(0));
}

@Override
public boolean isFinished() {
return false;
}
}
2 changes: 1 addition & 1 deletion src/main/java/frc/thunder
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.1.5",
"version": "2024.1.6",
"uuid": "1b42324f-17c6-4875-8e77-1c312bc8c786",
"frcYear": "2024",
"mavenUrls": [
Expand All @@ -12,15 +12,15 @@
{
"groupId": "com.pathplanner.lib",
"artifactId": "PathplannerLib-java",
"version": "2024.1.5"
"version": "2024.1.6"
}
],
"jniDependencies": [],
"cppDependencies": [
{
"groupId": "com.pathplanner.lib",
"artifactId": "PathplannerLib-cpp",
"version": "2024.1.5",
"version": "2024.1.6",
"libName": "PathplannerLib",
"headerClassifier": "headers",
"sharedLibrary": false,
Expand Down

0 comments on commit 7c5da49

Please sign in to comment.