a2f83d4233a23e8e16d0349b5ef9c1a4ee1118a4
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / commands / AlignToScore.java
1 package org.usfirst.frc.team3501.robot.commands;
2
3 import org.usfirst.frc.team3501.robot.Robot;
4
5 import edu.wpi.first.wpilibj.command.CommandGroup;
6
7 /**
8 * This command group will be used in autonomous. Based on what position the
9 * robot is in, the robot will align with the goal
10 *
11 * pre-condition: robot is flush against a defense at the specified position in
12 * the opponent's courtyard
13 *
14 * post-condition: the robot is parallel to one of the three goals and the
15 * shooter is facing that goal
16 *
17 */
18 public class AlignToScore extends CommandGroup {
19 private final double DIST_CENTER_OF_MASS_TO_FRONT_OF_ROBOT = 0;
20
21 private final double DEFAULT_SPEED = 0.5;
22
23 // constants for position 1: low bar
24 private final double POS1_DIST1 = 0;
25 private final double POS1_TURN1 = 0;
26 private final double POS1_DIST2 = 0;
27
28 // constants for position 2
29 private final double POS2_DIST1 = 0;
30 private final double POS2_TURN1 = 0;
31 private final double POS2_DIST2 = 0;
32
33 // constants for position 3
34 private final double POS3_DIST1 = 0;
35 private final double POS3_TURN1 = 0;
36 private final double POS3_DIST2 = 0;
37 private final double POS3_TURN2 = 0;
38 private final double POS3_DIST3 = 0;
39
40 // constants for position 4
41 private final double POS4_DIST1 = 0;
42 private final double POS4_TURN1 = 0;
43 private final double POS4_DIST2 = 0;
44 private final double POS4_TURN2 = 0;
45 private final double POS4_DIST3 = 0;
46
47 // constants for position 5
48 private final double POS5_DIST1 = 0;
49 private final double POS5_TURN1 = 0;
50 private final double POS5_DIST2 = 0;
51
52 public AlignToScore(int position) {
53
54 switch (position) {
55
56 // position 1 is always the low bar
57 case 1:
58
59 addSequential(new DriveForDistance(POS1_DIST1, DEFAULT_SPEED));
60 addSequential(new TurnForAngle(POS1_TURN1));
61 addSequential(new DriveForDistance(POS1_DIST2, DEFAULT_SPEED));
62
63 case 2:
64
65 addSequential(new DriveForDistance(POS2_DIST1, DEFAULT_SPEED));
66 addSequential(new TurnForAngle(POS2_TURN1));
67 addSequential(new DriveForDistance(POS2_DIST2, DEFAULT_SPEED));
68
69 case 3:
70
71 addSequential(new DriveForDistance(POS3_DIST1, DEFAULT_SPEED));
72 addSequential(new TurnForAngle(POS3_TURN1));
73 addSequential(new DriveForDistance(POS3_DIST2, DEFAULT_SPEED));
74 addSequential(new TurnForAngle(POS3_TURN2));
75 addSequential(new DriveForDistance(POS3_DIST3, DEFAULT_SPEED));
76
77 case 4:
78
79 addSequential(new DriveForDistance(POS4_DIST1, DEFAULT_SPEED));
80 addSequential(new TurnForAngle(POS4_TURN1));
81 addSequential(new DriveForDistance(POS4_DIST2, DEFAULT_SPEED));
82 addSequential(new TurnForAngle(POS4_TURN2));
83 addSequential(new DriveForDistance(POS4_DIST3, DEFAULT_SPEED));
84
85 case 5:
86
87 addSequential(new DriveForDistance(POS5_DIST1, DEFAULT_SPEED));
88 addSequential(new TurnForAngle(POS5_TURN1));
89 addSequential(new DriveForDistance(POS5_DIST2, DEFAULT_SPEED));
90 }
91 }
92
93 public static void calculatePath() {
94 double leftDistance = Robot.shooter.getLeftDistanceToTower();
95 double rightDistance = Robot.shooter.getRightDistanceToTower();
96 }
97 }