04d12235349d5aa9a11a0f15e21c378ba80f64b4
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / commands / DefaultAutonStrategy.java
1 package org.usfirst.frc.team3501.robot.commands;
2
3 import org.usfirst.frc.team3501.robot.Constants.Defense;
4
5 import edu.wpi.first.wpilibj.command.CommandGroup;
6
7 /**
8 * The default autonomous strategy involves passing the defense that is in front
9 * of it, aiming the robot/ shooter towards the goal, and shooting.
10 */
11 public class DefaultAutonStrategy extends CommandGroup {
12
13 // in feet
14 // distance along a platform
15 final double DIST_BETWEEN_OUTER_WORKS__AND_COURTYARD = 4.0;
16 // number from -1 to 1
17 final double SPEED_FOR_PASSING_DEFENSE = 0.5;
18
19 public DefaultAutonStrategy(int position, Defense defense) {
20
21 // TODO: any variable that is not declared/instantiated are variables that
22 // need
23 // to be tested for their value
24
25 /*
26 * Portcullis: Robot is in front of the portcullis in whatever position 1-5.
27 * addSequential(new LiftPortcullis()); lifting the portcullis.
28 * addSequential(new DriveForDistance(distance, speed)); drive through the
29 * portcullis however neccesary. change direction to drive towards the
30 * designated shooting spot, go to that spot. shoot
31 */
32
33 /*
34 * Sally Port: Robot is in front of the sally port in whatever position 1-5.
35 * Do whatever is needed in order to cross sally port. addSequential(new
36 * DriveForDistance(distance, speed));//drive through the sally port. change
37 * direction to drive towards the designated shooting spot, go to that spot.
38 * shoot
39 */
40
41 /*
42 * Rough Terrain: Robot is in front of the sally port in whatever postion
43 * 1-5. Do whatever adaptive technique is required to pass rough terrain
44 * addSequential(new DriveForDistance(distance, speed)); go through the
45 * rough terrain change direction to drive towards the designated shooting
46 * spot, go to that spot. shoot
47 */
48
49 /*
50 * Low Bar: Robot is in front of low bar in whatever position 1-5.
51 * addSequential(new DriveForDistance(distance, speed));//drive through the
52 * low bar change direction to drive towards the designated shooting spot,
53 * go to that spot. shoot
54 */
55
56 /*
57 * Cheval de Frise: Robot is in front of cheval de frise in whatever
58 * position 1-5. do whatever to make all pieces facing down toward robot
59 * addSequential(new DriveForDistance(distance, speed));//drive to pass
60 * cheval de frise change direction to drive towards the designated shooting
61 * spot, go to that spot. shoot
62 */
63
64 /*
65 * Drawbridge: Robot is in front of drawbridge in whatever position 1-5.
66 * lift the drawbridge in whatever way it is to be lifted. addSequential(new
67 * DriveForDistance(distance, speed));//pass the drawbridge change direction
68 * to drive towards the designated shooting spot, go to that spot. shoot
69 */
70
71 /*
72 * Moat: Robot is in front of moat in whatever position 1-5. do whatever is
73 * adaptable to cross the moat. addSequential(new DriveForDistance(distance,
74 * speed));//cross the moat change direction to drive towards the designated
75 * shooting spot, go to that spot. shoot
76 */
77
78 /*
79 * Rockwall: Robot is in front of moat in whatever position 1-5. do whatever
80 * function is neccesary to cross the rock wall. addSequential(new
81 * DriveForDistance(distance, speed));//cross the rockwall change direction
82 * to drive towards the designated shooting spot, go to that spot. shoot
83 */
84
85 /*
86 * Rampart: Robot is in front of moat in whatever position 1-5. do whatever
87 * function is neccesary to cross the rockwall addSequential(new
88 * DriveForDistance(distance, speed));//cross the rockwall change direction
89 * to drive towards the designated shooting spot, go to that spot. shoot
90 */
91
92 switch (defense) {
93
94 case PORTCULLIS:
95
96 addSequential(new LiftPortcullis());
97
98 case SALLY_PORT:
99
100 addSequential(
101 new DriveForDistance(DIST_BETWEEN_OUTER_WORKS__AND_COURTYARD + 2,
102 DIST_BETWEEN_OUTER_WORKS__AND_COURTYARD + 2));
103
104 case ROUGH_TERRAIN:
105
106 addSequential(
107 new DriveForDistance(DIST_BETWEEN_OUTER_WORKS__AND_COURTYARD + 2,
108 DIST_BETWEEN_OUTER_WORKS__AND_COURTYARD + 2));
109
110 case LOW_BAR:
111
112 addSequential(
113 new DriveForDistance(DIST_BETWEEN_OUTER_WORKS__AND_COURTYARD + 2,
114 SPEED_FOR_PASSING_DEFENSE));
115
116 case CHEVAL_DE_FRISE:
117
118 addSequential(new LowerChevalDeFrise());
119
120 case DRAWBRIDGE:
121
122 addSequential(new LowerDrawBridge());
123
124 case MOAT:
125
126 addSequential(new DriveForDistance(
127 DIST_BETWEEN_OUTER_WORKS__AND_COURTYARD, SPEED_FOR_PASSING_DEFENSE));
128
129 case ROCK_WALL:
130
131 addSequential(new DriveForDistance(
132 DIST_BETWEEN_OUTER_WORKS__AND_COURTYARD, SPEED_FOR_PASSING_DEFENSE));
133
134 case RAMPART:
135
136 addSequential(new DriveForDistance(
137 DIST_BETWEEN_OUTER_WORKS__AND_COURTYARD, SPEED_FOR_PASSING_DEFENSE));
138
139 default:
140 break;
141 }
142
143 // aim towards goal
144 // later put in whatever argument goes inside of aim based on the position
145 // variable that was passed onto the command
146 // group
147 addSequential(new Aim());
148 addSequential(new Shoot());
149
150 }
151
152 }