Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

Commit

Permalink
Temporarily stop using PID for robot heading
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahsnider committed Apr 7, 2022
1 parent a348e49 commit eb38a86
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/main/java/frc/robot/drive/DriveSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,21 @@ public class DriveSubsystem extends SubsystemBase {
MAX_VELOCITY = Math.abs(maxChassisSpeedsForward.vxMetersPerSecond);
MAX_ANGULAR_VELOCITY = Math.abs(maxChassisSpeedsSpinning.omegaRadiansPerSecond);

System.out.println("maxChassisSpeedsSpinning:");
System.out.println(maxChassisSpeedsSpinning);

MAX_ACCELERATION = Wheel.MAX_ACCELERATION;
// TODO: This is the wheel's angular acceleration, do we need a different value for the robot
// itself?
MAX_ANGULAR_ACCELERATION = Wheel.MAX_ANGULAR_ACCELERATION;
System.out.println("MAX_VELOCITY");
System.out.println(MAX_VELOCITY);
System.out.println("MAX_ANGULAR_VELOCITY");
System.out.println(MAX_ANGULAR_VELOCITY);
System.out.println("MAX_ACCELERATION");
System.out.println(MAX_ACCELERATION);
System.out.println("MAX_ANGULAR_ACCELERATION");
System.out.println(MAX_ANGULAR_ACCELERATION);
}

private static final TrapezoidProfile.Constraints MAX_ROTATION =
Expand All @@ -85,7 +96,7 @@ public class DriveSubsystem extends SubsystemBase {
public final TrajectoryConfig trajectoryConfig;

private final ProfiledPIDController thetaController =
new ProfiledPIDController(1, 0, 0, MAX_ROTATION, Constants.PERIOD_SECONDS);
new ProfiledPIDController(2, 0.3, 0.2, MAX_ROTATION, Constants.PERIOD_SECONDS);

// Used for following trajectories
public final HolonomicDriveController driveController =
Expand Down Expand Up @@ -151,7 +162,8 @@ private void driveTeleop(
ChassisSpeeds.fromFieldRelativeSpeeds(
yPercentage * MAX_VELOCITY,
-xPercentage * MAX_VELOCITY,
thetaControllerVelocity,
// TODO: This ignores the PID output
thetaPercentage * MAX_ANGULAR_VELOCITY,
robotHeading);

// TODO: Stop logging this after debugging is finished
Expand Down

0 comments on commit eb38a86

Please sign in to comment.