diff --git a/src/main/java/frc4388/robot/RobotContainer.java b/src/main/java/frc4388/robot/RobotContainer.java index 9900e90..bdae26e 100644 --- a/src/main/java/frc4388/robot/RobotContainer.java +++ b/src/main/java/frc4388/robot/RobotContainer.java @@ -191,7 +191,6 @@ public class RobotContainer { RamseteCommand ramseteCommand = getRamseteCommand(trajectory); // Run path following command, then stop at the end. //return ramseteCommand.andThen(() -> m_robotDrive.tankDriveVelocity(0, 0)); - //return new AutoPath1FromCenter(m_robotDrive); return new AutoPath2FromRight(m_robotDrive); diff --git a/src/main/java/frc4388/robot/commands/AutoPath1FromCenter.java b/src/main/java/frc4388/robot/commands/AutoPath1FromCenter.java index ced8a88..e941c05 100644 --- a/src/main/java/frc4388/robot/commands/AutoPath1FromCenter.java +++ b/src/main/java/frc4388/robot/commands/AutoPath1FromCenter.java @@ -28,13 +28,13 @@ public class AutoPath1FromCenter extends SequentialCommandGroup { //shoot pre-loaded 3 balls new GotoCoordinates(m_drive, 75, 44, -90), //Start Intake Ball 1 - new GotoCoordinates(m_drive, 0, 12, 0), - new GotoCoordinates(m_drive, 0, 28, 0), + new GotoCoordinates(m_drive, 0, 12), + new GotoCoordinates(m_drive, 0, 28), //Start Intake Ball 2 - new GotoCoordinates(m_drive, 0, 8, 0), - new GotoCoordinates(m_drive, 0, 28, 0), + new GotoCoordinates(m_drive, 0, 8), + new GotoCoordinates(m_drive, 0, 28), //Start Intake Ball 3 - new GotoCoordinates(m_drive, 0, 8, 0), + new GotoCoordinates(m_drive, 0, 8), new Wait(m_drive, 0, 2) //Shoot 3 Balls ); diff --git a/src/main/java/frc4388/robot/commands/AutoPath2FromRight.java b/src/main/java/frc4388/robot/commands/AutoPath2FromRight.java index e1ebaa0..2411523 100644 --- a/src/main/java/frc4388/robot/commands/AutoPath2FromRight.java +++ b/src/main/java/frc4388/robot/commands/AutoPath2FromRight.java @@ -25,16 +25,18 @@ public class AutoPath2FromRight extends SequentialCommandGroup { m_drive = subsystem; addCommands( new Wait(m_drive, 0, 1), - new GotoCoordinates(m_drive, 0, 77, 0), + new GotoCoordinates(m_drive, 0, 77), //Start Intake Ball 1 - new GotoCoordinates(m_drive, 0, 8, 0), - new GotoCoordinates(m_drive, 0, 28, 0), + new GotoCoordinates(m_drive, 0, 8), + new GotoCoordinates(m_drive, 0, 28), //Start Intake Ball 2 - new GotoCoordinates(m_drive, 0, 8, 0), + new GotoCoordinates(m_drive, 0, 8), //Shoot 5 Balls - new GotoCoordinates(m_drive, 0, 28, 0), + new GotoCoordinates(m_drive, 0, 28), //Start Intake Ball 1 (second round) - new GotoCoordinates(m_drive, 0, 8, 0), + new GotoCoordinates(m_drive, 0, 8), + //Start Moving to 4th Ball + new GotoCoordinates(m_drive, 60, -50), new Wait(m_drive, 0, 2) ); } diff --git a/src/main/java/frc4388/robot/commands/GotoCoordinates.java b/src/main/java/frc4388/robot/commands/GotoCoordinates.java index cfa8d2e..244905b 100644 --- a/src/main/java/frc4388/robot/commands/GotoCoordinates.java +++ b/src/main/java/frc4388/robot/commands/GotoCoordinates.java @@ -38,10 +38,25 @@ public class GotoCoordinates extends SequentialCommandGroup { m_currentAngle = calcAngle(); - SmartDashboard.putNumber("Current Angle Coordinates", m_currentAngle); - m_endAngle = endAngle; + addCommands( new TurnDegrees(m_drive, m_currentAngle), + new Wait(m_drive, 0, 0), + new DriveStraightToPositionPID(m_drive, m_hypotDist), + new TurnDegrees(m_drive, m_endAngle - m_currentAngle)); + } + + public GotoCoordinates(Drive subsystem, double xTarget, double yTarget) { + m_drive = subsystem; + + m_xTarget = xTarget; + m_yTarget = yTarget; + + m_hypotDist = Math.sqrt((m_xTarget*m_xTarget) + (m_yTarget*m_yTarget)); + + m_currentAngle = calcAngle(); + + m_endAngle = m_currentAngle; addCommands( new TurnDegrees(m_drive, m_currentAngle), new Wait(m_drive, 0, 0),