Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
e887b11
Open Elevator only when close to reef
levyishai Mar 30, 2025
14d0035
added cool logic
levyishai Mar 30, 2025
bcee93c
cool all works
levyishai Mar 31, 2025
91c6f84
Joystick relative when intaking (easily removable, dw))
Nummun14 Apr 1, 2025
191ca3f
Possibly better algae
Strflightmight09 Apr 1, 2025
a07aa06
Quick algae shot for me
Strflightmight09 Apr 1, 2025
224c28a
It all actually works now
Strflightmight09 Apr 2, 2025
c590011
No time 😪
Strflightmight09 Apr 2, 2025
a49ce39
I have more controls
Strflightmight09 Apr 2, 2025
4403172
Refactor
Strflightmight09 Apr 2, 2025
410339d
Add floor algae to processor which may or may not work
Strflightmight09 Apr 3, 2025
4170f6f
Refactor Triggers + roll algae capabilities
Strflightmight09 Apr 5, 2025
8a4fa58
Different approach to rolling algae
Strflightmight09 Apr 5, 2025
c2164da
Add algae manipulation
Strflightmight09 Apr 6, 2025
c939257
Oops
Strflightmight09 Apr 6, 2025
d16a743
Bit of an update
Strflightmight09 Apr 6, 2025
5dfc15f
all good bro
Nummun14 Apr 16, 2025
17b9b38
cool stuff bro
Nummun14 Apr 16, 2025
4dad4a7
cmt
Nummun14 Apr 16, 2025
63e8fcd
fix sim not always loading
Nummun14 Apr 17, 2025
ea92f36
Controller Fixes from the lib (finally)
Strflightmight09 May 5, 2025
eb4ba4c
Made some better controls (not done)
Strflightmight09 May 29, 2025
e203335
Huge button changes
Strflightmight09 Jun 1, 2025
5eff4d4
Fix to stuff but sim is bad (just bad)
Strflightmight09 Jun 1, 2025
a19f28f
Auto feeder intake selection
Strflightmight09 Jun 1, 2025
1ce5502
Unnecessary
Strflightmight09 Jun 1, 2025
1c7d5e7
Oops
Strflightmight09 Jun 1, 2025
ff386fe
Even better
Strflightmight09 Jun 2, 2025
c82d2dc
e
Strflightmight09 Jun 3, 2025
9b9c5a3
Better
Strflightmight09 Jun 4, 2025
d833620
Only when it sees a tag
Strflightmight09 Jun 22, 2025
2b6bb8f
EXTRA NEWLINE!??!?!??!?!?!?!
Strflightmight09 Jun 22, 2025
8a39610
Quick cleaning?
Strflightmight09 Jun 24, 2025
4ab01c4
Clean? idk
Strflightmight09 Jun 30, 2025
c427a6e
Ok?
Strflightmight09 Jun 30, 2025
56ae69b
Keep open
Strflightmight09 Jun 30, 2025
46f1da3
Added intake assist + cleaning
Strflightmight09 Jul 1, 2025
6a8fe45
Good code
Strflightmight09 Jul 1, 2025
1be345b
Yay
Strflightmight09 Jul 1, 2025
69aeb18
tehehe
Strflightmight09 Jul 1, 2025
1f8deff
Relocate
Strflightmight09 Jul 2, 2025
60d13d8
Keep it like this for now
Strflightmight09 Jul 2, 2025
9d1d09d
👻
Strflightmight09 Jul 3, 2025
d728e0c
Still untested, but good idea(?)
Strflightmight09 Jul 23, 2025
a90161e
😧
Strflightmight09 Jul 23, 2025
d77906a
todo
Strflightmight09 Jul 23, 2025
d91a173
wowowiwa
Strflightmight09 Jul 31, 2025
ae6c84f
Small stuff
Strflightmight09 Aug 5, 2025
5f6e97e
Probably better logic, totally better controls
Strflightmight09 Aug 5, 2025
20b86a2
Fix algae logic
Strflightmight09 Aug 6, 2025
7a86ac3
Alternate assist 😎
Strflightmight09 Aug 6, 2025
3e96fda
Merge branch 'main' into post-houston-fixups
Strflightmight09 Aug 7, 2025
189304b
Fix errors
Strflightmight09 Aug 7, 2025
9d7140c
Added jd and reworked alternate assist
Strflightmight09 Aug 7, 2025
48efc23
Oops
Strflightmight09 Aug 7, 2025
3ddb938
Update JD, rotation -> theta, clamping for everything
Strflightmight09 Aug 9, 2025
d704fba
Logic fix, but it's still errors when the piece is no longer visible
Strflightmight09 Aug 9, 2025
252581b
Logic stuff I think
Strflightmight09 Aug 9, 2025
36a298c
Formatting
Strflightmight09 Aug 9, 2025
9d8915c
At least it doesn't crash
Strflightmight09 Aug 10, 2025
115a012
Log known object poses and some random stuff
Strflightmight09 Aug 10, 2025
185e66f
Biggest commit I've ever done probably
Strflightmight09 Aug 11, 2025
c72d689
L1 stuff and refactor
Strflightmight09 Aug 13, 2025
b25c298
it works now? thingy thing
Nummun14 Aug 21, 2025
3133608
remove option for multiple cameras on O.P.E
Nummun14 Aug 21, 2025
d7f2c16
This seemes to have fixed it for some reason
Nummun14 Aug 22, 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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ dependencies {
simulationRelease wpi.sim.enableRelease()

implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.github.Programming-TRIGON:TRIGONLib:v2025.3.0'
implementation 'com.github.Programming-TRIGON:TRIGONLib:v2025.3.1'

def akitJson = new groovy.json.JsonSlurper().parseText(new File(projectDir.getAbsolutePath() + "/vendordeps/AdvantageKit.json").text)
annotationProcessor "org.littletonrobotics.akit:akit-autolog:$akitJson.version"
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/trigon/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void testInit() {

@Override
public void simulationPeriodic() {
if (RobotHardwareStats.isSimulation())
if (RobotHardwareStats.isReplay())
AprilTagCameraConstants.VISION_SIMULATION.update(RobotContainer.ROBOT_POSE_ESTIMATOR.getEstimatedOdometryPose());
SimulationFieldHandler.update();
}
Expand Down
33 changes: 14 additions & 19 deletions src/main/java/frc/trigon/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@
import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine;
import frc.trigon.robot.commands.CommandConstants;
import frc.trigon.robot.commands.commandclasses.CoralAlignmentCommand;
import frc.trigon.robot.commands.commandclasses.CoralAutoDriveCommand;
import frc.trigon.robot.commands.commandclasses.LEDAutoSetupCommand;
import frc.trigon.robot.commands.commandfactories.*;
import frc.trigon.robot.constants.AutonomousConstants;
import frc.trigon.robot.constants.CameraConstants;
import frc.trigon.robot.constants.FieldConstants;
import frc.trigon.robot.constants.OperatorConstants;
import frc.trigon.robot.constants.PathPlannerConstants;
import frc.trigon.robot.misc.objectdetectioncamera.ObjectPoseEstimator;
import frc.trigon.robot.misc.simulatedfield.SimulatedGamePieceConstants;
import frc.trigon.robot.poseestimation.poseestimator.RobotPoseEstimator;
Expand All @@ -29,7 +27,6 @@
import frc.trigon.robot.subsystems.algaemanipulator.AlgaeManipulatorCommands;
import frc.trigon.robot.subsystems.coralintake.CoralIntake;
import frc.trigon.robot.subsystems.coralintake.CoralIntakeCommands;
import frc.trigon.robot.subsystems.coralintake.CoralIntakeConstants;
import frc.trigon.robot.subsystems.elevator.Elevator;
import frc.trigon.robot.subsystems.elevator.ElevatorCommands;
import frc.trigon.robot.subsystems.elevator.ElevatorConstants;
Expand Down Expand Up @@ -83,7 +80,7 @@ public Command getAutonomousCommand() {
*/
private void initializeGeneralSystems() {
Flippable.init();
PathPlannerConstants.init();
AutonomousConstants.init();
}

private void configureBindings() {
Expand All @@ -95,38 +92,36 @@ private void configureBindings() {
private void bindDefaultCommands() {
SWERVE.setDefaultCommand(GeneralCommands.getFieldRelativeDriveCommand());
ALGAE_MANIPULATOR.setDefaultCommand(AlgaeManipulatorCommands.getDefaultCommand());
CORAL_INTAKE.setDefaultCommand(CoralIntakeCommands.getSetTargetStateCommand(CoralIntakeConstants.CoralIntakeState.REST));
CORAL_INTAKE.setDefaultCommand(CoralIntakeCommands.getCoralIntakeDefaultCommand());
ELEVATOR.setDefaultCommand(ElevatorCommands.getSetTargetStateCommand(ElevatorConstants.ElevatorState.REST));
GRIPPER.setDefaultCommand(GripperCommands.getGripperDefaultCommand());
}

private void bindControllerCommands() {
OperatorConstants.LED_AUTO_SETUP_TRIGGER.onTrue(new LEDAutoSetupCommand(() -> autoChooser.get().getName()));
OperatorConstants.RESET_HEADING_TRIGGER.onTrue(CommandConstants.RESET_HEADING_COMMAND);
// OperatorConstants.DRIVE_FROM_DPAD_TRIGGER.whileTrue(CommandConstants.SELF_RELATIVE_DRIVE_FROM_DPAD_COMMAND);
// OperatorConstants.TOGGLE_ROTATION_MODE_TRIGGER.onTrue(GeneralCommands.getToggleRotationModeCommand());
OperatorConstants.TOGGLE_BRAKE_TRIGGER.onTrue(GeneralCommands.getToggleBrakeCommand());
OperatorConstants.DEBUGGING_TRIGGER.whileTrue(CommandConstants.WHEEL_RADIUS_CHARACTERIZATION_COMMAND);

OperatorConstants.RESET_AMP_ALIGNER_TRIGGER.whileTrue(AlgaeManipulationCommands.getResetAmpAlignerCommand());
OperatorConstants.FLOOR_CORAL_COLLECTION_TRIGGER.and(OperatorConstants.LEFT_MULTIFUNCTION_TRIGGER).whileTrue(new CoralAutoDriveCommand());

OperatorConstants.OPERATOR_CONTROLLER.f3().whileTrue(new CoralAlignmentCommand());
OperatorConstants.FLOOR_CORAL_COLLECTION_TRIGGER.whileTrue(CoralCollectionCommands.getFloorCoralCollectionCommand());
OperatorConstants.FEEDER_CORAL_COLLECTION_TRIGGER.whileTrue(CoralCollectionCommands.getFeederCoralCollectionCommand());
OperatorConstants.SCORE_CORAL_IN_REEF_TRIGGER.whileTrue(CoralPlacingCommands.getScoreInReefCommand());

OperatorConstants.DEBUGGING_TRIGGER.whileTrue(CommandConstants.WHEEL_RADIUS_CHARACTERIZATION_COMMAND);
OperatorConstants.FEEDER_CORAL_COLLECTION_TRIGGER.whileTrue(CoralCollectionCommands.getFeederCoralCollectionFromIntakeCommand());
OperatorConstants.RIGHT_SCORE_TRIGGER.whileTrue(CoralPlacingCommands.getScoreInReefCommand(true));
OperatorConstants.LEFT_SCORE_TRIGGER.whileTrue(CoralPlacingCommands.getScoreInReefCommand(false));
OperatorConstants.EJECT_CORAL_TRIGGER.whileTrue(EjectionCommands.getEjectCoralCommand());
OperatorConstants.UNLOAD_CORAL_TRIGGER.whileTrue(CoralCollectionCommands.getUnloadCoralCommand());

OperatorConstants.COLLECT_ALGAE_FROM_REEF_TRIGGER.toggleOnTrue(AlgaeManipulationCommands.getCollectAlgaeFromReefCommand());
OperatorConstants.COLLECT_ALGAE_FROM_LOLLIPOP_TRIGGER.toggleOnTrue(AlgaeManipulationCommands.getCollectAlgaeFromLollipopCommand());
OperatorConstants.FEEDER_CORAL_COLLECTION_WITH_GRIPPER.whileTrue(CoralCollectionCommands.getFeederCoralCollectionFromGripperCommand());
}

private void bindSetters() {
OperatorConstants.ENABLE_IGNORE_LOLLIPOP_CORAL_TRIGGER.onTrue(CommandConstants.ENABLE_IGNORE_LOLLIPOP_CORAL_COMMAND);
OperatorConstants.DISABLE_IGNORE_LOLLIPOP_CORAL_TRIGGER.onTrue(CommandConstants.DISABLE_IGNORE_LOLLIPOP_CORAL_COMMAND);
OperatorConstants.ENABLE_INTAKE_ASSIST_TRIGGER.onTrue(CommandConstants.ENABLE_INTAKE_ASSIST_COMMAND);
OperatorConstants.DISABLE_INTAKE_ASSIST_TRIGGER.onTrue(CommandConstants.DISABLE_INTAKE_ASSIST_COMMAND);
OperatorConstants.ENABLE_AUTONOMOUS_REEF_SCORING_TRIGGER.onTrue(CommandConstants.ENABLE_AUTONOMOUS_REEF_SCORING_COMMAND);
OperatorConstants.DISABLE_AUTONOMOUS_REEF_SCORING_TRIGGER.onTrue(CommandConstants.DISABLE_AUTONOMOUS_REEF_SCORING_COMMAND);
OperatorConstants.TOGGLE_SHOULD_KEEP_INTAKE_OPEN_TRIGGER.onTrue(CommandConstants.TOGGLE_SHOULD_KEEP_INTAKE_OPEN_COMMAND);
}

private void configureSysIdBindings(MotorSubsystem subsystem) {
Expand All @@ -148,11 +143,11 @@ private void buildAutoChooser() {
final PathPlannerAuto autoNonMirrored = new PathPlannerAuto(autoName);
final PathPlannerAuto autoMirrored = new PathPlannerAuto(autoName, true);

if (!PathPlannerConstants.DEFAULT_AUTO_NAME.isEmpty() && PathPlannerConstants.DEFAULT_AUTO_NAME.equals(autoName)) {
if (!AutonomousConstants.DEFAULT_AUTO_NAME.isEmpty() && AutonomousConstants.DEFAULT_AUTO_NAME.equals(autoName)) {
hasDefault = true;
autoChooser.addDefaultOption(autoNonMirrored.getName(), autoNonMirrored);
autoChooser.addOption(autoMirrored.getName() + "Mirrored", autoMirrored);
} else if (!PathPlannerConstants.DEFAULT_AUTO_NAME.isEmpty() && PathPlannerConstants.DEFAULT_AUTO_NAME.equals(autoName + "Mirrored")) {
} else if (!AutonomousConstants.DEFAULT_AUTO_NAME.isEmpty() && AutonomousConstants.DEFAULT_AUTO_NAME.equals(autoName + "Mirrored")) {
hasDefault = true;
autoChooser.addDefaultOption(autoMirrored.getName() + "Mirrored", autoMirrored);
autoChooser.addOption(autoNonMirrored.getName(), autoNonMirrored);
Expand Down
30 changes: 15 additions & 15 deletions src/main/java/frc/trigon/robot/commands/CommandConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import frc.trigon.robot.commands.commandfactories.CoralCollectionCommands;
import frc.trigon.robot.commands.commandfactories.CoralPlacingCommands;
import frc.trigon.robot.commands.commandfactories.GeneralCommands;
import frc.trigon.robot.constants.AutonomousConstants;
import frc.trigon.robot.constants.FieldConstants;
import frc.trigon.robot.constants.OperatorConstants;
import frc.trigon.robot.constants.PathPlannerConstants;
import frc.trigon.robot.subsystems.swerve.SwerveCommands;
import org.trigon.commands.CameraPositionCalculationCommand;
import org.trigon.commands.WheelRadiusCharacterizationCommand;
Expand All @@ -27,29 +27,28 @@ public class CommandConstants {
private static final XboxController DRIVER_CONTROLLER = OperatorConstants.DRIVER_CONTROLLER;
private static final double
MINIMUM_TRANSLATION_SHIFT_POWER = 0.30,
MINIMUM_ROTATION_SHIFT_POWER = 0.4;
MINIMUM_ROTATION_SHIFT_POWER = 0.4;//TODO: Calibrate with real robot
private static final double JOYSTICK_ORIENTED_ROTATION_DEADBAND = 0.07;

public static final Command
FIELD_RELATIVE_DRIVE_WITH_JOYSTICK_ORIENTED_ROTATION_TO_REEF_SECTIONS_COMMAND = SwerveCommands.getClosedLoopFieldRelativeDriveCommand(
FIELD_RELATIVE_DRIVE_WITH_JOYSTICK_ORIENTED_ROTATION_COMMAND = SwerveCommands.getClosedLoopFieldRelativeDriveCommand(
() -> calculateDriveStickAxisValue(DRIVER_CONTROLLER.getLeftY()),
() -> calculateDriveStickAxisValue(DRIVER_CONTROLLER.getLeftX()),
CommandConstants::calculateJoystickOrientedToReefSectionsTargetAngle
CommandConstants::calculateTargetHeadingFromJoystickAngle
),
SELF_RELATIVE_DRIVE_COMMAND = SwerveCommands.getClosedLoopSelfRelativeDriveCommand(
() -> calculateDriveStickAxisValue(DRIVER_CONTROLLER.getLeftY()),
() -> calculateDriveStickAxisValue(DRIVER_CONTROLLER.getLeftX()),
() -> calculateRotationStickAxisValue(DRIVER_CONTROLLER.getRightX())
),
RESET_HEADING_COMMAND = new InstantCommand(RobotContainer.ROBOT_POSE_ESTIMATOR::resetHeading),
// RESET_HEADING_COMMAND = new InstantCommand(() -> RobotContainer.ROBOT_POSE_ESTIMATOR.resetPose(RobotContainer.ROBOT_POSE_ESTIMATOR.getEstimatedRobotPose())),
SELF_RELATIVE_DRIVE_FROM_DPAD_COMMAND = SwerveCommands.getClosedLoopSelfRelativeDriveCommand(
() -> getXPowerFromPov(DRIVER_CONTROLLER.getPov()) / OperatorConstants.POV_DIVIDER / calculateShiftModeValue(MINIMUM_TRANSLATION_SHIFT_POWER),
() -> getYPowerFromPov(DRIVER_CONTROLLER.getPov()) / OperatorConstants.POV_DIVIDER / calculateShiftModeValue(MINIMUM_TRANSLATION_SHIFT_POWER),
() -> 0
),
SELF_RELATIVE_DRIVE_FROM_DPAD_COMMAND = SwerveCommands.getClosedLoopSelfRelativeDriveCommand(
() -> getXPowerFromPov(DRIVER_CONTROLLER.getPov()) / OperatorConstants.POV_DIVIDER / calculateShiftModeValue(MINIMUM_TRANSLATION_SHIFT_POWER),
() -> getYPowerFromPov(DRIVER_CONTROLLER.getPov()) / OperatorConstants.POV_DIVIDER / calculateShiftModeValue(MINIMUM_TRANSLATION_SHIFT_POWER),
() -> 0
),
WHEEL_RADIUS_CHARACTERIZATION_COMMAND = new WheelRadiusCharacterizationCommand(
PathPlannerConstants.ROBOT_CONFIG.moduleLocations,
AutonomousConstants.ROBOT_CONFIG.moduleLocations,
RobotContainer.SWERVE::getDriveWheelPositionsRadians,
() -> RobotContainer.SWERVE.getHeading().getRadians(),
(omegaRadiansPerSecond) -> RobotContainer.SWERVE.selfRelativeDriveWithoutSetpointGeneration(new ChassisSpeeds(0, 0, omegaRadiansPerSecond), null),
Expand All @@ -65,8 +64,9 @@ public class CommandConstants {
public static final Command
ENABLE_AUTONOMOUS_REEF_SCORING_COMMAND = new InstantCommand(() -> CoralPlacingCommands.SHOULD_SCORE_AUTONOMOUSLY = true).ignoringDisable(true),
DISABLE_AUTONOMOUS_REEF_SCORING_COMMAND = new InstantCommand(() -> CoralPlacingCommands.SHOULD_SCORE_AUTONOMOUSLY = false).ignoringDisable(true),
ENABLE_IGNORE_LOLLIPOP_CORAL_COMMAND = new InstantCommand(() -> CoralCollectionCommands.SHOULD_IGNORE_LOLLIPOP_CORAL = true).ignoringDisable(true),
DISABLE_IGNORE_LOLLIPOP_CORAL_COMMAND = new InstantCommand(() -> CoralCollectionCommands.SHOULD_IGNORE_LOLLIPOP_CORAL = false).ignoringDisable(true);
ENABLE_INTAKE_ASSIST_COMMAND = new InstantCommand(() -> CoralCollectionCommands.SHOULD_ASSIST_INTAKE = true).ignoringDisable(true),
DISABLE_INTAKE_ASSIST_COMMAND = new InstantCommand(() -> CoralCollectionCommands.SHOULD_ASSIST_INTAKE = false).ignoringDisable(true),
TOGGLE_SHOULD_KEEP_INTAKE_OPEN_COMMAND = new InstantCommand(() -> CoralCollectionCommands.SHOULD_KEEP_INTAKE_OPEN = !CoralCollectionCommands.SHOULD_KEEP_INTAKE_OPEN);

/**
* Calculates the target drive power from an axis value by dividing it by the shift mode value.
Expand Down Expand Up @@ -106,9 +106,9 @@ public static double calculateShiftModeValue(double minimumPower) {
* Calculates the target rotation value from the joystick's angle. Used for joystick oriented rotation.
* Joystick oriented rotation is when the robot rotates directly to the joystick's angle.
*
* @return the rotation value
* @return the target heading
*/
public static FlippableRotation2d calculateJoystickOrientedToReefSectionsTargetAngle() {
public static FlippableRotation2d calculateTargetHeadingFromJoystickAngle() {
final double
xPower = DRIVER_CONTROLLER.getRightX(),
yPower = DRIVER_CONTROLLER.getRightY();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ public static Command getDriveToCoralCommand(Supplier<Translation2d> distanceFro
// () -> Y_PID_CONTROLLER.calculate(distanceFromTrackedCoral.get().getY()),
// CoralAutoDriveCommand::calculateTargetAngle
// ).until(() -> shouldMoveTowardsCoral(distanceFromTrackedCoral.get())),
new InstantCommand(() -> X_PID_CONTROLLER.reset(distanceFromTrackedCoral.get().getX())),
new InstantCommand(() -> X_PID_CONTROLLER.reset(distanceFromTrackedCoral.get().getX(), RobotContainer.SWERVE.getSelfRelativeVelocity().vxMetersPerSecond)),
SwerveCommands.getClosedLoopSelfRelativeDriveCommand(
() -> X_PID_CONTROLLER.calculate(distanceFromTrackedCoral.get().getX(), -0.65),
() -> X_PID_CONTROLLER.calculate(distanceFromTrackedCoral.get().getX(), -0.76),
() -> Y_PID_CONTROLLER.calculate(distanceFromTrackedCoral.get().getY()),
CoralAutoDriveCommand::calculateTargetAngle
)
Expand Down
Loading
Loading