@@ -10,30 +10,18 @@ public class SuperstructureGoals {
1010
1111 private final Queue <SuperstructureState > goals ;
1212
13- public static Queue <SuperstructureState > merge (
14- Queue <SuperstructureState > first , Queue <SuperstructureState > second ) {
15- Queue <SuperstructureState > mergedGoals = new LinkedList <SuperstructureState >();
16-
17- while (!first .isEmpty ()) {
18- mergedGoals .add (first .poll ());
19- }
20-
21- while (!second .isEmpty ()) {
22- mergedGoals .add (second .poll ());
23- }
24-
25- return mergedGoals ;
26- }
27-
2813 public static Queue <SuperstructureState > generate (
2914 SuperstructureState start , SuperstructureState end ) {
3015 Queue <SuperstructureState > goals = new LinkedList <SuperstructureState >();
3116
17+ // TOOD Bug where the shoulder "bounces" while the intake is pivoting down
18+
3219 boolean shoulderMove = !start .atShoulderAngleGoal (end );
3320
3421 // Shoulder move: HOME -> STOW; ANY -> AMP
3522 // Move wrist to STOW first, then move shoulder
3623 if (shoulderMove ) {
24+ System .out .println ("*** GENERATING SHOULDER MOVE ***" );
3725 goals .add (start .withWristAngle (WristAngleConstants .STOW ));
3826 goals .add (end .withWristAngle (WristAngleConstants .STOW ));
3927 goals .add (end );
@@ -46,13 +34,19 @@ public static Queue<SuperstructureState> generate(
4634 boolean pivotUp = start .pivotAngleRotations ().position > PivotAngleConstants .DOWN .getRotations ();
4735
4836 // Stow position movement & wrist-intake collision avoidance
49- if (shoulderStowed && wristMove && pivotMove ) {
37+ if (shoulderStowed && ! shoulderMove && wristMove && pivotMove ) {
5038 if (pivotUp ) {
5139 // Pivot is up and needs to go down; move it first
40+ System .out .println ("*** GENERATING PIVOT DOWN ***" );
5241 goals .add (start .withPivotAngleOf (end ));
42+ goals .add (end );
43+ return goals ;
5344 } else {
45+ System .out .println ("*** GENERATING WRIST UP ***" );
5446 // Pivot is down and needs to go up; move wrist out of way first
5547 goals .add (start .withWristAngleOf (end ));
48+ goals .add (end );
49+ return goals ;
5650 }
5751 }
5852
0 commit comments