Started Path 2, Made endAngle an optional param

This commit is contained in:
Aarav Shah
2020-02-29 15:38:59 -07:00
parent a711fe43d4
commit 48b303fdfe
4 changed files with 30 additions and 14 deletions
@@ -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
);
@@ -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)
);
}
@@ -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),