-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGamePieceLocateTest.java
More file actions
52 lines (45 loc) · 1.64 KB
/
GamePieceLocateTest.java
File metadata and controls
52 lines (45 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package frc.robot.utils;
import static org.junit.jupiter.api.Assertions.*;
import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Rotation2d;
import frc.robot.constants.AlgaePositions;
import org.junit.jupiter.api.Test;
class GamePieceLocateTest {
@Test
void findAlgaePos() {
double robotX = Apriltag.EIGHTEEN.getX() - 0.889;
double robotY = Apriltag.EIGHTEEN.getY();
double txDeg = 0; // degrees
double dyDeg = -5; // degrees
AlgaePositions algaePos =
AlgaePositions.values()[
(int)
GamePieceLocate.findAlgaePos(
new Pose2d(robotX, robotY, new Rotation2d(0)), txDeg, dyDeg)[0]];
assertEquals(AlgaePositions.Algae_AB_LOW, algaePos);
txDeg = 0; // degrees
dyDeg = 20; // degrees
algaePos =
AlgaePositions.values()[
(int)
GamePieceLocate.findAlgaePos(
new Pose2d(robotX, robotY, new Rotation2d(0)), txDeg, dyDeg)[0]];
assertEquals(AlgaePositions.Algae_AB_HIGH, algaePos);
txDeg = 10; // degrees
dyDeg = 0; // degrees
algaePos =
AlgaePositions.values()[
(int)
GamePieceLocate.findAlgaePos(
new Pose2d(robotX, robotY, new Rotation2d(0)), txDeg, dyDeg)[0]];
assertEquals(AlgaePositions.Algae_CD_LOW, algaePos);
txDeg = -10; // degrees
dyDeg = 0; // degrees
algaePos =
AlgaePositions.values()[
(int)
GamePieceLocate.findAlgaePos(
new Pose2d(robotX, robotY, new Rotation2d(0)), txDeg, dyDeg)[0]];
assertEquals(AlgaePositions.Algae_KL_LOW, algaePos);
}
}