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

Commit c688b24

Browse files
committed
Finished all subsystems and most commands
1 parent 5a5a7fb commit c688b24

13 files changed

+758
-6
lines changed

build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ dependencies {
6666
nativeRelease wpi.java.deps.wpilibJniRelease(wpi.platforms.desktop)
6767
nativeRelease wpi.java.vendor.jniRelease(wpi.platforms.desktop)
6868
simulationRelease wpi.sim.enableRelease()
69-
70-
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1'
71-
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
7269
}
7370

7471
test {
@@ -98,4 +95,4 @@ wpi.java.configureTestTasks(test)
9895
// Configure string concat to always inline compile
9996
tasks.withType(JavaCompile) {
10097
options.compilerArgs.add '-XDstringConcat=inline'
101-
}
98+
}

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME
7-
zipStorePath=permwrapper/dists
7+
zipStorePath=permwrapper/dists
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Copyright (c) FIRST and other WPILib contributors.
2+
// Open Source Software; you can modify and/or share it under the terms of
3+
// the WPILib BSD license file in the root directory of this project.
4+
5+
package frc.robot.commands;
6+
7+
import edu.wpi.first.wpilibj.XboxController;
8+
import edu.wpi.first.wpilibj2.command.Command;
9+
10+
import frc.robot.subsystems.HangerSubsystem;
11+
12+
public class RunJoystickHanger extends Command {
13+
private final HangerSubsystem hanger;
14+
private final XboxController controller;
15+
16+
public RunJoystickHanger(HangerSubsystem hangerSubsystem, XboxController ctrl) {
17+
this.hanger = hangerSubsystem;
18+
this.controller = ctrl;
19+
addRequirements(hanger);
20+
}
21+
22+
@Override
23+
public void initialize() {
24+
hanger.coast();
25+
}
26+
27+
@Override
28+
public void execute() {
29+
if (controller.getRightBumper()) {
30+
hanger.setSpeed(0.5);
31+
} else if (controller.getLeftBumper()) {
32+
hanger.setSpeed(-0.5);
33+
} else {
34+
hanger.setSpeed(0);
35+
hanger.removeDefaultCommand();
36+
}
37+
}
38+
39+
@Override
40+
public void end(boolean interrupted) {
41+
hanger.brake();
42+
}
43+
44+
@Override
45+
public boolean isFinished() {
46+
return false;
47+
}
48+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright (c) FIRST and other WPILib contributors.
2+
// Open Source Software; you can modify and/or share it under the terms of
3+
// the WPILib BSD license file in the root directory of this project.
4+
5+
package frc.robot.commands;
6+
7+
import edu.wpi.first.wpilibj.XboxController;
8+
import edu.wpi.first.wpilibj2.command.Command;
9+
10+
import frc.robot.subsystems.HandoffSubsystem;
11+
import frc.robot.subsystems.IntakeSubsystem;
12+
13+
public class RunJoystickIntakeHandoff extends Command {
14+
private final HandoffSubsystem handoff;
15+
private final IntakeSubsystem intake;
16+
private final XboxController controller;
17+
18+
public RunJoystickIntakeHandoff(HandoffSubsystem handoffSubsystem, IntakeSubsystem intakeSubsystem, XboxController ctrl) {
19+
this.handoff = handoffSubsystem;
20+
this.controller = ctrl;
21+
this.intake = intakeSubsystem;
22+
addRequirements(handoff, intake);
23+
}
24+
25+
@Override
26+
public void initialize() {
27+
handoff.coast();
28+
intake.coast();
29+
}
30+
31+
@Override
32+
public void execute() {
33+
intake.setSpeed(controller.getRightY());
34+
handoff.setSpeed(controller.getRightY());
35+
}
36+
37+
@Override
38+
public void end(boolean interrupted) {
39+
handoff.brake();
40+
intake.brake();
41+
}
42+
43+
@Override
44+
public boolean isFinished() {
45+
return false;
46+
}
47+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright (c) FIRST and other WPILib contributors.
2+
// Open Source Software; you can modify and/or share it under the terms of
3+
// the WPILib BSD license file in the root directory of this project.
4+
5+
package frc.robot.commands;
6+
7+
import edu.wpi.first.wpilibj.XboxController;
8+
import edu.wpi.first.wpilibj2.command.Command;
9+
10+
import frc.robot.subsystems.ShooterSubsystem;
11+
12+
public class RunJoystickShooter extends Command {
13+
private final ShooterSubsystem shooter;
14+
private final XboxController controller;
15+
16+
public RunJoystickShooter(ShooterSubsystem shooterSubsystem, XboxController ctrl) {
17+
this.shooter = shooterSubsystem;
18+
this.controller = ctrl;
19+
addRequirements(shooter);
20+
}
21+
22+
@Override
23+
public void initialize() {
24+
shooter.coast();
25+
}
26+
27+
@Override
28+
public void execute() {
29+
shooter.setSpeed(controller.getRightY());
30+
}
31+
32+
@Override
33+
public void end(boolean interrupted) {
34+
shooter.brake();
35+
}
36+
37+
@Override
38+
public boolean isFinished() {
39+
return false;
40+
}
41+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright (c) FIRST and other WPILib contributors.
2+
// Open Source Software; you can modify and/or share it under the terms of
3+
// the WPILib BSD license file in the root directory of this project.
4+
5+
package frc.robot.subsystems;
6+
7+
import com.revrobotics.CANSparkMax;
8+
import com.revrobotics.CANSparkBase.IdleMode;
9+
import com.revrobotics.CANSparkLowLevel.MotorType;
10+
11+
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
12+
import edu.wpi.first.wpilibj2.command.SubsystemBase;
13+
14+
public class HandoffSubsystem extends SubsystemBase {
15+
private final CANSparkMax topHandoffMotor;
16+
private final CANSparkMax bottomHandoffMotor;
17+
18+
public HandoffSubsystem() {
19+
topHandoffMotor = new CANSparkMax(1, MotorType.kBrushless);
20+
bottomHandoffMotor = new CANSparkMax(2, MotorType.kBrushless);
21+
bottomHandoffMotor.setInverted(true);
22+
}
23+
24+
public void setSpeed(double speed) {
25+
topHandoffMotor.set(speed);
26+
bottomHandoffMotor.set(speed);
27+
}
28+
29+
public void brake() {
30+
topHandoffMotor.setIdleMode(IdleMode.kBrake);
31+
bottomHandoffMotor.setIdleMode(IdleMode.kBrake);
32+
}
33+
34+
public void coast() {
35+
topHandoffMotor.setIdleMode(IdleMode.kCoast);
36+
bottomHandoffMotor.setIdleMode(IdleMode.kCoast);
37+
}
38+
39+
@Override
40+
public void periodic() {
41+
SmartDashboard.putNumber("Top Handoff Motor Temp", topHandoffMotor.getMotorTemperature());
42+
SmartDashboard.putNumber("Bottom Handoff Motor Temp", bottomHandoffMotor.getMotorTemperature());
43+
}
44+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright (c) FIRST and other WPILib contributors.
2+
// Open Source Software; you can modify and/or share it under the terms of
3+
// the WPILib BSD license file in the root directory of this project.
4+
5+
package frc.robot.subsystems;
6+
7+
import com.ctre.phoenix6.hardware.TalonFX;
8+
import com.ctre.phoenix6.signals.NeutralModeValue;
9+
10+
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
11+
import edu.wpi.first.wpilibj2.command.SubsystemBase;
12+
13+
public class HangerSubsystem extends SubsystemBase {
14+
private final TalonFX hangerMotor;
15+
16+
public HangerSubsystem() {
17+
hangerMotor = new TalonFX(7);
18+
hangerMotor.setInverted(true);
19+
}
20+
21+
public void setSpeed(double speed) {
22+
hangerMotor.set(speed);
23+
}
24+
25+
public void brake() {
26+
hangerMotor.setNeutralMode(NeutralModeValue.Brake);
27+
}
28+
29+
public void coast() {
30+
hangerMotor.setNeutralMode(NeutralModeValue.Coast);
31+
}
32+
33+
@Override
34+
public void periodic() {
35+
SmartDashboard.putNumber("Hanger Motor Temp", hangerMotor.getDeviceTemp().getValueAsDouble());
36+
}
37+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright (c) FIRST and other WPILib contributors.
2+
// Open Source Software; you can modify and/or share it under the terms of
3+
// the WPILib BSD license file in the root directory of this project.
4+
5+
package frc.robot.subsystems;
6+
7+
import com.revrobotics.CANSparkMax;
8+
import com.revrobotics.CANSparkBase.IdleMode;
9+
import com.revrobotics.CANSparkLowLevel.MotorType;
10+
11+
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
12+
import edu.wpi.first.wpilibj2.command.SubsystemBase;
13+
14+
public class IntakeSubsystem extends SubsystemBase {
15+
private final CANSparkMax leftIntakeMotor;
16+
private final CANSparkMax rightIntakeMotor;
17+
18+
public IntakeSubsystem() {
19+
leftIntakeMotor = new CANSparkMax(3, MotorType.kBrushless);
20+
rightIntakeMotor = new CANSparkMax(4, MotorType.kBrushless);
21+
}
22+
23+
public void setSpeed(double speed) {
24+
leftIntakeMotor.set(speed);
25+
rightIntakeMotor.set(speed);
26+
}
27+
28+
public void brake() {
29+
leftIntakeMotor.setIdleMode(IdleMode.kBrake);
30+
rightIntakeMotor.setIdleMode(IdleMode.kBrake);
31+
}
32+
33+
public void coast() {
34+
leftIntakeMotor.setIdleMode(IdleMode.kCoast);
35+
rightIntakeMotor.setIdleMode(IdleMode.kCoast);
36+
}
37+
38+
@Override
39+
public void periodic() {
40+
SmartDashboard.putNumber("Left Intake Motor Temp", leftIntakeMotor.getMotorTemperature());
41+
SmartDashboard.putNumber("Right Intake Motor Temp", rightIntakeMotor.getMotorTemperature());
42+
}
43+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright (c) FIRST and other WPILib contributors.
2+
// Open Source Software; you can modify and/or share it under the terms of
3+
// the WPILib BSD license file in the root directory of this project.
4+
5+
package frc.robot.subsystems;
6+
7+
import com.ctre.phoenix6.hardware.TalonFX;
8+
import com.ctre.phoenix6.signals.NeutralModeValue;
9+
10+
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
11+
import edu.wpi.first.wpilibj2.command.SubsystemBase;
12+
13+
public class ShooterSubsystem extends SubsystemBase {
14+
private final TalonFX topShooterMotor;
15+
private final TalonFX bottomShooterMotor;
16+
17+
public ShooterSubsystem() {
18+
topShooterMotor = new TalonFX(5);
19+
bottomShooterMotor = new TalonFX(6);
20+
topShooterMotor.setInverted(true);
21+
bottomShooterMotor.setInverted(true);
22+
}
23+
24+
public void setSpeed(double speed) {
25+
topShooterMotor.set(speed);
26+
bottomShooterMotor.set(speed);
27+
}
28+
29+
public void brake() {
30+
topShooterMotor.setNeutralMode(NeutralModeValue.Brake);
31+
bottomShooterMotor.setNeutralMode(NeutralModeValue.Brake);
32+
}
33+
34+
public void coast() {
35+
topShooterMotor.setNeutralMode(NeutralModeValue.Coast);
36+
bottomShooterMotor.setNeutralMode(NeutralModeValue.Coast);
37+
}
38+
39+
@Override
40+
public void periodic() {
41+
SmartDashboard.putNumber("Top Shooter Motor Temperature", topShooterMotor.getDeviceTemp().getValueAsDouble());
42+
SmartDashboard.putNumber("Bottom Shooter Motor Temperature", bottomShooterMotor.getDeviceTemp().getValueAsDouble());
43+
}
44+
}

vendordeps/PathplannerLib.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"fileName": "PathplannerLib.json",
3+
"name": "PathplannerLib",
4+
"version": "2024.2.8",
5+
"uuid": "1b42324f-17c6-4875-8e77-1c312bc8c786",
6+
"frcYear": "2024",
7+
"mavenUrls": [
8+
"https://3015rangerrobotics.github.io/pathplannerlib/repo"
9+
],
10+
"jsonUrl": "https://3015rangerrobotics.github.io/pathplannerlib/PathplannerLib.json",
11+
"javaDependencies": [
12+
{
13+
"groupId": "com.pathplanner.lib",
14+
"artifactId": "PathplannerLib-java",
15+
"version": "2024.2.8"
16+
}
17+
],
18+
"jniDependencies": [],
19+
"cppDependencies": [
20+
{
21+
"groupId": "com.pathplanner.lib",
22+
"artifactId": "PathplannerLib-cpp",
23+
"version": "2024.2.8",
24+
"libName": "PathplannerLib",
25+
"headerClassifier": "headers",
26+
"sharedLibrary": false,
27+
"skipInvalidPlatforms": true,
28+
"binaryPlatforms": [
29+
"windowsx86-64",
30+
"linuxx86-64",
31+
"osxuniversal",
32+
"linuxathena",
33+
"linuxarm32",
34+
"linuxarm64"
35+
]
36+
}
37+
]
38+
}

0 commit comments

Comments
 (0)