Skip to content

Commit e65b6f0

Browse files
committed
Update AlgaeCoralerConstants and adjust Drive subsystem scaling factors
1 parent bf068a9 commit e65b6f0

File tree

6 files changed

+50
-126
lines changed

6 files changed

+50
-126
lines changed

src/main/java/frc/robot/Manager/Manager.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,13 @@ public Manager() {
3535
// Scoring/intaking Coral
3636
addTrigger(IDLE, CORAL_OUT, () -> DRIVER_CONTROLLER.getYButtonPressed());
3737

38-
// Auto stop scoring corral:
39-
40-
// addTrigger(CORAL_OUT, CORAL_BLOCK, DRIVER_CONTROLLER::getYButtonPressed);
41-
// addTrigger(CORAL_BLOCK, IDLE, DRIVER_CONTROLLER::getYButtonPressed);
42-
4338
// Scoring/intaking Algae
4439
addTrigger(IDLE, ALGAE_IN, DRIVER_CONTROLLER::getBButtonPressed);
4540
addTrigger(ALGAE_IN, HOLDING, DRIVER_CONTROLLER::getBButtonPressed);
4641
addTrigger(HOLDING, ALGAE_OUT, DRIVER_CONTROLLER::getBButtonPressed);
4742
addTrigger(ALGAE_IN, IDLE, DRIVER_CONTROLLER::getXButtonPressed);
4843
//Auto hold algae
4944

50-
//Zero Motors auto and manually
51-
// addRunnableTrigger(algaeCoraler::zero, () -> getState() == ManagerStates.IDLE && !algaeCoraler.motorZeroed());
52-
// addRunnableTrigger(algaeCoraler::resetMotorsZeroed, DRIVER_CONTROLLER::getAButtonPressed);
53-
54-
// Back to IDLE button is handled by if statement in run vstate.
55-
56-
//Auto Stuff
57-
5845
}
5946

6047
@Override

src/main/java/frc/robot/Robot.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99
import edu.wpi.first.cameraserver.CameraServer;
1010
import edu.wpi.first.wpilibj.DriverStation;
1111
import edu.wpi.first.wpilibj2.command.CommandScheduler;
12-
import frc.robot.AutoManager.AutoManager;
1312
import frc.robot.Manager.Manager;
1413
import frc.robot.Subsystems.Drive.Drive;
15-
import frc.robot.Subsystems.Vision.Vision;
1614
import frc.robot.Utilitys.Utilitys;
1715
import org.littletonrobotics.junction.LoggedRobot;
1816
import org.littletonrobotics.junction.Logger;
@@ -23,8 +21,8 @@
2321
public class Robot extends LoggedRobot {
2422

2523
private Manager manager;
26-
private AutoManager autoManager;
27-
private Vision vision;
24+
//private AutoManager autoManager;
25+
//private Vision vision;
2826

2927
public Robot() {}
3028

@@ -46,8 +44,8 @@ public void robotInit() {
4644
}
4745

4846
manager = Manager.getInstance();
49-
autoManager = new AutoManager();
50-
vision = Vision.getInstance();
47+
//autoManager = new AutoManager();
48+
//vision = Vision.getInstance();
5149

5250
Logger.start();
5351
PathfindingCommand.warmupCommand().schedule();
@@ -60,15 +58,15 @@ public void robotInit() {
6058
@Override
6159
public void robotPeriodic() {
6260
manager.periodic();
63-
vision.periodic();
61+
//vision.periodic();
6462
CommandScheduler.getInstance().run();
6563
Utilitys.controllers.clearCache();
6664
}
6765

6866
@Override
6967
public void autonomousInit() {
7068
Drive.getInstance().zeroGyro();
71-
CommandScheduler.getInstance().schedule(autoManager.getSelectedCommand());
69+
//CommandScheduler.getInstance().schedule(autoManager.getSelectedCommand());
7270
}
7371

7472
@Override
@@ -90,7 +88,7 @@ public void disabledInit() {}
9088

9189
@Override
9290
public void disabledPeriodic() {
93-
vision.periodic();
91+
//vision.periodic();
9492
}
9593

9694
@Override

src/main/java/frc/robot/Subsystems/AlgaeCoraler/AlgaeCoralerConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public final class AlgaeCoralerConstants {
3131
//Speeds
3232
public static final double ALGAE_IN_SPEED = -1;
3333
public static final double ALGAE_OUT_SPEED = 1;
34-
public static final double CORAL_OUT_SPEED = -0.25;
34+
public static final double CORAL_OUT_SPEED = -0.4;
3535
public static final double HOLDING_SPEED = 0;
3636
public static final double AUTO_SPEED = -0.43;
3737

src/main/java/frc/robot/Subsystems/Drive/Drive.java

Lines changed: 5 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,17 @@
22

33
import static frc.robot.GlobalConstants.Controllers.DRIVER_CONTROLLER;
44
import static frc.robot.Subsystems.Drive.DriveConstants.*;
5-
6-
import com.pathplanner.lib.auto.AutoBuilder;
7-
import com.pathplanner.lib.controllers.PPHolonomicDriveController;
8-
import com.pathplanner.lib.pathfinding.Pathfinding;
9-
import com.pathplanner.lib.util.PathPlannerLogging;
105
import edu.wpi.first.math.Matrix;
116
import edu.wpi.first.math.geometry.Pose2d;
127
import edu.wpi.first.math.geometry.Rotation2d;
138
import edu.wpi.first.math.numbers.N1;
149
import edu.wpi.first.math.numbers.N3;
15-
import edu.wpi.first.wpilibj.DriverStation;
1610
import edu.wpi.first.wpilibj.Filesystem;
17-
import edu.wpi.first.wpilibj.smartdashboard.Field2d;
1811
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
1912
import frc.robot.GlobalConstants;
2013
import frc.robot.GlobalConstants.Controllers;
2114
import frc.robot.GlobalConstants.RobotMode;
2215
import java.io.File;
23-
import org.littletonrobotics.junction.Logger;
2416
import org.team7525.subsystem.Subsystem;
2517
import swervelib.SwerveDrive;
2618
import swervelib.SwerveInputStream;
@@ -34,9 +26,6 @@ public class Drive extends Subsystem<DriveStates> {
3426
private SwerveInputStream swerveInputs;
3527
private SwerveDrive swerveDrive;
3628
private boolean fieldRelative;
37-
38-
// Field/Auto Variables:
39-
private Field2d field;
4029
private boolean slow;
4130
// INSTANCE:
4231
private static Drive instance;
@@ -50,26 +39,8 @@ public static Drive getInstance() {
5039

5140
public Drive() {
5241
super("Drive", DriveStates.MANUAL);
53-
// Create field:
54-
field = new Field2d();
55-
56-
//Logging for pathplanner
57-
PathPlannerLogging.setLogActivePathCallback(poses -> {
58-
field.getObject("PATH").setPoses(poses);
59-
Logger.recordOutput("Auto/poses", poses.toArray(new Pose2d[poses.size()]));
60-
});
61-
PathPlannerLogging.setLogActivePathCallback(activePath -> {
62-
field.getObject("TRAJECTORY").setPoses(activePath);
63-
Logger.recordOutput(
64-
"Auto/Trajectory",
65-
activePath.toArray(new Pose2d[activePath.size()])
66-
);
67-
});
68-
Pathfinding.ensureInitialized();
69-
7042
slow = false;
7143
fieldRelative = true;
72-
7344
// Setup SwerveDrive:
7445
SwerveDriveTelemetry.verbosity = TelemetryVerbosity.HIGH;
7546
try {
@@ -90,30 +61,7 @@ public Drive() {
9061
() -> -1 * (Controllers.DRIVER_CONTROLLER.getLeftX())
9162
)
9263
.withControllerRotationAxis(() -> -1 * Controllers.DRIVER_CONTROLLER.getRightX())
93-
.allianceRelativeControl(true)
94-
.driveToPoseEnabled(false);
95-
96-
AutoBuilder.configure(
97-
swerveDrive::getPose, // Robot pose supplier
98-
swerveDrive::resetOdometry, // Method to reset odometry (will be called if your auto has a starting pose)
99-
swerveDrive::getRobotVelocity, // ChassisSpeeds supplier. MUST BE ROBOT RELATIVE
100-
swerveDrive::setChassisSpeeds, // Method that will drive the robot given ROBOT RELATIVE ChassisSpeeds. Also optionally outputs individual module feedforwards
101-
new PPHolonomicDriveController(
102-
// PPHolonomicController is the built in path following controller for holonomic drive trains
103-
PPH_TRANSLATION_PID, // Translation PID constants
104-
PPH_ROTATION_PID // Rotation PID constants
105-
),
106-
DriveConstants.getRobotConfig(), // The robot configuration
107-
() -> {
108-
var alliance = DriverStation.getAlliance();
109-
if (alliance.isPresent()) {
110-
return alliance.get() == DriverStation.Alliance.Red;
111-
}
112-
return false;
113-
},
114-
this // Reference to this subsystem to set requirements
115-
);
116-
64+
.allianceRelativeControl(true);
11765
establishTriggers();
11866
}
11967

@@ -140,14 +88,14 @@ public void runState() {
14088
if (Controllers.DRIVER_CONTROLLER.getLeftBumperButtonPressed()) {
14189
slow = false;
14290
}
143-
swerveInputs.scaleTranslation(0.33);
144-
swerveInputs.scaleRotation(0.33);
91+
swerveInputs.scaleTranslation(0.1);
92+
swerveInputs.scaleRotation(0.1);
14593
} else {
14694
if (Controllers.DRIVER_CONTROLLER.getLeftBumperButtonPressed()) {
14795
slow = true;
14896
}
149-
swerveInputs.scaleTranslation(1);
150-
swerveInputs.scaleRotation(1);
97+
swerveInputs.scaleTranslation(0.33);
98+
swerveInputs.scaleRotation(0.33);
15199
}
152100

153101
if (fieldRelative) {
@@ -164,7 +112,6 @@ public void runState() {
164112

165113
SmartDashboard.putBoolean("SLOW MODE", slow);
166114
SmartDashboard.putBoolean("FIELD RELATIVE", fieldRelative);
167-
SmartDashboard.putData(field);
168115
}
169116

170117
// Vision Code Getters:
@@ -194,12 +141,4 @@ public void addVisionMeasurement(
194141
}
195142
swerveDrive.updateOdometry();
196143
}
197-
// // Bum AUTO Stuff:
198-
// public void driveForward() {
199-
// swerveDrive.drive(DRIVE_FORWARD_CHASSIS_SPEED);
200-
// }
201-
202-
// public void sidewaysToRightFace() {
203-
// swerveDrive.drive(SIDEWAYS_TO_RIGHT_CHASSIS_SPEED);
204-
// }
205144
}

0 commit comments

Comments
 (0)