@@ -10,30 +10,18 @@ public class SuperstructureGoals {
10
10
11
11
private final Queue <SuperstructureState > goals ;
12
12
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
-
28
13
public static Queue <SuperstructureState > generate (
29
14
SuperstructureState start , SuperstructureState end ) {
30
15
Queue <SuperstructureState > goals = new LinkedList <SuperstructureState >();
31
16
17
+ // TOOD Bug where the shoulder "bounces" while the intake is pivoting down
18
+
32
19
boolean shoulderMove = !start .atShoulderAngleGoal (end );
33
20
34
21
// Shoulder move: HOME -> STOW; ANY -> AMP
35
22
// Move wrist to STOW first, then move shoulder
36
23
if (shoulderMove ) {
24
+ System .out .println ("*** GENERATING SHOULDER MOVE ***" );
37
25
goals .add (start .withWristAngle (WristAngleConstants .STOW ));
38
26
goals .add (end .withWristAngle (WristAngleConstants .STOW ));
39
27
goals .add (end );
@@ -46,13 +34,19 @@ public static Queue<SuperstructureState> generate(
46
34
boolean pivotUp = start .pivotAngleRotations ().position > PivotAngleConstants .DOWN .getRotations ();
47
35
48
36
// Stow position movement & wrist-intake collision avoidance
49
- if (shoulderStowed && wristMove && pivotMove ) {
37
+ if (shoulderStowed && ! shoulderMove && wristMove && pivotMove ) {
50
38
if (pivotUp ) {
51
39
// Pivot is up and needs to go down; move it first
40
+ System .out .println ("*** GENERATING PIVOT DOWN ***" );
52
41
goals .add (start .withPivotAngleOf (end ));
42
+ goals .add (end );
43
+ return goals ;
53
44
} else {
45
+ System .out .println ("*** GENERATING WRIST UP ***" );
54
46
// Pivot is down and needs to go up; move wrist out of way first
55
47
goals .add (start .withWristAngleOf (end ));
48
+ goals .add (end );
49
+ return goals ;
56
50
}
57
51
}
58
52
0 commit comments