@@ -21,72 +21,52 @@ public static void shooter() {
21
21
22
22
/**
23
23
* The function that will center the robot's aim on the target.
24
- *
24
+ *
25
25
* @param target The name of the target to aim at. ("top_hub","ball")
26
26
*/
27
27
public static void centerAim (ValidTargets target ) {
28
28
//https://i.kym-cdn.com/entries/icons/original/000/039/393/cover2.jpg
29
29
30
30
switch (target ) {
31
- case top_hub :
32
- Limelight .setPipeline (0 );
33
- Limelight .getLimelightData ();
34
- if (Math .abs (Limelight .nonZeroLimelightHorAng )>RobotInformation .deadbandAngle ) { //Is the number within the deadband range?
35
- if (Limelight .nonZeroLimelightHorAng >0 ) { //Positive
36
- // Turn right
37
- double motorSpeed = (Math .abs (Limelight .nonZeroLimelightHorAng * .9 )/59.6 )+.05 ;
38
- motorSpeed = Math .round (motorSpeed * 100 ) / 100.0 ;
39
- MotorControl .DriveCode .oldDriveTrain (motorSpeed , -motorSpeed );
40
- }
41
- if (Limelight .nonZeroLimelightHorAng <0 ) { //Negetive
42
- // Turn left
43
- double motorSpeed = (Math .abs (Limelight .nonZeroLimelightHorAng * .9 )/59.6 )+.05 ;
44
- motorSpeed = Math .round (motorSpeed * 100 ) / 100.0 ;
45
- MotorControl .DriveCode .oldDriveTrain (-motorSpeed , motorSpeed );
46
- }
47
- }
48
- // else {
49
- // DriveCode.oldDriveTrain(0, 0);
50
- // }
51
- break ;
31
+ case upper_hub : // Center on the Retroreflector regardless of wether upper or lower cause they are stacked
52
32
case lower_hub :
53
- Limelight .setPipeline (0 );
54
- Limelight . getLimelightData ();
55
- if (Math . abs ( Limelight .nonZeroLimelightHorAng )> RobotInformation . deadbandAngle ) { //Is the number within the deadband range?
56
- if ( Limelight . nonZeroLimelightHorAng > 0 ) { //Positive
57
- // Turn right
58
- double motorSpeed = ( Math .abs ( Limelight . nonZeroLimelightHorAng * .9 )/ 59.6 )+ .05 ;
59
- motorSpeed = Math . round (motorSpeed * 100 ) / 100.0 ;
60
- MotorControl . DriveCode . oldDriveTrain ( motorSpeed , - motorSpeed );
61
- }
62
- if ( Limelight . nonZeroLimelightHorAng < 0 ) { //Negetive
63
- // Turn left
64
- double motorSpeed = ( Math .abs ( Limelight . nonZeroLimelightHorAng * .9 )/ 59.6 )+ .05 ;
65
- motorSpeed = Math . round ( motorSpeed * 100 ) / 100.0 ;
66
- MotorControl . DriveCode . oldDriveTrain (- motorSpeed , motorSpeed );
33
+ VisionSystems . Limelight .setPipeline (0 );
34
+ if ( Math . abs ( VisionSystems . Limelight . nonZeroLimelightAngle )> RobotInformation . deadbandAngle ) { //Is the number within the deadband range?
35
+ if (VisionSystems . Limelight .nonZeroLimelightAngle > 0 ) { //Positive
36
+ // Turn right
37
+ double motorSpeed = ( Math . abs ( VisionSystems . Limelight . nonZeroLimelightAngle * .9 )/ 59.6 )+ .05 ;
38
+ motorSpeed = Math .round ( motorSpeed * 100 ) / 100.0 ;
39
+ MotorControl . DriveCode . oldDriveTrain (motorSpeed , - motorSpeed ) ;
40
+ }
41
+ if ( VisionSystems . Limelight . nonZeroLimelightAngle < 0 ) { //Negetive
42
+ // Turn left
43
+ double motorSpeed = ( Math . abs ( VisionSystems . Limelight . nonZeroLimelightAngle * .9 )/ 59.6 )+ .05 ;
44
+ motorSpeed = Math .round ( motorSpeed * 100 ) / 100.0 ;
45
+ MotorControl . DriveCode . oldDriveTrain (- motorSpeed , motorSpeed ) ;
46
+ }
67
47
}
68
- }
69
- // else {
70
- // DriveCode.oldDriveTrain(0, 0);
71
- // }
48
+ // else {
49
+ // DriveCode.oldDriveTrain(0, 0);
50
+ // }
72
51
break ;
73
52
74
53
case ball :
75
54
55
+
76
56
break ;
77
57
}
78
58
}
79
59
80
-
81
60
/**
82
61
* One click fire function
83
62
*/
84
63
public static void fire (ValidTargets target ) { //TODO: One click fire
85
- if (Math .abs (Limelight .nonZeroLimelightHorAng )>RobotInformation .deadbandAngle ) {
86
- centerAim (target );
87
- } else if (Math .abs (Limelight .nonZeroLimelightHorAng )<RobotInformation .deadbandAngle ) {
64
+ // if(Math.abs(Limelight.nonZeroLimelightHorAng)>RobotInformation.deadbandAngle) {
65
+ // centerAim(target);
66
+ // } else if(Math.abs(Limelight.nonZeroLimelightHorAng)<RobotInformation.deadbandAngle) {
67
+ // }
68
+
88
69
89
- }
90
70
}
91
71
92
- }
72
+ }
0 commit comments