Skip to content

Commit 3224b64

Browse files
committed
Test
1 parent 7091049 commit 3224b64

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

src/main/java/frc/robot/RobotContainer.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public RobotContainer() {
123123
configureButtonBindings();
124124
mDrive.setDefaultCommand(new JoystickDrive(mDrive, joysticks));
125125
// mDrive.setDefaultCommand(new TestDrive(mDrive));
126-
mIntake.setDefaultCommand(new RetractIntake(mIntake));
126+
mIntake.setDefaultCommand(new RetractIntake(mIntake)); // UNDO THIS
127127
// mShooter.setDefaultCommand(new StopShooter(mShooter));
128128
// mShooter.setDefaultCommand(new FlywheelController(mShooter, 0));
129129
// mClimber.setDefaultCommand(new RetractClimber(mClimber));
@@ -357,9 +357,9 @@ public void configureButtonBindings() {
357357
// .alongWith(new XBoxButtonCommand(X_BOX_X)));
358358
xBoxX.whenHeld(new MotionProfileTurn(mDrive, Math.PI/2));
359359

360-
xBoxX.whenReleased(new StopShooter(mShooter)
361-
.alongWith(new TurnOffLEDs(mLimelight))
362-
.alongWith(new IdleCommand()));
360+
// xBoxX.whenReleased(new StopShooter(mShooter)
361+
// .alongWith(new TurnOffLEDs(mLimelight))
362+
// .alongWith(new IdleCommand()));
363363

364364
JoystickButton xBoxY = new JoystickButton(operator, X_BOX_Y);
365365
xBoxY.whenHeld(new PresetFlywheelController(mShooter, "TUR")

src/main/java/frc/robot/drive/commands/MotionProfileTurn.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import edu.wpi.first.math.geometry.Rotation2d;
99
import edu.wpi.first.math.kinematics.ChassisSpeeds;
1010
import edu.wpi.first.math.trajectory.TrapezoidProfile;
11+
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
1112
import edu.wpi.first.wpilibj2.command.CommandBase;
1213
import frc.robot.drive.Drivetrain;
1314

@@ -21,27 +22,35 @@ public MotionProfileTurn(Drivetrain drive, double offset) {
2122
this.drive = drive;
2223
this.offset = offset;
2324
addRequirements(drive);
24-
controller = new ProfiledPIDController(0.0, 0.0, 0.0, new TrapezoidProfile.Constraints(10, 10));
25-
controller.enableContinuousInput(-Math.PI, Math.PI);
2625
}
2726

2827
@Override
2928
public void initialize() {
30-
target = offset + drive.getPose().getRotation().getRadians();
29+
// target = offset + drive.getPose().getRotation().getRadians();
30+
SmartDashboard.putString("Turning", "Enabled");
31+
target = 0;
32+
controller = new ProfiledPIDController(0.35, 0.0, 0.0, new TrapezoidProfile.Constraints(10, 10), 0.02);
33+
controller.enableContinuousInput(-Math.PI, Math.PI);
3134
}
3235

3336
@Override
3437
public void execute() {
3538
double theta = drive.getPose().getRotation().getRadians();
36-
double feedback = controller.calculate(theta, 0);
39+
double feedback = controller.calculate(theta, 1);
3740
double feedforward = controller.getSetpoint().velocity;
41+
SmartDashboard.putNumber("Theta Angle", theta);
42+
SmartDashboard.putNumber("Turning Feedforward", feedforward);
3843
drive.drive(new ChassisSpeeds(0, 0, feedforward), false);
44+
target++;
45+
SmartDashboard.putNumber("Loops", target);
46+
// drive.drive(new ChassisSpeeds(0, 0, 1), false);
3947
}
4048

4149
// Called once the command ends or is interrupted.
4250
@Override
4351
public void end(boolean interrupted) {
4452
drive.brake();
53+
SmartDashboard.putString("Turning", "Disabled");
4554
}
4655

4756
// Returns true when the command should end.

0 commit comments

Comments
 (0)