diff --git a/src/main/java/frc4388/robot/Main.java b/src/main/java/frc4388/robot/Main.java index 21f4236..fdb3853 100644 --- a/src/main/java/frc4388/robot/Main.java +++ b/src/main/java/frc4388/robot/Main.java @@ -28,5 +28,4 @@ public final class Main { } } - -// hi ryan \ No newline at end of file +// hi ryan -aarav \ No newline at end of file diff --git a/src/main/java/frc4388/robot/Robot.java b/src/main/java/frc4388/robot/Robot.java index db7bb1a..debf72c 100644 --- a/src/main/java/frc4388/robot/Robot.java +++ b/src/main/java/frc4388/robot/Robot.java @@ -66,6 +66,8 @@ public class Robot extends TimedRobot { // and running subsystem periodic() methods. This must be called from the robot's periodic // block in order for anything in the Command-based framework to work. CommandScheduler.getInstance().run(); + + // print odometry data to smart dashboard for debugging (if causing timeout errors, you can comment it) SmartDashboard.putNumber("Odometry X", m_robotContainer.getOdometry().getX()); SmartDashboard.putNumber("Odometry Y", m_robotContainer.getOdometry().getY()); SmartDashboard.putNumber("Odometry Theta", m_robotContainer.getOdometry().getRotation().getDegrees()); @@ -84,9 +86,6 @@ public class Robot extends TimedRobot { @Override public void disabledPeriodic() { - // SmartDashboard.putNumber("Odometry X", m_robotContainer.getOdometry().getX()); - // SmartDashboard.putNumber("Odometry Y", m_robotContainer.getOdometry().getY()); - // SmartDashboard.putNumber("Odometry Theta", m_robotContainer.getOdometry().getRotation().getDegrees()); } /** @@ -114,6 +113,7 @@ public class Robot extends TimedRobot { @Override public void teleopInit() { LOGGER.fine("teleopInit()"); + m_robotContainer.m_robotSwerveDrive.m_gyro.addYaw(-1 * m_robotContainer.m_robotSwerveDrive.m_gyro.getYaw()); // This makes sure that the autonomous stops running when // teleop starts running. If you want the autonomous to // continue until interrupted by another command, remove @@ -130,8 +130,6 @@ public class Robot extends TimedRobot { */ @Override public void teleopPeriodic() { - // m_robotContainer.getDriverController().updateInput(); - // m_robotContainer.getOperatorController().updateInput(); } /** diff --git a/src/main/java/frc4388/robot/RobotContainer.java b/src/main/java/frc4388/robot/RobotContainer.java index 203bcff..9440932 100644 --- a/src/main/java/frc4388/robot/RobotContainer.java +++ b/src/main/java/frc4388/robot/RobotContainer.java @@ -44,7 +44,7 @@ public class RobotContainer { private final RobotMap m_robotMap = new RobotMap(); /* Subsystems */ - private final SwerveDrive m_robotSwerveDrive = new SwerveDrive( + public final SwerveDrive m_robotSwerveDrive = new SwerveDrive( m_robotMap.leftFront, m_robotMap.leftBack, m_robotMap.rightFront, m_robotMap.rightBack, m_robotMap.gyro); private final TalonFX m_testMotor = new TalonFX(23); @@ -115,17 +115,19 @@ public class RobotContainer { * Generate autonomous * @param maxVel max velocity for the path (null to override default value of 5.0) * @param maxAccel max acceleration for the path (null to override default value of 5.0) - * @param inputs strings (paths) or commands you want to run (in order) - * @return array of commands + * @param inputs strings (path names) or commands you want to run (in order) + * @return array of commands, which can then be processed in a command group */ public Command[] buildAuto(Double maxVel, Double maxAccel, Object... inputs) { + // default vel and acc maxVel = Objects.requireNonNullElse(maxVel, SwerveDriveConstants.MAX_VEL); maxAccel = Objects.requireNonNullElse(maxAccel, SwerveDriveConstants.MAX_ACC); ArrayList commands = new ArrayList(); commands.add(new InstantCommand(() -> m_robotSwerveDrive.m_gyro.reset())); + // pids controlling the path PIDController xController = SwerveDriveConstants.X_CONTROLLER; PIDController yController = SwerveDriveConstants.Y_CONTROLLER; ProfiledPIDController thetaController = SwerveDriveConstants.THETA_CONTROLLER; @@ -134,7 +136,9 @@ public class RobotContainer { // parse input for (int i=0; i