Skip to content

Commit

Permalink
drive
Browse files Browse the repository at this point in the history
  • Loading branch information
suryatho committed Feb 5, 2024
1 parent 4adc213 commit b14bff3
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 36 deletions.
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
public final class Constants {
public static final int loopPeriodMs = 20;
private static RobotType robotType = RobotType.SIMBOT;
private static RobotType robotType = RobotType.RAINBOWT;
public static final boolean tuningMode = true;

private static boolean invalidRobotAlertSent = false;
Expand Down
37 changes: 6 additions & 31 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.wpilibj.Filesystem;
import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj.XboxController;
Expand All @@ -25,17 +24,13 @@
import frc.robot.commands.DriveCommands;
import frc.robot.commands.FeedForwardCharacterization;
import frc.robot.subsystems.apriltagvision.AprilTagVision;
import frc.robot.subsystems.apriltagvision.AprilTagVisionConstants;
import frc.robot.subsystems.apriltagvision.AprilTagVisionIONorthstar;
import frc.robot.subsystems.drive.*;
import frc.robot.subsystems.superstructure.intake.Intake;
import frc.robot.subsystems.superstructure.intake.IntakeIO;
import frc.robot.subsystems.superstructure.intake.IntakeIOSim;
import frc.robot.subsystems.superstructure.intake.IntakeIOSparkMax;
import frc.robot.subsystems.superstructure.shooter.Shooter;
import frc.robot.subsystems.superstructure.shooter.ShooterIO;
import frc.robot.subsystems.superstructure.shooter.ShooterIOSim;
import frc.robot.subsystems.superstructure.shooter.ShooterIOSparkMax;
import frc.robot.util.AllianceFlipUtil;
import frc.robot.util.trajectory.ChoreoTrajectoryReader;
import frc.robot.util.trajectory.Trajectory;
Expand Down Expand Up @@ -82,11 +77,12 @@ public RobotContainer() {
new ModuleIOSparkMax(DriveConstants.moduleConfigs[2]),
new ModuleIOSparkMax(DriveConstants.moduleConfigs[3]),
false);
aprilTagVision =
new AprilTagVision(
new AprilTagVisionIONorthstar(AprilTagVisionConstants.cameraNames[0]));
shooter = new Shooter(new ShooterIOSparkMax());
intake = new Intake(new IntakeIOSparkMax());
// aprilTagVision =
// new AprilTagVision(
// new
// AprilTagVisionIONorthstar(AprilTagVisionConstants.cameraNames[0]));
// shooter = new Shooter(new ShooterIOSparkMax());
// intake = new Intake(new IntakeIOSparkMax());
}
}
}
Expand Down Expand Up @@ -199,27 +195,6 @@ private void configureButtonBindings() {
() -> -controller.getLeftY(),
() -> -controller.getLeftX(),
() -> -controller.getRightX()));
controller
.a()
.whileTrue(
drive.autoAlignToPose(
() ->
AllianceFlipUtil.apply(
new Pose2d(
new Translation2d(
FieldConstants.ampCenter.getX(),
FieldConstants.ampCenter.getY()
- DriveConstants.driveConfig.trackwidthY() / 2.0),
new Rotation2d(-Math.PI / 2.0)))));
// controller.a().onTrue(DriveCommands.toggleCalculateShotWhileMovingRotation(drive));
// controller
// .a()
// .onTrue(Commands.either(intake.stopCommand(), intake.intakeCommand(),
// intake::running));
// controller
// .x()
// .onTrue(Commands.either(intake.stopCommand(), intake.ejectCommand(),
// intake::running));
controller
.b()
.onTrue(
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/commands/DriveCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import frc.robot.RobotState;
import frc.robot.subsystems.drive.Drive;
import frc.robot.subsystems.drive.DriveConstants;
import frc.robot.subsystems.superstructure.ShotCalculator;
import frc.robot.util.AllianceFlipUtil;
import frc.robot.util.shooting.ShotCalculator;
import java.util.function.DoubleSupplier;
import java.util.function.Supplier;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/commands/auto/AutoCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import edu.wpi.first.wpilibj2.command.Commands;
import frc.robot.FieldConstants;
import frc.robot.RobotState;
import frc.robot.subsystems.superstructure.ShotCalculator;
import frc.robot.subsystems.superstructure.intake.Intake;
import frc.robot.util.AllianceFlipUtil;
import frc.robot.util.shooting.ShotCalculator;
import java.util.function.Supplier;

public class AutoCommands {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public final class DriveConstants {

// For Kraken
public static class KrakenDriveConstants {
public static final boolean useTorqueCurrentFOC = true;
public static final boolean useTorqueCurrentFOC = false;
public static final boolean useMotionMagic = false;
public static final double motionMagicCruiseVelocity = 0.0;
public static final double motionMagicAcceleration = 0.0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package frc.robot.subsystems.superstructure;
package frc.robot.util.shooting;

import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.math.geometry.Translation2d;
Expand Down

0 comments on commit b14bff3

Please sign in to comment.