pids tuned somewhat, heading thing FIXED

This commit is contained in:
aarav18
2022-02-07 19:49:27 -07:00
parent e0d293a0bc
commit 60f5cc6097
12 changed files with 110 additions and 13 deletions
+3 -3
View File
@@ -65,10 +65,10 @@ public final class Constants {
public static final Gains SWERVE_GAINS = new Gains(1.0, 0.0, 1.0, 0.0, 0, 1.0);
// swerve auto constants
public static final PIDController X_CONTROLLER = new PIDController(4.0, 0.0, 0.0);
public static final PIDController Y_CONTROLLER = new PIDController(0.01, 0.0, 0.0);
public static final PIDController X_CONTROLLER = new PIDController(0.5, 0.0, 0.0);
public static final PIDController Y_CONTROLLER = new PIDController(2.0, 0.0, 0.0);
public static final ProfiledPIDController THETA_CONTROLLER = new ProfiledPIDController(
1.0, 0.0, 0.0, new TrapezoidProfile.Constraints(Math.PI, Math.PI));
15.0, 0.1, 0.3, new TrapezoidProfile.Constraints(Math.PI, Math.PI));
// swerve configuration
public static final double NEUTRAL_DEADBAND = 0.04;
@@ -15,6 +15,7 @@ import javax.swing.plaf.nimbus.State;
import com.pathplanner.lib.PathPlanner;
import com.pathplanner.lib.PathPlannerTrajectory;
import com.pathplanner.lib.PathPlannerTrajectory.PathPlannerState;
import com.pathplanner.lib.commands.PPSwerveControllerCommand;
import edu.wpi.first.math.controller.HolonomicDriveController;
@@ -137,9 +138,12 @@ public class RobotContainer {
m_robotSwerveDrive::setModuleStates,
m_robotSwerveDrive);
PathPlannerState state = (PathPlannerState) traj.sample(0);
return new SequentialCommandGroup(
new InstantCommand(() -> m_robotSwerveDrive.m_gyro.reset()),
new InstantCommand(() -> m_robotSwerveDrive.resetOdometry(traj.getInitialPose())),
new InstantCommand(() -> m_robotSwerveDrive.resetOdometry(new Pose2d(state.poseMeters.getTranslation(), state.holonomicRotation))),
//new InstantCommand(() -> m_robotSwerveDrive.resetOdometry(traj.getInitialPose())),
ppSCC,
new InstantCommand(() -> m_robotSwerveDrive.stopModules())
);
@@ -181,8 +185,8 @@ public class RobotContainer {
// ppSwerveControllerCommand,
// new InstantCommand(() -> m_robotSwerveDrive.stopModules())
// );
// return runAuto("Move Forward", 5.0, 5.0);
return runAuto("Five Ball", 1.0, 1.0);
// return runAuto("Move Forward", 1.0, 1.0);
return runAuto("Move Down", 1.0, 1.0);
}
/**