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

Tuning Mode #104

Merged
merged 1 commit into from
Oct 26, 2024
Merged
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
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"C_Cpp.errorSquiggles": "disabled",
"java.configuration.updateBuildConfiguration": "interactive"
"java.configuration.updateBuildConfiguration": "interactive",
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx2G -Xms100m -Xlog:disable"
}
5 changes: 5 additions & 0 deletions src/main/java/frc/robot/RobotState.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public enum State {
INTAKING,
NOTE_HELD,
TELEOP,
TUNING,
IDLE
}

Expand Down Expand Up @@ -148,6 +149,10 @@ public void updateState() {
break;
case TELEOP:
break;
case TUNING:
intake.setState(IntakeState.TUNING);
shooter.setState(ShooterState.TUNING);
drive.setState(DriveState.TUNING);
default:
break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package frc.robot.subsystems.Drivetrain;

import org.littletonrobotics.junction.Logger;
import org.littletonrobotics.junction.networktables.LoggedDashboardNumber;

import edu.wpi.first.math.controller.PIDController;
import edu.wpi.first.math.geometry.Pose2d;
Expand Down Expand Up @@ -32,6 +33,11 @@ public enum DriveState {
private final SwerveIOInputsAutoLogged swerveIOInputs = new SwerveIOInputsAutoLogged();
private final Limelight m_limelight;

private LoggedDashboardNumber vxMetersPerSecond = new LoggedDashboardNumber("Drivetrain/Tuning/vxMetersPerSecond");
private LoggedDashboardNumber vyMetersPerSecond = new LoggedDashboardNumber("Drivetrain/Tuning/vyMetersPerSecond");
private LoggedDashboardNumber omegaRadiansPerSecond = new LoggedDashboardNumber("Drivetrain/Tuning/vxMetersPerSecond");


private DriveState state = DriveState.MANUAL;

private ChassisSpeeds driverChassisSpeeds = new ChassisSpeeds(); // Robot Relative
Expand Down Expand Up @@ -88,7 +94,6 @@ public void periodic() {
}

// Intentional Fall-through - if Limelight does not detect target, we do manual driving
case TUNING:
case MANUAL:
m_swerveDrivetrainIO.drive(driverChassisSpeeds, false, speedBoost);
// m_swerveDrivetrainIO.drive(driveX, driveY, driveOmega, true, false, speedBoost);
Expand Down Expand Up @@ -147,6 +152,8 @@ public void periodic() {
false,
speedBoost);
break;
case TUNING:
setDriverDesired(new ChassisSpeeds(vxMetersPerSecond.get(), vyMetersPerSecond.get(), omegaRadiansPerSecond.get()));
}

// Logger.recordOutput("Drive/DrivetrainState", state.toString());
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/frc/robot/subsystems/Intake/Intake.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
import frc.robot.subsystems.Intake.Roller.RollerIO;
import frc.robot.subsystems.Intake.Roller.RollerIOInputsAutoLogged;
import org.littletonrobotics.junction.Logger;
import org.littletonrobotics.junction.networktables.LoggedDashboardNumber;

public class Intake extends SubsystemBase {

private RollerIO rollerIO;
private LoggedDashboardNumber rollerSpeed = new LoggedDashboardNumber("Intake/Tuning/rollerSpeed");
private RollerIOInputsAutoLogged rollerIOInputs = new RollerIOInputsAutoLogged();

public enum IntakeState {
Expand Down Expand Up @@ -46,7 +47,7 @@ public void periodic() {
rollerIO.setSpeed(-1);
break;
case TUNING:
// TODO
rollerIO.setSpeed(rollerSpeed.get());
break;
case NOTE_HELD:
case IDLE:
Expand Down