Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
0310fca
WIP (squash later)
srimanachanta Jan 18, 2025
16c4eba
Increase voltage warning on battery and add CAN error alert
srimanachanta Jan 29, 2025
f9babf3
clean
srimanachanta Feb 1, 2025
94bbec0
Merge branch 'main' of https://github.com/Talon540Programming/Reefsca…
Bluewaves54 Feb 3, 2025
93e655d
Implement Full Logging and Drivetrain Subsystem (#1)
srimanachanta Jan 18, 2025
98c0715
Fix Modules Falsely Reporting as Disconnected
srimanachanta Feb 5, 2025
1cc2430
Cleanup typing, make errors more obvious
srimanachanta Feb 13, 2025
803498a
Cleanup dashboard setting stuff
srimanachanta Feb 13, 2025
15e8caf
Update sim characterization constants to be more accurate, stops a ma…
srimanachanta Feb 13, 2025
37cd26f
Log drive motor temps
srimanachanta Feb 13, 2025
1b089c2
Merge branch 'main' into sriman-dev
srimanachanta Feb 13, 2025
addcdce
Formatting fixes
srimanachanta Feb 13, 2025
f7606cf
Inline tuning mode alert
srimanachanta Feb 13, 2025
9325f68
Misc drive fixes (#6)
srimanachanta Feb 13, 2025
e5c4843
Merge branch 'main' into sriman-dev
srimanachanta Feb 13, 2025
876046f
Rename RobotState to PoseEstimator
srimanachanta Feb 13, 2025
2ae942f
Refactor abstract alerts into util class to later roll into LEDs
srimanachanta Feb 13, 2025
2af259b
Update Phoenix6 to 2025.2.2
srimanachanta Feb 13, 2025
b2626e8
Refactor code structure to not over-expose subsystem specific stuff
srimanachanta Feb 13, 2025
2952998
Shorten name for drive temp
srimanachanta Feb 15, 2025
5b6968a
Fix red alliance drive commands bug
srimanachanta Feb 13, 2025
420fa3d
Update WPILIB to 2025.3.1
srimanachanta Feb 16, 2025
3be2661
Update stuff (#7)
srimanachanta Feb 16, 2025
2a1068c
Merge branch 'main' into sriman-dev
srimanachanta Feb 16, 2025
de577e5
fix akit version mismatch
srimanachanta Feb 20, 2025
68e75f9
Add intake subsystem
srimanachanta Feb 20, 2025
ca2f600
Update robot constants to match bot
srimanachanta Feb 22, 2025
6adf211
Fix DT bug
srimanachanta Feb 22, 2025
e8fbd80
Update Intake
srimanachanta Feb 22, 2025
4343534
explicitly set motor temp signals
srimanachanta Feb 22, 2025
96f6eae
dont make conversion factors variables
srimanachanta Feb 22, 2025
fb12507
Update FieldConstants.java
srimanachanta Feb 23, 2025
ba6e299
Update EqualsUtil.java
srimanachanta Feb 24, 2025
1baa58d
Add updatable debouncer
srimanachanta Feb 24, 2025
bd348ee
Make sim models non static
srimanachanta Feb 24, 2025
19e3976
Implement DispenserIO
srimanachanta Feb 24, 2025
ba09067
Implement ElevatorIO
srimanachanta Feb 24, 2025
9f9de79
Update IO
srimanachanta Feb 25, 2025
ee57f87
WIP
srimanachanta Feb 26, 2025
07083ba
fixes
Talon540-root Feb 26, 2025
d267a5f
add elevator and end effector subsystems
srimanachanta Feb 26, 2025
d1f8beb
add sprint
srimanachanta Feb 26, 2025
1d3b191
add proto auto intake
srimanachanta Feb 26, 2025
e7fadb7
schedule home command if not homed on teleop init
srimanachanta Feb 26, 2025
6cfc8e3
Update LoggedTunableNumber.java
srimanachanta Feb 26, 2025
b32b9fc
Update RobotContainer.java
srimanachanta Feb 26, 2025
2e7b277
Create ElevatorVisualizer.java
srimanachanta Feb 26, 2025
1b9467e
Merge branch 'sriman-dev' of https://github.com/Talon540Programming/R…
Talon540-root Feb 26, 2025
32aca1e
tuning stuff
Talon540-root Feb 27, 2025
a6ac1fe
fix merge
srimanachanta Feb 28, 2025
eda4d4b
Fix characterization DT bug
srimanachanta Feb 28, 2025
24e9f2b
Auto hone elevator on start
srimanachanta Feb 28, 2025
e9c1694
idk if this matters
srimanachanta Feb 28, 2025
de0014c
Make slow mode toggleable and cleanup changes from Thursday
srimanachanta Feb 28, 2025
f17c272
Make intake toggleable
srimanachanta Feb 28, 2025
3d7c324
stop elevator from honing on gyro reset
srimanachanta Feb 28, 2025
5b7bf78
Rename holdingCoral to better match lombok
srimanachanta Feb 28, 2025
fd13f3f
update dispenser eject to be faster
srimanachanta Feb 28, 2025
773704f
add reserialize command
srimanachanta Feb 28, 2025
bafb1a7
Add elevator and dispenser. fix drive bugs.
srimanachanta Feb 28, 2025
60ebba7
remove intake timeout
srimanachanta Mar 2, 2025
26c56be
add taxi auto
srimanachanta Mar 2, 2025
c8e1dbb
make eject configurable based on level
srimanachanta Mar 2, 2025
db57af5
add wait period to checking intake when enabling immediately after el…
srimanachanta Mar 2, 2025
2391b50
Add robot relative override
srimanachanta Mar 3, 2025
5e8c5a0
added unit conversion and promptly commented it back out
Talon540-root Mar 4, 2025
813d3df
add algae mode
srimanachanta Mar 4, 2025
f47b2de
stuff for ayush to fix
srimanachanta Mar 5, 2025
8072903
update vendor deps
srimanachanta Mar 5, 2025
72df17d
Update tunable number API to avoid redundant resets and call correct …
srimanachanta Mar 5, 2025
553d51a
Reimplement I term into SparkMax PID Controllers
srimanachanta Mar 5, 2025
b83d704
Merge branch 'sriman-dev'
Bluewaves54 Mar 6, 2025
13e38d6
Merge branch 'sriman-dev' of https://github.com/Talon540Programming/R…
Bluewaves54 Mar 6, 2025
adf1c06
Create ElevatorVisualizer.java
Bluewaves54 Mar 6, 2025
c6e99fd
Merge branch 'sriman-dev' of https://github.com/Talon540Programming/R…
Bluewaves54 Mar 6, 2025
2d59691
Merge branch 'sriman-dev' of https://github.com/Talon540Programming/R…
Talon540-root Mar 6, 2025
dff4618
Merge branch 'sriman-dev'
Talon540-root Mar 6, 2025
cc7e3ef
fixes
Talon540-root Mar 6, 2025
63323d3
Auto-enable robot-relative and slow mode when extending elevator
Talon540-root Mar 6, 2025
2609d97
added joystick disconnected alert and silenced driverstation warnings
Talon540-root Mar 6, 2025
de23ffd
Squashed commit of the following:
Talon540-root Mar 12, 2025
6425505
Merge branch 'main' into manual-alignment-commands
Talon540-root Mar 12, 2025
b53644f
formatting fixes
Talon540-root Mar 13, 2025
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
5 changes: 4 additions & 1 deletion src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ public Robot() {
// Configure brownout voltage
RobotController.setBrownoutVoltage(6.0);

// Create RobotConatiner
// Disable joysick warnings in Driver Station
DriverStation.silenceJoystickConnectionWarning(true);

// Create RobotContainer
robotContainer = new RobotContainer();
}

Expand Down
77 changes: 59 additions & 18 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@
import frc.robot.subsystems.intake.IntakeIOSim;
import frc.robot.subsystems.intake.IntakeIOSpark;
import frc.robot.util.AllianceFlipUtil;
import org.littletonrobotics.junction.AutoLogOutput;
import org.littletonrobotics.junction.networktables.LoggedDashboardChooser;
import org.littletonrobotics.junction.networktables.LoggedNetworkNumber;

public class RobotContainer {
// Button Binding variables
@AutoLogOutput private boolean robotRelativeEnabled = false;
@AutoLogOutput private boolean slowModeEnabled = false;

// Load PoseEstimator class
private final PoseEstimator poseEstimator = PoseEstimator.getInstance();

Expand All @@ -47,8 +52,6 @@ public class RobotContainer {
private final LoggedNetworkNumber endgameAlert2 =
new LoggedNetworkNumber("/SmartDashboard/Endgame Alert #2", 15.0);

private boolean slowModeEnabled;

public RobotContainer() {
switch (Constants.getMode()) {
case REAL -> {
Expand Down Expand Up @@ -145,6 +148,16 @@ private void configureButtonBindings() {
// Make slow mode toggleable
controller.y().toggleOnTrue(Commands.runOnce(() -> slowModeEnabled = !slowModeEnabled));

controller
.leftBumper()
.and(controller.rightBumper())
.onTrue(Commands.runOnce(() -> robotRelativeEnabled = true));

controller
.leftBumper()
.and(controller.rightBumper())
.onFalse(Commands.runOnce(() -> robotRelativeEnabled = false));

// Default command, normal field-relative drive
driveBase.setDefaultCommand(
DriveCommands.joystickDrive(
Expand All @@ -153,44 +166,72 @@ private void configureButtonBindings() {
() -> -controller.getLeftX(),
() -> -controller.getRightX(),
() -> slowModeEnabled,
() -> controller.leftBumper().and(controller.rightBumper()).getAsBoolean()));
() -> robotRelativeEnabled));

// Stow
controller.povDown().onTrue(Commands.runOnce(() -> elevatorBase.setGoal(ElevatorState.STOW)));
// L1
controller
.povLeft()
.onTrue(Commands.runOnce(() -> elevatorBase.setGoal(ElevatorState.L1_CORAL)));
.onTrue(
Commands.runOnce(
() -> {
robotRelativeEnabled = true;
slowModeEnabled = true;
})
.andThen(Commands.runOnce(() -> elevatorBase.setGoal(ElevatorState.L1_CORAL))));

// L2
controller
.povUp()
.onTrue(
Commands.either(
Commands.runOnce(() -> elevatorBase.setGoal(ElevatorState.L2_CORAL)),
Commands.runOnce(() -> elevatorBase.setGoal(ElevatorState.L2_ALGAE_REMOVAL)),
controller.b().negate().debounce(0.25)));
Commands.runOnce(
() -> {
robotRelativeEnabled = true;
slowModeEnabled = true;
})
.andThen(
Commands.either(
Commands.runOnce(() -> elevatorBase.setGoal(ElevatorState.L2_CORAL)),
Commands.runOnce(
() -> elevatorBase.setGoal(ElevatorState.L2_ALGAE_REMOVAL)),
controller.b().negate().debounce(0.25))));

// L3
controller
.povRight()
.onTrue(
Commands.either(
Commands.runOnce(() -> elevatorBase.setGoal(ElevatorState.L3_CORAL)),
Commands.runOnce(() -> elevatorBase.setGoal(ElevatorState.L3_ALGAE_REMOVAL)),
controller.b().negate().debounce(0.25)));
Commands.runOnce(
() -> {
robotRelativeEnabled = true;
slowModeEnabled = true;
})
.andThen(
Commands.either(
Commands.runOnce(() -> elevatorBase.setGoal(ElevatorState.L3_CORAL)),
Commands.runOnce(
() -> elevatorBase.setGoal(ElevatorState.L3_ALGAE_REMOVAL)),
controller.b().negate().debounce(0.25))));

// Intake
controller.x().toggleOnTrue(IntakeCommands.intake(elevatorBase, intakeBase, dispenserBase));

controller
.rightTrigger()
.onTrue(
Commands.either(
dispenserBase
.eject(elevatorBase::getGoal)
.andThen(Commands.runOnce(() -> elevatorBase.setGoal(ElevatorState.STOW))),
IntakeCommands.reserialize(elevatorBase, intakeBase, dispenserBase),
controller.leftTrigger().negate().debounce(0.25)));
Commands.runOnce(
() -> {
robotRelativeEnabled = false;
slowModeEnabled = false;
})
.andThen(
Commands.either(
dispenserBase
.eject(elevatorBase::getGoal)
.andThen(
Commands.runOnce(() -> elevatorBase.setGoal(ElevatorState.STOW))),
IntakeCommands.reserialize(elevatorBase, intakeBase, dispenserBase),
controller.leftTrigger().negate().debounce(0.25))));

// Home Elevator
controller
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/frc/robot/subsystems/drive/Module.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Module {
private static final LoggedTunableNumber driveIZone =
new LoggedTunableNumber("Drive/Module/DrivekIZone");
private static final LoggedTunableNumber turnkP = new LoggedTunableNumber("Drive/Module/TurnkP");
private static final LoggedTunableNumber turnkI = new LoggedTunableNumber("Drive/Module/TurnkI");
private static final LoggedTunableNumber turnkD = new LoggedTunableNumber("Drive/Module/TurnkD");

static {
Expand All @@ -46,6 +47,7 @@ class Module {
drivekD.initDefault(0.0);
driveIZone.initDefault(0.0);
turnkP.initDefault(10.0);
turnkI.initDefault(0.0);
turnkD.initDefault(0.0);
}
}
Expand Down
13 changes: 11 additions & 2 deletions src/main/java/frc/robot/subsystems/drive/ModuleIOSpark.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,14 @@ public void runTurnOpenLoop(double output) {

@Override
public void runDriveVelocity(double velocityRadPerSec) {
double ffVolts = driveFeedforward.calculate(velocityRadPerSec);
double ffVolts =
driveFeedforward.calculate(
velocityRadPerSec
// * 1 / (Math.PI * 2)
);
driveController.setReference(
velocityRadPerSec,
// * 1 / (Math.PI * 2),
ControlType.kVelocity,
ClosedLoopSlot.kSlot0,
ffVolts,
Expand All @@ -182,7 +187,11 @@ public void runDriveVelocity(double velocityRadPerSec) {
public void runTurnPosition(Rotation2d rotation) {
// Because internal encoder is relative, we want to wrap to the range -π to π radians.
var updatedSetpoint = MathUtil.angleModulus(rotation.getRadians());
turnController.setReference(updatedSetpoint, ControlType.kPosition);
turnController.setReference(
updatedSetpoint
// * 1 / (Math.PI * 2)
,
ControlType.kPosition);
}

@Override
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/frc/robot/util/AlertsUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public static AlertsUtil getInstance() {
private final Alert lowBatteryVoltageAlert =
new Alert("Battery voltage is too low, change the battery", AlertType.kWarning);
private final Debouncer batteryVoltageDebouncer = new Debouncer(1.5);
private final Alert joystickDisconnectedAlert =
new Alert("At least one joystick button is not detected", AlertType.kWarning);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is confusing, just say "Xbox Controller not detected", driver has no clue what the joystick api is.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That statement is incorrect and not representative of the error I am silencing. Often the Xbox Controller can be detected, but if there is an issue with bindings then requested buttons may not be detected. It should be kept as is to mirror the Driver Station bug it is silencing.
Also, the driver is smart enough to understand this alert.

private final Debouncer joystickDebouncer = new Debouncer(2);

// Program Alerts
private final Alert tuningModeAlert = new Alert("Robot in Tuning Mode", AlertType.kInfo);
Expand Down Expand Up @@ -75,6 +78,9 @@ public void periodic() {
batteryVoltageDebouncer.calculate(
RobotController.getBatteryVoltage() <= LOW_VOLTAGE_WARNING_THRESHOLD));

joystickDisconnectedAlert.set(
joystickDebouncer.calculate(DriverStation.isJoystickConnected(0)));

// Update Program Alerts
// TODO

Expand Down